@@ -41,44 +41,46 @@ describe('transition', () => {
4141 const [ transitionDom ] = transitionComp . dom . children ;
4242
4343 // enter
44- transitionComp . setData ( { visible : true } ) ;
45- expect ( transitionDom . style . display ) . toEqual ( '' ) ;
46- expect ( transitionDom . className . match ( / f a d e - e n t e r \s / ) ) . toBeTruthy ( ) ;
47- expect ( transitionDom . className . match ( / f a d e - e n t e r - a c t i v e / ) ) . toBeTruthy ( ) ;
48-
49- // enter to
50- jest . runAllTimers ( ) ;
51- expect ( transitionDom . className . match ( / f a d e - e n t e r - t o / ) ) . toBeTruthy ( ) ;
52-
53- // enter finished
54- transitionComp . instance . onTransitionEnd ( ) ;
55- expect ( transitionDom . className . match ( / f a d e - ( e n t e r | e n t e r - t o | e n t e r - a c t i v e ) / ) ) . toBeFalsy ( ) ;
56-
57- // leave
58- transitionComp . setData ( { visible : false } ) ;
59- expect ( transitionDom . className . match ( / l e a v e \s / ) ) . toBeTruthy ( ) ;
60- expect ( transitionDom . className . match ( / l e a v e - a c t i v e / ) ) . toBeTruthy ( ) ;
61-
62- // leave to
63- jest . runAllTimers ( ) ;
64- expect ( transitionDom . className . match ( / l e a v e - t o / ) ) . toBeTruthy ( ) ;
65-
66- // leave finished
67- transitionComp . instance . onTransitionEnd ( ) ;
68- expect ( transitionDom . style . display ) . toEqual ( 'none' ) ;
69- expect ( transitionDom . className . match ( / ( l e a v e | l e a v e - t o | l e a v e - a c t i v e ) / ) ) . toBeFalsy ( ) ;
44+ transitionComp . setData ( { visible : true } , ( ) => {
45+ expect ( transitionDom . style . display ) . toEqual ( '' ) ;
46+ expect ( transitionDom . className . match ( / f a d e - e n t e r \s / ) ) . toBeTruthy ( ) ;
47+ expect ( transitionDom . className . match ( / f a d e - e n t e r - a c t i v e / ) ) . toBeTruthy ( ) ;
48+
49+ // enter to
50+ jest . runAllTimers ( ) ;
51+ expect ( transitionDom . className . match ( / f a d e - e n t e r - t o / ) ) . toBeTruthy ( ) ;
52+
53+ // enter finished
54+ transitionComp . instance . onTransitionEnd ( ) ;
55+ expect ( transitionDom . className . match ( / f a d e - ( e n t e r | e n t e r - t o | e n t e r - a c t i v e ) / ) ) . toBeFalsy ( ) ;
56+
57+ // leave
58+ transitionComp . setData ( { visible : false } ) ;
59+ expect ( transitionDom . className . match ( / l e a v e \s / ) ) . toBeTruthy ( ) ;
60+ expect ( transitionDom . className . match ( / l e a v e - a c t i v e / ) ) . toBeTruthy ( ) ;
61+
62+ // leave to
63+ jest . runAllTimers ( ) ;
64+ expect ( transitionDom . className . match ( / l e a v e - t o / ) ) . toBeTruthy ( ) ;
65+
66+ // leave finished
67+ transitionComp . instance . onTransitionEnd ( ) ;
68+ expect ( transitionDom . style . display ) . toEqual ( 'none' ) ;
69+ expect ( transitionDom . className . match ( / ( l e a v e | l e a v e - t o | l e a v e - a c t i v e ) / ) ) . toBeFalsy ( ) ;
70+ } ) ;
7071 } ) ;
7172
7273 it ( ':name' , ( ) => {
7374 const transitionComp = simulate . render ( transitionId , { name : 'foo' } ) ;
7475 transitionComp . attach ( document . createElement ( 'parent-wrapper' ) ) ;
7576 const [ transitionDom ] = transitionComp . dom . children ;
7677
77- transitionComp . setData ( { visible : true } ) ;
78- jest . runAllTimers ( ) ;
79- expect ( transitionDom . className . match ( / f o o - e n t e r / ) ) . toBeTruthy ( ) ;
80- expect ( transitionDom . className . match ( / f o o - e n t e r - a c t i v e / ) ) . toBeTruthy ( ) ;
81- expect ( transitionDom . className . match ( / f o o - e n t e r - t o / ) ) . toBeTruthy ( ) ;
78+ transitionComp . setData ( { visible : true } , ( ) => {
79+ jest . runAllTimers ( ) ;
80+ expect ( transitionDom . className . match ( / f o o - e n t e r / ) ) . toBeTruthy ( ) ;
81+ expect ( transitionDom . className . match ( / f o o - e n t e r - a c t i v e / ) ) . toBeTruthy ( ) ;
82+ expect ( transitionDom . className . match ( / f o o - e n t e r - t o / ) ) . toBeTruthy ( ) ;
83+ } ) ;
8284 } ) ;
8385
8486 // it(':destroyOnHide', () => {
@@ -93,13 +95,14 @@ describe('transition', () => {
9395 // });
9496
9597 it ( ':appear' , ( ) => {
96- const transitionComp = simulate . render ( transitionId , { visible : true , appear : true } ) ;
97- transitionComp . attach ( document . createElement ( 'parent-wrapper' ) ) ;
98- const [ transitionDom ] = transitionComp . dom . children ;
99- expect ( transitionDom . className . match ( / e n t e r \s / ) ) . toBeTruthy ( ) ;
100- expect ( transitionDom . className . match ( / e n t e r - a c t i v e / ) ) . toBeTruthy ( ) ;
101- jest . runAllTimers ( ) ;
102- expect ( transitionDom . className . match ( / e n t e r - t o / ) ) . toBeTruthy ( ) ;
98+ const transitionComp = simulate . render ( transitionId , { visible : true , appear : true } , ( ) => {
99+ transitionComp . attach ( document . createElement ( 'parent-wrapper' ) ) ;
100+ const [ transitionDom ] = transitionComp . dom . children ;
101+ expect ( transitionDom . className . match ( / e n t e r \s / ) ) . toBeTruthy ( ) ;
102+ expect ( transitionDom . className . match ( / e n t e r - a c t i v e / ) ) . toBeTruthy ( ) ;
103+ jest . runAllTimers ( ) ;
104+ expect ( transitionDom . className . match ( / e n t e r - t o / ) ) . toBeTruthy ( ) ;
105+ } ) ;
103106 } ) ;
104107
105108 it ( ':durations' , ( ) => {
0 commit comments