@@ -60,9 +60,11 @@ describe('ReactCursorPosition', () => {
60
60
61
61
it ( 'decorates child components with props in the touch environment' , ( ) => {
62
62
const mountedTree = getMountedComponentTree ( { isActivatedOnTouch : true } ) ;
63
+ const instance = mountedTree . instance ( ) ;
63
64
64
- mountedTree . instance ( ) . onTouchStart ( getTouchEvent ( { pageX : 1 , pageY : 2 } ) ) ;
65
- mountedTree . instance ( ) . onTouchMove ( getTouchEvent ( { pageX : 3 , pageY : 2 } ) ) ;
65
+ instance . componentDidMount ( ) ;
66
+ instance . onTouchStart ( getTouchEvent ( { pageX : 1 , pageY : 2 } ) ) ;
67
+ instance . onTouchMove ( getTouchEvent ( { pageX : 3 , pageY : 2 } ) ) ;
66
68
mountedTree . update ( ) ;
67
69
68
70
const childComponent = mountedTree . find ( GenericSpanComponent ) ;
@@ -86,7 +88,9 @@ describe('ReactCursorPosition', () => {
86
88
87
89
it ( 'decorates child components with props in the mouse environment' , ( done ) => {
88
90
const mountedTree = getMountedComponentTree ( ) ;
89
- mountedTree . instance ( ) . onMouseEnter ( getMouseEvent ( ) ) ;
91
+ const instance = mountedTree . instance ( ) ;
92
+ instance . componentDidMount ( ) ;
93
+ instance . onMouseEnter ( getMouseEvent ( ) ) ;
90
94
91
95
defer ( ( ) => {
92
96
mountedTree . update ( ) ;
@@ -138,6 +142,7 @@ describe('ReactCursorPosition', () => {
138
142
const positionObserver = getMountedComponentTree ( ) ;
139
143
const instance = positionObserver . instance ( ) ;
140
144
sinon . spy ( instance , 'init' ) ;
145
+ instance . componentDidMount ( ) ;
141
146
instance . onTouchStart ( touchEvent ) ;
142
147
143
148
instance . onMouseEnter ( mouseEvent ) ;
@@ -233,6 +238,7 @@ describe('ReactCursorPosition', () => {
233
238
const renderedTree = getMountedComponentTree ( { isActivatedOnTouch : true } ) ;
234
239
const instance = renderedTree . instance ( ) ;
235
240
241
+ instance . componentDidMount ( ) ;
236
242
instance . onTouchStart ( touchEvent ) ;
237
243
renderedTree . update ( ) ;
238
244
@@ -247,8 +253,10 @@ describe('ReactCursorPosition', () => {
247
253
describe ( 'Mouse Environment' , ( ) => {
248
254
it ( 'decorates child components with element dimensions' , ( ) => {
249
255
const renderedTree = getMountedComponentTree ( ) ;
256
+ const instance = renderedTree . instance ( ) ;
250
257
251
- renderedTree . instance ( ) . onMouseEnter ( getTouchEvent ( ) ) ;
258
+ instance . componentDidMount ( ) ;
259
+ instance . onMouseEnter ( getTouchEvent ( ) ) ;
252
260
renderedTree . update ( ) ;
253
261
254
262
const childComponent = renderedTree . find ( GenericSpanComponent ) ;
@@ -366,6 +374,7 @@ describe('ReactCursorPosition', () => {
366
374
367
375
expect ( childComponent . props ( ) . isPositionOutside ) . to . be . true ;
368
376
377
+ instance . componentDidMount ( ) ;
369
378
instance . onTouchStart ( touchEvent ) ;
370
379
renderedTree . update ( ) ;
371
380
@@ -400,6 +409,7 @@ describe('ReactCursorPosition', () => {
400
409
} ) ;
401
410
const instance = renderedTree . instance ( ) ;
402
411
412
+ instance . componentDidMount ( ) ;
403
413
instance . onMouseEnter ( mouseEvent ) ;
404
414
instance . onMouseMove ( getMouseEvent ( {
405
415
pageX : 1 ,
@@ -439,6 +449,7 @@ describe('ReactCursorPosition', () => {
439
449
} ) ;
440
450
const instance = renderedTree . instance ( ) ;
441
451
452
+ instance . componentDidMount ( ) ;
442
453
instance . onMouseEnter ( mouseEvent ) ;
443
454
instance . onMouseMove ( getMouseEvent ( {
444
455
pageX : 5 ,
@@ -582,9 +593,11 @@ describe('ReactCursorPosition', () => {
582
593
mapChildProps,
583
594
isActivatedOnTouch : true
584
595
} ) ;
596
+ const instance = tree . instance ( ) ;
585
597
586
- tree . instance ( ) . onTouchStart ( touchEvent ) ;
587
- tree . instance ( ) . onTouchMove ( touchEvent ) ;
598
+ instance . componentDidMount ( ) ;
599
+ instance . onTouchStart ( touchEvent ) ;
600
+ instance . onTouchMove ( touchEvent ) ;
588
601
tree . update ( ) ;
589
602
590
603
const childComponent = tree . find ( GenericSpanComponent ) ;
@@ -608,9 +621,11 @@ describe('ReactCursorPosition', () => {
608
621
isActivatedOnTouch : true ,
609
622
onPositionChanged : spy
610
623
} ) ;
611
- tree . instance ( ) . onTouchStart ( touchEvent ) ;
624
+ const instance = tree . instance ( ) ;
612
625
613
- tree . instance ( ) . onTouchMove ( getTouchEvent ( { pageX : 2 , pageY : 3 } ) ) ;
626
+ instance . componentDidMount ( ) ;
627
+ instance . onTouchStart ( touchEvent ) ;
628
+ instance . onTouchMove ( getTouchEvent ( { pageX : 2 , pageY : 3 } ) ) ;
614
629
615
630
expect ( spy . args [ 1 ] [ 0 ] ) . to . deep . equal ( {
616
631
detectedEnvironment : {
0 commit comments