File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
test/unit/features/transition Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -598,5 +598,39 @@ if (!isIE9) {
598
598
expect ( vm . $el . children [ 0 ] . className ) . toBe ( 'test' )
599
599
} ) . then ( done )
600
600
} )
601
+
602
+ it ( 'custom transition higher-order component' , done => {
603
+ const vm = new Vue ( {
604
+ template : '<div><my-transition><div v-if="ok" class="test">foo</div></my-transition></div>' ,
605
+ data : { ok : true } ,
606
+ components : {
607
+ 'my-transition' : {
608
+ functional : true ,
609
+ render ( h , { data, children } ) {
610
+ ( data . props || ( data . props = { } ) ) . name = 'test'
611
+ return h ( 'transition' , data , children )
612
+ }
613
+ }
614
+ }
615
+ } ) . $mount ( el )
616
+
617
+ // should not apply transition on initial render by default
618
+ expect ( vm . $el . innerHTML ) . toBe ( '<div class="test">foo</div>' )
619
+ vm . ok = false
620
+ waitForUpdate ( ( ) => {
621
+ expect ( vm . $el . children [ 0 ] . className ) . toBe ( 'test test-leave test-leave-active' )
622
+ } ) . thenWaitFor ( nextFrame ) . then ( ( ) => {
623
+ expect ( vm . $el . children [ 0 ] . className ) . toBe ( 'test test-leave-active' )
624
+ } ) . thenWaitFor ( duration + 10 ) . then ( ( ) => {
625
+ expect ( vm . $el . children . length ) . toBe ( 0 )
626
+ vm . ok = true
627
+ } ) . then ( ( ) => {
628
+ expect ( vm . $el . children [ 0 ] . className ) . toBe ( 'test test-enter test-enter-active' )
629
+ } ) . thenWaitFor ( nextFrame ) . then ( ( ) => {
630
+ expect ( vm . $el . children [ 0 ] . className ) . toBe ( 'test test-enter-active' )
631
+ } ) . thenWaitFor ( duration + 10 ) . then ( ( ) => {
632
+ expect ( vm . $el . children [ 0 ] . className ) . toBe ( 'test' )
633
+ } ) . then ( done )
634
+ } )
601
635
} )
602
636
}
You can’t perform that action at this time.
0 commit comments