Bläddra i källkod

make tests pass on Chrome 37.0 Android

Evan You 11 år sedan
förälder
incheckning
bcb8944dcc
1 ändrade filer med 15 tillägg och 10 borttagningar
  1. 15 10
      test/unit/specs/transition_spec.js

+ 15 - 10
test/unit/specs/transition_spec.js

@@ -200,17 +200,22 @@ if (_.inBrowser && !_.isIE9) {
         el.__v_trans.id = 'test'
         // cascaded class style
         el.classList.add('test')
-        transition.apply(el, -1, op, vm, cb)
-        expect(op).not.toHaveBeenCalled()
-        expect(cb).not.toHaveBeenCalled()
-        expect(el.classList.contains('test-leave')).toBe(false)
+        // wait a frame: Chrome Android 37 doesn't trigger
+        // transition if we apply the leave class in the
+        // same frame.
         _.nextTick(function () {
-          expect(el.classList.contains('test-leave')).toBe(true)
-          _.on(el, _.transitionEndEvent, function () {
-            expect(op).toHaveBeenCalled()
-            expect(cb).toHaveBeenCalled()
-            expect(el.classList.contains('test-leave')).toBe(false)
-            done()
+          transition.apply(el, -1, op, vm, cb)
+          expect(op).not.toHaveBeenCalled()
+          expect(cb).not.toHaveBeenCalled()
+          expect(el.classList.contains('test-leave')).toBe(false)
+          _.nextTick(function () {
+            expect(el.classList.contains('test-leave')).toBe(true)
+            _.on(el, _.transitionEndEvent, function () {
+              expect(op).toHaveBeenCalled()
+              expect(cb).toHaveBeenCalled()
+              expect(el.classList.contains('test-leave')).toBe(false)
+              done()
+            })
           })
         })
       })