Bladeren bron

make explicit transition duration tests more stable

Evan You 9 jaren geleden
bovenliggende
commit
8d25e8f574
1 gewijzigde bestanden met toevoegingen van 12 en 36 verwijderingen
  1. 12 36
      test/unit/features/transition/transition.spec.js

+ 12 - 36
test/unit/features/transition/transition.spec.js

@@ -896,18 +896,14 @@ if (!isIE9) {
           expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
           expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
         }).thenWaitFor(nextFrame).then(() => {
         }).thenWaitFor(nextFrame).then(() => {
           expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
           expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
-        }).thenWaitFor(explicitDuration - buffer).then(() => {
-          expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
-        }).thenWaitFor(buffer * 2).then(() => {
+        }).thenWaitFor(explicitDuration + buffer).then(() => {
           expect(vm.$el.children.length).toBe(0)
           expect(vm.$el.children.length).toBe(0)
           vm.ok = true
           vm.ok = true
         }).then(() => {
         }).then(() => {
           expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')
           expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')
         }).thenWaitFor(nextFrame).then(() => {
         }).thenWaitFor(nextFrame).then(() => {
           expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
           expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
-        }).thenWaitFor(explicitDuration - buffer).then(() => {
-          expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
-        }).thenWaitFor(buffer * 2).then(() => {
+        }).thenWaitFor(explicitDuration + buffer).then(() => {
           expect(vm.$el.children[0].className).toBe('test')
           expect(vm.$el.children[0].className).toBe('test')
         }).then(done)
         }).then(done)
       })
       })
@@ -930,18 +926,14 @@ if (!isIE9) {
           expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
           expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
         }).thenWaitFor(nextFrame).then(() => {
         }).thenWaitFor(nextFrame).then(() => {
           expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
           expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
-        }).thenWaitFor(duration - buffer).then(() => {
-          expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
-        }).thenWaitFor(buffer * 2).then(() => {
+        }).thenWaitFor(duration + buffer).then(() => {
           expect(vm.$el.children.length).toBe(0)
           expect(vm.$el.children.length).toBe(0)
           vm.ok = true
           vm.ok = true
         }).then(() => {
         }).then(() => {
           expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')
           expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')
         }).thenWaitFor(nextFrame).then(() => {
         }).thenWaitFor(nextFrame).then(() => {
           expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
           expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
-        }).thenWaitFor(explicitDuration - buffer).then(() => {
-          expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
-        }).thenWaitFor(buffer * 2).then(() => {
+        }).thenWaitFor(explicitDuration + buffer).then(() => {
           expect(vm.$el.children[0].className).toBe('test')
           expect(vm.$el.children[0].className).toBe('test')
         }).then(done)
         }).then(done)
       })
       })
@@ -964,18 +956,14 @@ if (!isIE9) {
           expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
           expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
         }).thenWaitFor(nextFrame).then(() => {
         }).thenWaitFor(nextFrame).then(() => {
           expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
           expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
-        }).thenWaitFor(explicitDuration - buffer).then(() => {
-          expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
-        }).thenWaitFor(buffer * 2).then(() => {
+        }).thenWaitFor(explicitDuration + buffer).then(() => {
           expect(vm.$el.children.length).toBe(0)
           expect(vm.$el.children.length).toBe(0)
           vm.ok = true
           vm.ok = true
         }).then(() => {
         }).then(() => {
           expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')
           expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')
         }).thenWaitFor(nextFrame).then(() => {
         }).thenWaitFor(nextFrame).then(() => {
           expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
           expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
-        }).thenWaitFor(duration - buffer).then(() => {
-          expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
-        }).thenWaitFor(buffer * 2).then(() => {
+        }).thenWaitFor(duration + buffer).then(() => {
           expect(vm.$el.children[0].className).toBe('test')
           expect(vm.$el.children[0].className).toBe('test')
         }).then(done)
         }).then(done)
       })
       })
@@ -1001,18 +989,14 @@ if (!isIE9) {
           expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
           expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
         }).thenWaitFor(nextFrame).then(() => {
         }).thenWaitFor(nextFrame).then(() => {
           expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
           expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
-        }).thenWaitFor(leave - buffer).then(() => {
-          expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
-        }).thenWaitFor(buffer * 2).then(() => {
+        }).thenWaitFor(leave + buffer).then(() => {
           expect(vm.$el.children.length).toBe(0)
           expect(vm.$el.children.length).toBe(0)
           vm.ok = true
           vm.ok = true
         }).then(() => {
         }).then(() => {
           expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')
           expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')
         }).thenWaitFor(nextFrame).then(() => {
         }).thenWaitFor(nextFrame).then(() => {
           expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
           expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
-        }).thenWaitFor(enter - buffer).then(() => {
-          expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
-        }).thenWaitFor(buffer * 2).then(() => {
+        }).thenWaitFor(enter + buffer).then(() => {
           expect(vm.$el.children[0].className).toBe('test')
           expect(vm.$el.children[0].className).toBe('test')
         }).then(done)
         }).then(done)
       })
       })
@@ -1044,18 +1028,14 @@ if (!isIE9) {
           expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
           expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
         }).thenWaitFor(nextFrame).then(() => {
         }).thenWaitFor(nextFrame).then(() => {
           expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
           expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
-        }).thenWaitFor(leave1 - buffer).then(() => {
-          expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
-        }).thenWaitFor(buffer * 2).then(() => {
+        }).thenWaitFor(leave1 + buffer).then(() => {
           expect(vm.$el.children.length).toBe(0)
           expect(vm.$el.children.length).toBe(0)
           vm.ok = true
           vm.ok = true
         }).then(() => {
         }).then(() => {
           expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')
           expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')
         }).thenWaitFor(nextFrame).then(() => {
         }).thenWaitFor(nextFrame).then(() => {
           expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
           expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
-        }).thenWaitFor(enter1 - buffer).then(() => {
-          expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
-        }).thenWaitFor(buffer * 2).then(() => {
+        }).thenWaitFor(enter1 + buffer).then(() => {
           expect(vm.$el.children[0].className).toBe('test')
           expect(vm.$el.children[0].className).toBe('test')
           vm.enter = enter2
           vm.enter = enter2
           vm.leave = leave2
           vm.leave = leave2
@@ -1065,18 +1045,14 @@ if (!isIE9) {
           expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
           expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
         }).thenWaitFor(nextFrame).then(() => {
         }).thenWaitFor(nextFrame).then(() => {
           expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
           expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
-        }).thenWaitFor(leave2 - buffer).then(() => {
-          expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
-        }).thenWaitFor(buffer * 2).then(() => {
+        }).thenWaitFor(leave2 + buffer).then(() => {
           expect(vm.$el.children.length).toBe(0)
           expect(vm.$el.children.length).toBe(0)
           vm.ok = true
           vm.ok = true
         }).then(() => {
         }).then(() => {
           expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')
           expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')
         }).thenWaitFor(nextFrame).then(() => {
         }).thenWaitFor(nextFrame).then(() => {
           expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
           expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
-        }).thenWaitFor(enter2 - buffer).then(() => {
-          expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
-        }).thenWaitFor(buffer * 2).then(() => {
+        }).thenWaitFor(enter2 + buffer).then(() => {
           expect(vm.$el.children[0].className).toBe('test')
           expect(vm.$el.children[0].className).toBe('test')
         }).then(done)
         }).then(done)
       })
       })