@@ -435,7 +435,7 @@ describe('mouse events on slices', () => {
435
435
} )
436
436
} )
437
437
438
- describe ( 'touch events with useMesh' , ( ) => {
438
+ describe ( 'events with useMesh' , ( ) => {
439
439
const data = [
440
440
{
441
441
id : 'A' ,
@@ -457,13 +457,26 @@ describe('touch events with useMesh', () => {
457
457
enableTouchCrosshair : true ,
458
458
}
459
459
460
+ it ( 'should not throw onMouseEnter on empty data' , ( ) => {
461
+ const onMouseEnter = jest . fn ( )
462
+ const wrapper = mount ( < Line { ...baseProps } data = { [ ] } onMouseEnter = { onMouseEnter } /> )
463
+ expect ( ( ) =>
464
+ wrapper . find ( `[data-ref='mesh-interceptor']` ) . simulate ( 'mouseenter' , {
465
+ clientX : 50 ,
466
+ clientY : 50 ,
467
+ } )
468
+ ) . not . toThrow ( )
469
+ wrapper . unmount ( )
470
+ } )
471
+
460
472
it ( 'should call onTouchStart' , ( ) => {
461
473
const onTouchStart = jest . fn ( )
462
474
const wrapper = mount ( < Line { ...baseProps } onTouchStart = { onTouchStart } /> )
463
475
wrapper . find ( `[data-ref='mesh-interceptor']` ) . simulate ( 'touchstart' , {
464
476
touches : [ { clientX : 50 , clientY : 50 } ] ,
465
477
} )
466
478
expect ( onTouchStart ) . toHaveBeenCalledTimes ( 1 )
479
+ wrapper . unmount ( )
467
480
} )
468
481
469
482
it ( 'should call onTouchMove' , ( ) => {
@@ -473,6 +486,7 @@ describe('touch events with useMesh', () => {
473
486
touches : [ { clientX : 50 , clientY : 50 } ] ,
474
487
} )
475
488
expect ( onTouchMove ) . toHaveBeenCalledTimes ( 1 )
489
+ wrapper . unmount ( )
476
490
} )
477
491
478
492
it ( 'should call onTouchEnd' , ( ) => {
@@ -485,6 +499,7 @@ describe('touch events with useMesh', () => {
485
499
} )
486
500
. simulate ( 'touchend' )
487
501
expect ( onTouchEnd ) . toHaveBeenCalledTimes ( 1 )
502
+ wrapper . unmount ( )
488
503
} )
489
504
} )
490
505
0 commit comments