@@ -24,6 +24,7 @@ describe("integration test", () => {
24
24
const leaveStyle : React . CSSProperties = { width : transit ( "50px" , 150 , "ease" , 25 ) } ;
25
25
const enterStyleProcessed : React . CSSProperties = { width : "100px" , transition : "width 150ms ease 25ms" } ;
26
26
const leaveStyleProcessed : React . CSSProperties = { width : "50px" , transition : "width 150ms ease 25ms" } ;
27
+ let onTransitionBegin : SinonSpy ;
27
28
let onTransitionComplete : SinonSpy ;
28
29
let getWrapper : ( props ?: CSSTransitionProps ) => ReactWrapper < any , { } > ;
29
30
let getWrapperAttached : ( props ?: CSSTransitionProps ) => ReactWrapper < any , { } > ;
@@ -59,8 +60,16 @@ describe("integration test", () => {
59
60
let target : ReactWrapper < any , { } > ;
60
61
61
62
before ( ( ) => {
63
+ onTransitionBegin = spy ( ) ;
62
64
onTransitionComplete = spy ( ) ;
63
- wrapper = getWrapperAttached ( { activeStyle, enterStyle, leaveStyle, defaultStyle, onTransitionComplete } ) ;
65
+ wrapper = getWrapperAttached ( {
66
+ activeStyle,
67
+ enterStyle,
68
+ leaveStyle,
69
+ defaultStyle,
70
+ onTransitionBegin,
71
+ onTransitionComplete,
72
+ } ) ;
64
73
target = wrapper . find ( "div" ) ;
65
74
} ) ;
66
75
@@ -88,6 +97,10 @@ describe("integration test", () => {
88
97
assert . deepEqual ( style , enterStyleProcessed ) ;
89
98
} ) ;
90
99
100
+ it ( "should call onTransitionBegin" , ( ) => {
101
+ assert . isTrue ( onTransitionBegin . calledOnce ) ;
102
+ } ) ;
103
+
91
104
describe ( "when transition starts" , ( ) => {
92
105
before ( ( done ) => {
93
106
setTimeout ( ( ) => {
@@ -117,6 +130,10 @@ describe("integration test", () => {
117
130
assert . deepEqual ( style , activeStyle ) ;
118
131
} ) ;
119
132
133
+ it ( "should have called onTransitionBegin only once" , ( ) => {
134
+ assert . isTrue ( onTransitionBegin . calledOnce ) ;
135
+ } ) ;
136
+
120
137
it ( "should call onTransitionComplete" , ( ) => {
121
138
assert . isTrue ( onTransitionComplete . calledOnce ) ;
122
139
} ) ;
@@ -129,9 +146,10 @@ describe("integration test", () => {
129
146
let target : ReactWrapper < any , { } > ;
130
147
131
148
before ( ( ) => {
149
+ onTransitionBegin = spy ( ) ;
132
150
onTransitionComplete = spy ( ) ;
133
151
wrapper = getWrapperAttached ( {
134
- activeStyle, enterStyle, leaveStyle, defaultStyle, onTransitionComplete,
152
+ activeStyle, enterStyle, leaveStyle, defaultStyle, onTransitionBegin , onTransitionComplete,
135
153
active : true ,
136
154
} ) ;
137
155
target = wrapper . find ( "div" ) ;
@@ -161,6 +179,10 @@ describe("integration test", () => {
161
179
assert . deepEqual ( style , leaveStyleProcessed ) ;
162
180
} ) ;
163
181
182
+ it ( "should call onTransitionBegin" , ( ) => {
183
+ assert . isTrue ( onTransitionBegin . calledOnce ) ;
184
+ } ) ;
185
+
164
186
describe ( "when transition starts" , ( ) => {
165
187
before ( ( done ) => {
166
188
setTimeout ( ( ) => {
@@ -190,6 +212,10 @@ describe("integration test", () => {
190
212
assert . deepEqual ( style , defaultStyle ) ;
191
213
} ) ;
192
214
215
+ it ( "should have called onTransitionBegin only once" , ( ) => {
216
+ assert . isTrue ( onTransitionBegin . calledOnce ) ;
217
+ } ) ;
218
+
193
219
it ( "should call onTransitionComplete" , ( ) => {
194
220
assert . isTrue ( onTransitionComplete . calledOnce ) ;
195
221
} ) ;
@@ -202,9 +228,11 @@ describe("integration test", () => {
202
228
let target : ReactWrapper < any , { } > ;
203
229
204
230
before ( ( ) => {
231
+ onTransitionBegin = spy ( ) ;
205
232
onTransitionComplete = spy ( ) ;
206
233
wrapper = getWrapperAttached ( {
207
234
activeStyle, enterStyle, leaveStyle, defaultStyle,
235
+ onTransitionBegin,
208
236
onTransitionComplete,
209
237
active : false ,
210
238
} ) ;
@@ -230,6 +258,10 @@ describe("integration test", () => {
230
258
assert . deepEqual ( style , enterStyleProcessed ) ;
231
259
} ) ;
232
260
261
+ it ( "should call onTransitionBegin" , ( ) => {
262
+ assert . isTrue ( onTransitionBegin . calledOnce ) ;
263
+ } ) ;
264
+
233
265
it ( "should not call onTransitionComplete yet" , ( ) => {
234
266
assert . isTrue ( onTransitionComplete . notCalled ) ;
235
267
} ) ;
@@ -244,6 +276,10 @@ describe("integration test", () => {
244
276
assert . deepEqual ( style , defaultStyle ) ;
245
277
} ) ;
246
278
279
+ it ( "should have called onTransitionBegin only once" , ( ) => {
280
+ assert . isTrue ( onTransitionBegin . calledOnce ) ;
281
+ } ) ;
282
+
247
283
it ( "should call onTransitionComplete" , ( ) => {
248
284
assert . isTrue ( onTransitionComplete . calledOnce ) ;
249
285
} ) ;
@@ -256,9 +292,11 @@ describe("integration test", () => {
256
292
let target : ReactWrapper < any , { } > ;
257
293
258
294
before ( ( ) => {
295
+ onTransitionBegin = spy ( ) ;
259
296
onTransitionComplete = spy ( ) ;
260
297
wrapper = getWrapperAttached ( {
261
298
activeStyle, enterStyle, leaveStyle, defaultStyle,
299
+ onTransitionBegin,
262
300
onTransitionComplete,
263
301
active : true ,
264
302
} ) ;
@@ -284,6 +322,10 @@ describe("integration test", () => {
284
322
assert . deepEqual ( style , leaveStyleProcessed ) ;
285
323
} ) ;
286
324
325
+ it ( "should call onTransitionBegin" , ( ) => {
326
+ assert . isTrue ( onTransitionBegin . calledOnce ) ;
327
+ } ) ;
328
+
287
329
it ( "should not call onTransitionComplete yet" , ( ) => {
288
330
assert . isTrue ( onTransitionComplete . notCalled ) ;
289
331
} ) ;
@@ -298,6 +340,10 @@ describe("integration test", () => {
298
340
assert . deepEqual ( style , activeStyle ) ;
299
341
} ) ;
300
342
343
+ it ( "should have called onTransitionBegin only once" , ( ) => {
344
+ assert . isTrue ( onTransitionBegin . calledOnce ) ;
345
+ } ) ;
346
+
301
347
it ( "should call onTransitionComplete" , ( ) => {
302
348
assert . isTrue ( onTransitionComplete . calledOnce ) ;
303
349
} ) ;
@@ -310,9 +356,11 @@ describe("integration test", () => {
310
356
let target : ReactWrapper < any , { } > ;
311
357
312
358
before ( ( ) => {
359
+ onTransitionBegin = spy ( ) ;
313
360
onTransitionComplete = spy ( ) ;
314
361
wrapper = getWrapperAttached ( {
315
362
activeStyle, enterStyle, leaveStyle, defaultStyle,
363
+ onTransitionBegin,
316
364
onTransitionComplete,
317
365
active : false ,
318
366
} ) ;
@@ -343,6 +391,10 @@ describe("integration test", () => {
343
391
assert . deepEqual ( style , enterStyleProcessed ) ;
344
392
} ) ;
345
393
394
+ it ( "should call onTransitionBegin" , ( ) => {
395
+ assert . isTrue ( onTransitionBegin . calledOnce ) ;
396
+ } ) ;
397
+
346
398
describe ( "when transition starts" , ( ) => {
347
399
before ( ( done ) => {
348
400
setTimeout ( ( ) => {
@@ -395,6 +447,10 @@ describe("integration test", () => {
395
447
assert . deepEqual ( style , defaultStyle ) ;
396
448
} ) ;
397
449
450
+ it ( "should have called onTransitionBegin only once" , ( ) => {
451
+ assert . isTrue ( onTransitionBegin . calledOnce ) ;
452
+ } ) ;
453
+
398
454
it ( "should call onTransitionComplete" , ( ) => {
399
455
assert . isTrue ( onTransitionComplete . calledOnce ) ;
400
456
} ) ;
@@ -408,9 +464,11 @@ describe("integration test", () => {
408
464
let target : ReactWrapper < any , { } > ;
409
465
410
466
before ( ( ) => {
467
+ onTransitionBegin = spy ( ) ;
411
468
onTransitionComplete = spy ( ) ;
412
469
wrapper = getWrapperAttached ( {
413
470
activeStyle, enterStyle, leaveStyle, defaultStyle,
471
+ onTransitionBegin,
414
472
onTransitionComplete,
415
473
active : true ,
416
474
} ) ;
@@ -441,6 +499,10 @@ describe("integration test", () => {
441
499
assert . deepEqual ( style , leaveStyleProcessed ) ;
442
500
} ) ;
443
501
502
+ it ( "should call onTransitionBegin" , ( ) => {
503
+ assert . isTrue ( onTransitionBegin . calledOnce ) ;
504
+ } ) ;
505
+
444
506
describe ( "when transition starts" , ( ) => {
445
507
before ( ( done ) => {
446
508
setTimeout ( ( ) => {
@@ -493,6 +555,10 @@ describe("integration test", () => {
493
555
assert . deepEqual ( style , activeStyle ) ;
494
556
} ) ;
495
557
558
+ it ( "should have called onTransitionBegin only once" , ( ) => {
559
+ assert . isTrue ( onTransitionBegin . calledOnce ) ;
560
+ } ) ;
561
+
496
562
it ( "should call onTransitionComplete" , ( ) => {
497
563
assert . isTrue ( onTransitionComplete . calledOnce ) ;
498
564
} ) ;
@@ -506,9 +572,11 @@ describe("integration test", () => {
506
572
let target : ReactWrapper < any , { } > ;
507
573
508
574
before ( ( ) => {
575
+ onTransitionBegin = spy ( ) ;
509
576
onTransitionComplete = spy ( ) ;
510
577
wrapper = getWrapperAttached ( {
511
578
activeStyle, enterStyle, leaveStyle, defaultStyle,
579
+ onTransitionBegin,
512
580
onTransitionComplete,
513
581
active : true ,
514
582
transitionAppear : true ,
@@ -544,6 +612,10 @@ describe("integration test", () => {
544
612
} , 100 ) ;
545
613
} ) ;
546
614
615
+ it ( "should call onTransitionBegin" , ( ) => {
616
+ assert . isTrue ( onTransitionBegin . calledOnce ) ;
617
+ } ) ;
618
+
547
619
it ( "should ignore" , ( ) => {
548
620
const style = target . props ( ) . style ;
549
621
assert . deepEqual ( style , enterStyleProcessed ) ;
@@ -566,6 +638,10 @@ describe("integration test", () => {
566
638
assert . deepEqual ( style , activeStyle ) ;
567
639
} ) ;
568
640
641
+ it ( "should have called onTransitionBegin only once" , ( ) => {
642
+ assert . isTrue ( onTransitionBegin . calledOnce ) ;
643
+ } ) ;
644
+
569
645
it ( "should call onTransitionComplete" , ( ) => {
570
646
assert . isTrue ( onTransitionComplete . calledOnce ) ;
571
647
} ) ;
@@ -578,9 +654,11 @@ describe("integration test", () => {
578
654
let target : ReactWrapper < any , { } > ;
579
655
580
656
before ( ( ) => {
657
+ onTransitionBegin = spy ( ) ;
581
658
onTransitionComplete = spy ( ) ;
582
659
wrapper = getWrapperAttached ( {
583
660
activeStyle, enterStyle, leaveStyle, defaultStyle,
661
+ onTransitionBegin,
584
662
onTransitionComplete,
585
663
active : true ,
586
664
transitionAppear : true ,
@@ -602,6 +680,10 @@ describe("integration test", () => {
602
680
assert . isTrue ( onTransitionComplete . notCalled ) ;
603
681
} ) ;
604
682
683
+ it ( "should call onTransitionBegin" , ( ) => {
684
+ assert . isTrue ( onTransitionBegin . calledOnce ) ;
685
+ } ) ;
686
+
605
687
describe ( "when transition was interrupted" , ( ) => {
606
688
before ( ( ) => {
607
689
wrapper . setProps ( { active : false } ) ;
@@ -620,6 +702,10 @@ describe("integration test", () => {
620
702
} , 100 ) ;
621
703
} ) ;
622
704
705
+ it ( "should have called onTransitionBegin only once" , ( ) => {
706
+ assert . isTrue ( onTransitionBegin . calledOnce ) ;
707
+ } ) ;
708
+
623
709
it ( "should call onTransitionComplete" , ( ) => {
624
710
assert . isTrue ( onTransitionComplete . calledOnce ) ;
625
711
} ) ;
0 commit comments