@@ -318,7 +318,7 @@ describe('TouchHitTarget', () => {
318
318
319
319
const Test = ( ) => (
320
320
< EventComponent >
321
- < div >
321
+ < div style = { { position : 'relative' , zIndex : 0 } } >
322
322
{ cond ? null : (
323
323
< TouchHitTarget top = { 10 } left = { 10 } right = { 10 } bottom = { 10 } />
324
324
) }
@@ -330,22 +330,24 @@ describe('TouchHitTarget', () => {
330
330
ReactDOM . render ( < Test /> , container ) ;
331
331
expect ( Scheduler ) . toFlushWithoutYielding ( ) ;
332
332
expect ( container . innerHTML ) . toBe (
333
- '<div><div style="position: absolute; z-index: -1; bottom: -10px; ' +
333
+ '<div style="position: relative; z-index: 0;" ><div style="position: absolute; z-index: -1; bottom: -10px; ' +
334
334
'left: -10px; right: -10px; top: -10px;"></div></div>' ,
335
335
) ;
336
336
337
337
cond = true ;
338
338
ReactDOM . render ( < Test /> , container ) ;
339
339
expect ( Scheduler ) . toFlushWithoutYielding ( ) ;
340
- expect ( container . innerHTML ) . toBe ( '<div></div>' ) ;
340
+ expect ( container . innerHTML ) . toBe (
341
+ '<div style="position: relative; z-index: 0;"></div>' ,
342
+ ) ;
341
343
} ) ;
342
344
343
345
it ( 'should render a conditional TouchHitTarget correctly (true -> false)' , ( ) => {
344
346
let cond = true ;
345
347
346
348
const Test = ( ) => (
347
349
< EventComponent >
348
- < div >
350
+ < div style = { { position : 'relative' , zIndex : 0 } } >
349
351
{ cond ? null : (
350
352
< TouchHitTarget top = { 10 } left = { 10 } right = { 10 } bottom = { 10 } />
351
353
) }
@@ -356,13 +358,15 @@ describe('TouchHitTarget', () => {
356
358
const container = document . createElement ( 'div' ) ;
357
359
ReactDOM . render ( < Test /> , container ) ;
358
360
expect ( Scheduler ) . toFlushWithoutYielding ( ) ;
359
- expect ( container . innerHTML ) . toBe ( '<div></div>' ) ;
361
+ expect ( container . innerHTML ) . toBe (
362
+ '<div style="position: relative; z-index: 0;"></div>' ,
363
+ ) ;
360
364
361
365
cond = false ;
362
366
ReactDOM . render ( < Test /> , container ) ;
363
367
expect ( Scheduler ) . toFlushWithoutYielding ( ) ;
364
368
expect ( container . innerHTML ) . toBe (
365
- '<div><div style="position: absolute; z-index: -1; bottom: -10px; ' +
369
+ '<div style="position: relative; z-index: 0;" ><div style="position: absolute; z-index: -1; bottom: -10px; ' +
366
370
'left: -10px; right: -10px; top: -10px;"></div></div>' ,
367
371
) ;
368
372
} ) ;
@@ -372,7 +376,7 @@ describe('TouchHitTarget', () => {
372
376
373
377
const Test = ( ) => (
374
378
< EventComponent >
375
- < div >
379
+ < div style = { { position : 'relative' , zIndex : 0 } } >
376
380
{ cond ? (
377
381
< TouchHitTarget />
378
382
) : (
@@ -386,22 +390,24 @@ describe('TouchHitTarget', () => {
386
390
ReactDOM . render ( < Test /> , container ) ;
387
391
expect ( Scheduler ) . toFlushWithoutYielding ( ) ;
388
392
expect ( container . innerHTML ) . toBe (
389
- '<div><div style="position: absolute; z-index: -1; bottom: -10px; ' +
393
+ '<div style="position: relative; z-index: 0;" ><div style="position: absolute; z-index: -1; bottom: -10px; ' +
390
394
'left: -10px; right: -10px; top: -10px;"></div></div>' ,
391
395
) ;
392
396
393
397
cond = true ;
394
398
ReactDOM . render ( < Test /> , container ) ;
395
399
expect ( Scheduler ) . toFlushWithoutYielding ( ) ;
396
- expect ( container . innerHTML ) . toBe ( '<div></div>' ) ;
400
+ expect ( container . innerHTML ) . toBe (
401
+ '<div style="position: relative; z-index: 0;"></div>' ,
402
+ ) ;
397
403
} ) ;
398
404
399
405
it ( 'should render a conditional TouchHitTarget hit slop correctly (true -> false)' , ( ) => {
400
406
let cond = true ;
401
407
402
408
const Test = ( ) => (
403
409
< EventComponent >
404
- < div >
410
+ < div style = { { position : 'relative' , zIndex : 0 } } >
405
411
< span > Random span 1</ span >
406
412
{ cond ? (
407
413
< TouchHitTarget />
@@ -417,14 +423,15 @@ describe('TouchHitTarget', () => {
417
423
ReactDOM . render ( < Test /> , container ) ;
418
424
expect ( Scheduler ) . toFlushWithoutYielding ( ) ;
419
425
expect ( container . innerHTML ) . toBe (
420
- '<div><span>Random span 1</span><span>Random span 2</span></div>' ,
426
+ '<div style="position: relative; z-index: 0;" ><span>Random span 1</span><span>Random span 2</span></div>' ,
421
427
) ;
422
428
423
429
cond = false ;
424
430
ReactDOM . render ( < Test /> , container ) ;
425
431
expect ( Scheduler ) . toFlushWithoutYielding ( ) ;
426
432
expect ( container . innerHTML ) . toBe (
427
- '<div><span>Random span 1</span><div style="position: absolute; z-index: -1; bottom: -10px; ' +
433
+ '<div style="position: relative; z-index: 0;"><span>Random span 1</span>' +
434
+ '<div style="position: absolute; z-index: -1; bottom: -10px; ' +
428
435
'left: -10px; right: -10px; top: -10px;"></div><span>Random span 2</span></div>' ,
429
436
) ;
430
437
} ) ;
@@ -434,7 +441,7 @@ describe('TouchHitTarget', () => {
434
441
435
442
const Test = ( ) => (
436
443
< EventComponent >
437
- < div >
444
+ < div style = { { position : 'relative' , zIndex : 0 } } >
438
445
< span > Random span 1</ span >
439
446
{ cond ? (
440
447
< TouchHitTarget top = { 10 } left = { null } right = { 10 } bottom = { 10 } />
@@ -455,15 +462,17 @@ describe('TouchHitTarget', () => {
455
462
ReactDOM . render ( < Test /> , container ) ;
456
463
expect ( Scheduler ) . toFlushWithoutYielding ( ) ;
457
464
expect ( container . innerHTML ) . toBe (
458
- '<div><span>Random span 1</span><div style="position: absolute; z-index: -1; bottom: 0px; ' +
465
+ '<div style="position: relative; z-index: 0;"><span>Random span 1</span>' +
466
+ '<div style="position: absolute; z-index: -1; bottom: 0px; ' +
459
467
'left: -20px; right: 0px; top: 0px;"></div><span>Random span 2</span></div>' ,
460
468
) ;
461
469
462
470
cond = true ;
463
471
ReactDOM . render ( < Test /> , container ) ;
464
472
expect ( Scheduler ) . toFlushWithoutYielding ( ) ;
465
473
expect ( container . innerHTML ) . toBe (
466
- '<div><span>Random span 1</span><div style="position: absolute; z-index: -1; bottom: 0px; ' +
474
+ '<div style="position: relative; z-index: 0;"><span>Random span 1</span>' +
475
+ '<div style="position: absolute; z-index: -1; bottom: 0px; ' +
467
476
'left: -20px; right: 0px; top: 0px;"></div><span>Random span 2</span></div>' ,
468
477
) ;
469
478
} ) ;
@@ -473,7 +482,7 @@ describe('TouchHitTarget', () => {
473
482
474
483
const Test = ( ) => (
475
484
< EventComponent >
476
- < div >
485
+ < div style = { { position : 'relative' , zIndex : 0 } } >
477
486
< span > Random span 1</ span >
478
487
{ cond ? (
479
488
< TouchHitTarget top = { 10 } left = { null } right = { 10 } bottom = { 10 } />
@@ -494,30 +503,33 @@ describe('TouchHitTarget', () => {
494
503
ReactDOM . render ( < Test /> , container ) ;
495
504
expect ( Scheduler ) . toFlushWithoutYielding ( ) ;
496
505
expect ( container . innerHTML ) . toBe (
497
- '<div><span>Random span 1</span><div style="position: absolute; z-index: -1; bottom: -10px; ' +
506
+ '<div style="position: relative; z-index: 0;"><span>Random span 1</span>' +
507
+ '<div style="position: absolute; z-index: -1; bottom: -10px; ' +
498
508
'left: 0px; right: -10px; top: -10px;"></div><span>Random span 2</span></div>' ,
499
509
) ;
500
510
501
511
cond = false ;
502
512
ReactDOM . render ( < Test /> , container ) ;
503
513
expect ( Scheduler ) . toFlushWithoutYielding ( ) ;
504
514
expect ( container . innerHTML ) . toBe (
505
- '<div><span>Random span 1</span><div style="position: absolute; z-index: -1; bottom: -10px; ' +
515
+ '<div style="position: relative; z-index: 0;"><span>Random span 1</span>' +
516
+ '<div style="position: absolute; z-index: -1; bottom: -10px; ' +
506
517
'left: 0px; right: -10px; top: -10px;"></div><span>Random span 2</span></div>' ,
507
518
) ;
508
519
} ) ;
509
520
510
521
it ( 'should hydrate TouchHitTarget hit slop elements correcty and patch them' , ( ) => {
511
522
const Test = ( ) => (
512
523
< EventComponent >
513
- < div >
524
+ < div style = { { position : 'relative' , zIndex : 0 } } >
514
525
< TouchHitTarget top = { 10 } left = { 10 } right = { 10 } bottom = { 10 } />
515
526
</ div >
516
527
</ EventComponent >
517
528
) ;
518
529
519
530
const container = document . createElement ( 'div' ) ;
520
- container . innerHTML = '<div></div>' ;
531
+ container . innerHTML =
532
+ '<div style="position: relative; z-index: 0"></div>' ;
521
533
expect ( ( ) => {
522
534
ReactDOM . hydrate ( < Test /> , container ) ;
523
535
expect ( Scheduler ) . toFlushWithoutYielding ( ) ;
@@ -527,7 +539,7 @@ describe('TouchHitTarget', () => {
527
539
) ;
528
540
expect ( Scheduler ) . toFlushWithoutYielding ( ) ;
529
541
expect ( container . innerHTML ) . toBe (
530
- '<div><div style="position: absolute; z-index: -1; bottom: -10px; ' +
542
+ '<div style="position: relative; z-index: 0" ><div style="position: absolute; z-index: -1; bottom: -10px; ' +
531
543
'left: -10px; right: -10px; top: -10px;"></div></div>' ,
532
544
) ;
533
545
} ) ;
0 commit comments