File tree 1 file changed +44
-0
lines changed
test/unit/features/transition 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -612,6 +612,50 @@ if (!isIE9) {
612
612
} ) . then ( done )
613
613
} )
614
614
615
+ it ( 'leave transition with v-show: cancelled on next frame' , done => {
616
+ const vm = new Vue ( {
617
+ template : `
618
+ <div>
619
+ <transition name="test">
620
+ <div v-show="ok" class="test">foo</div>
621
+ </transition>
622
+ </div>
623
+ ` ,
624
+ data : { ok : true }
625
+ } ) . $mount ( el )
626
+
627
+ vm . ok = false
628
+ waitForUpdate ( ( ) => {
629
+ vm . ok = true
630
+ } ) . thenWaitFor ( nextFrame ) . then ( ( ) => {
631
+ expect ( vm . $el . children [ 0 ] . className ) . toBe ( 'test test-enter-active test-enter-to' )
632
+ } ) . thenWaitFor ( duration + buffer ) . then ( ( ) => {
633
+ expect ( vm . $el . children [ 0 ] . className ) . toBe ( 'test' )
634
+ } ) . then ( done )
635
+ } )
636
+
637
+ it ( 'enter transition with v-show: cancelled on next frame' , done => {
638
+ const vm = new Vue ( {
639
+ template : `
640
+ <div>
641
+ <transition name="test">
642
+ <div v-show="ok" class="test">foo</div>
643
+ </transition>
644
+ </div>
645
+ ` ,
646
+ data : { ok : false }
647
+ } ) . $mount ( el )
648
+
649
+ vm . ok = true
650
+ waitForUpdate ( ( ) => {
651
+ vm . ok = false
652
+ } ) . thenWaitFor ( nextFrame ) . then ( ( ) => {
653
+ expect ( vm . $el . children [ 0 ] . className ) . toBe ( 'test test-leave-active test-leave-to' )
654
+ } ) . thenWaitFor ( duration + buffer ) . then ( ( ) => {
655
+ expect ( vm . $el . children [ 0 ] . className ) . toBe ( 'test' )
656
+ } ) . then ( done )
657
+ } )
658
+
615
659
it ( 'animations' , done => {
616
660
const vm = new Vue ( {
617
661
template : `
You can’t perform that action at this time.
0 commit comments