@@ -3518,6 +3518,33 @@ describe('CdkDrag', () => {
3518
3518
expect ( spy ) . toHaveBeenCalledWith ( dragItem , dropInstances [ 1 ] ) ;
3519
3519
} ) ) ;
3520
3520
3521
+ it ( 'should not call the `enterPredicate` if the pointer is not over the container' ,
3522
+ fakeAsync ( ( ) => {
3523
+ const fixture = createComponent ( ConnectedDropZones ) ;
3524
+ fixture . detectChanges ( ) ;
3525
+
3526
+ const dropInstances = fixture . componentInstance . dropInstances . toArray ( ) ;
3527
+ const spy = jasmine . createSpy ( 'enterPredicate spy' ) . and . returnValue ( true ) ;
3528
+ const groups = fixture . componentInstance . groupedDragItems . slice ( ) ;
3529
+ const dragElement = groups [ 0 ] [ 1 ] . element . nativeElement ;
3530
+ const targetRect = groups [ 1 ] [ 2 ] . element . nativeElement . getBoundingClientRect ( ) ;
3531
+
3532
+ dropInstances [ 1 ] . enterPredicate = spy ;
3533
+ fixture . detectChanges ( ) ;
3534
+
3535
+ startDraggingViaMouse ( fixture , dragElement ) ;
3536
+
3537
+ dispatchMouseEvent ( document , 'mousemove' , targetRect . left - 1 , targetRect . top - 1 ) ;
3538
+ fixture . detectChanges ( ) ;
3539
+
3540
+ expect ( spy ) . not . toHaveBeenCalled ( ) ;
3541
+
3542
+ dispatchMouseEvent ( document , 'mousemove' , targetRect . left + 1 , targetRect . top + 1 ) ;
3543
+ fixture . detectChanges ( ) ;
3544
+
3545
+ expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
3546
+ } ) ) ;
3547
+
3521
3548
it ( 'should be able to start dragging after an item has been transferred' , fakeAsync ( ( ) => {
3522
3549
const fixture = createComponent ( ConnectedDropZones ) ;
3523
3550
fixture . detectChanges ( ) ;
0 commit comments