Skip to content

Commit 8d25e8f

Browse files
committed
make explicit transition duration tests more stable
1 parent 42492ff commit 8d25e8f

File tree

1 file changed

+12
-36
lines changed

1 file changed

+12
-36
lines changed

test/unit/features/transition/transition.spec.js

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -896,18 +896,14 @@ if (!isIE9) {
896896
expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
897897
}).thenWaitFor(nextFrame).then(() => {
898898
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
899-
}).thenWaitFor(explicitDuration - buffer).then(() => {
900-
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
901-
}).thenWaitFor(buffer * 2).then(() => {
899+
}).thenWaitFor(explicitDuration + buffer).then(() => {
902900
expect(vm.$el.children.length).toBe(0)
903901
vm.ok = true
904902
}).then(() => {
905903
expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')
906904
}).thenWaitFor(nextFrame).then(() => {
907905
expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
908-
}).thenWaitFor(explicitDuration - buffer).then(() => {
909-
expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
910-
}).thenWaitFor(buffer * 2).then(() => {
906+
}).thenWaitFor(explicitDuration + buffer).then(() => {
911907
expect(vm.$el.children[0].className).toBe('test')
912908
}).then(done)
913909
})
@@ -930,18 +926,14 @@ if (!isIE9) {
930926
expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
931927
}).thenWaitFor(nextFrame).then(() => {
932928
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
933-
}).thenWaitFor(duration - buffer).then(() => {
934-
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
935-
}).thenWaitFor(buffer * 2).then(() => {
929+
}).thenWaitFor(duration + buffer).then(() => {
936930
expect(vm.$el.children.length).toBe(0)
937931
vm.ok = true
938932
}).then(() => {
939933
expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')
940934
}).thenWaitFor(nextFrame).then(() => {
941935
expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
942-
}).thenWaitFor(explicitDuration - buffer).then(() => {
943-
expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
944-
}).thenWaitFor(buffer * 2).then(() => {
936+
}).thenWaitFor(explicitDuration + buffer).then(() => {
945937
expect(vm.$el.children[0].className).toBe('test')
946938
}).then(done)
947939
})
@@ -964,18 +956,14 @@ if (!isIE9) {
964956
expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
965957
}).thenWaitFor(nextFrame).then(() => {
966958
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
967-
}).thenWaitFor(explicitDuration - buffer).then(() => {
968-
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
969-
}).thenWaitFor(buffer * 2).then(() => {
959+
}).thenWaitFor(explicitDuration + buffer).then(() => {
970960
expect(vm.$el.children.length).toBe(0)
971961
vm.ok = true
972962
}).then(() => {
973963
expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')
974964
}).thenWaitFor(nextFrame).then(() => {
975965
expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
976-
}).thenWaitFor(duration - buffer).then(() => {
977-
expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
978-
}).thenWaitFor(buffer * 2).then(() => {
966+
}).thenWaitFor(duration + buffer).then(() => {
979967
expect(vm.$el.children[0].className).toBe('test')
980968
}).then(done)
981969
})
@@ -1001,18 +989,14 @@ if (!isIE9) {
1001989
expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
1002990
}).thenWaitFor(nextFrame).then(() => {
1003991
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
1004-
}).thenWaitFor(leave - buffer).then(() => {
1005-
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
1006-
}).thenWaitFor(buffer * 2).then(() => {
992+
}).thenWaitFor(leave + buffer).then(() => {
1007993
expect(vm.$el.children.length).toBe(0)
1008994
vm.ok = true
1009995
}).then(() => {
1010996
expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')
1011997
}).thenWaitFor(nextFrame).then(() => {
1012998
expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
1013-
}).thenWaitFor(enter - buffer).then(() => {
1014-
expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
1015-
}).thenWaitFor(buffer * 2).then(() => {
999+
}).thenWaitFor(enter + buffer).then(() => {
10161000
expect(vm.$el.children[0].className).toBe('test')
10171001
}).then(done)
10181002
})
@@ -1044,18 +1028,14 @@ if (!isIE9) {
10441028
expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
10451029
}).thenWaitFor(nextFrame).then(() => {
10461030
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
1047-
}).thenWaitFor(leave1 - buffer).then(() => {
1048-
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
1049-
}).thenWaitFor(buffer * 2).then(() => {
1031+
}).thenWaitFor(leave1 + buffer).then(() => {
10501032
expect(vm.$el.children.length).toBe(0)
10511033
vm.ok = true
10521034
}).then(() => {
10531035
expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')
10541036
}).thenWaitFor(nextFrame).then(() => {
10551037
expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
1056-
}).thenWaitFor(enter1 - buffer).then(() => {
1057-
expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
1058-
}).thenWaitFor(buffer * 2).then(() => {
1038+
}).thenWaitFor(enter1 + buffer).then(() => {
10591039
expect(vm.$el.children[0].className).toBe('test')
10601040
vm.enter = enter2
10611041
vm.leave = leave2
@@ -1065,18 +1045,14 @@ if (!isIE9) {
10651045
expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
10661046
}).thenWaitFor(nextFrame).then(() => {
10671047
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
1068-
}).thenWaitFor(leave2 - buffer).then(() => {
1069-
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
1070-
}).thenWaitFor(buffer * 2).then(() => {
1048+
}).thenWaitFor(leave2 + buffer).then(() => {
10711049
expect(vm.$el.children.length).toBe(0)
10721050
vm.ok = true
10731051
}).then(() => {
10741052
expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')
10751053
}).thenWaitFor(nextFrame).then(() => {
10761054
expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
1077-
}).thenWaitFor(enter2 - buffer).then(() => {
1078-
expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
1079-
}).thenWaitFor(buffer * 2).then(() => {
1055+
}).thenWaitFor(enter2 + buffer).then(() => {
10801056
expect(vm.$el.children[0].className).toBe('test')
10811057
}).then(done)
10821058
})

0 commit comments

Comments
 (0)