@@ -4352,6 +4352,29 @@ describe('CdkDrag', () => {
4352
4352
dispatchMouseEvent ( document , 'mouseup' ) ;
4353
4353
} ) ) ;
4354
4354
4355
+ it ( 'should not throw when entering from the top with an intermediate sibling present' ,
4356
+ fakeAsync ( ( ) => {
4357
+ const fixture = createComponent ( ConnectedDropZonesWithIntermediateSibling ) ;
4358
+
4359
+ // Make sure there's only one item in the first list.
4360
+ fixture . componentInstance . todo = [ 'things' ] ;
4361
+ fixture . detectChanges ( ) ;
4362
+
4363
+ const groups = fixture . componentInstance . groupedDragItems ;
4364
+ const dropZones = fixture . componentInstance . dropInstances . map ( d => d . element . nativeElement ) ;
4365
+ const item = groups [ 0 ] [ 0 ] ;
4366
+
4367
+ // Add some initial padding as the target drop zone
4368
+ dropZones [ 1 ] . style . paddingTop = '10px' ;
4369
+ const targetRect = dropZones [ 1 ] . getBoundingClientRect ( ) ;
4370
+
4371
+ expect ( ( ) => {
4372
+ dragElementViaMouse ( fixture , item . element . nativeElement , targetRect . left , targetRect . top ) ;
4373
+ flush ( ) ;
4374
+ fixture . detectChanges ( ) ;
4375
+ } ) . not . toThrow ( ) ;
4376
+ } ) ) ;
4377
+
4355
4378
it ( 'should assign a default id on each drop zone' , fakeAsync ( ( ) => {
4356
4379
const fixture = createComponent ( ConnectedDropZones ) ;
4357
4380
fixture . detectChanges ( ) ;
@@ -6072,6 +6095,46 @@ class DraggableInHorizontalFlexDropZoneWithMatchSizePreview {
6072
6095
}
6073
6096
6074
6097
6098
+ @Component ( {
6099
+ styles : CONNECTED_DROP_ZONES_STYLES ,
6100
+ template : `
6101
+ <div
6102
+ cdkDropList
6103
+ #todoZone="cdkDropList"
6104
+ [cdkDropListData]="todo"
6105
+ [cdkDropListConnectedTo]="[doneZone]"
6106
+ (cdkDropListDropped)="droppedSpy($event)"
6107
+ (cdkDropListEntered)="enteredSpy($event)">
6108
+ <div
6109
+ [cdkDragData]="item"
6110
+ (cdkDragEntered)="itemEnteredSpy($event)"
6111
+ *ngFor="let item of todo"
6112
+ cdkDrag>{{item}}</div>
6113
+ </div>
6114
+
6115
+ <div
6116
+ cdkDropList
6117
+ #doneZone="cdkDropList"
6118
+ [cdkDropListData]="done"
6119
+ [cdkDropListConnectedTo]="[todoZone]"
6120
+ (cdkDropListDropped)="droppedSpy($event)"
6121
+ (cdkDropListEntered)="enteredSpy($event)">
6122
+
6123
+ <div>Hello there</div>
6124
+ <div>
6125
+ <div
6126
+ [cdkDragData]="item"
6127
+ (cdkDragEntered)="itemEnteredSpy($event)"
6128
+ *ngFor="let item of done"
6129
+ cdkDrag>{{item}}</div>
6130
+ </div>
6131
+ </div>
6132
+ `
6133
+ } )
6134
+ class ConnectedDropZonesWithIntermediateSibling extends ConnectedDropZones {
6135
+ }
6136
+
6137
+
6075
6138
/**
6076
6139
* Drags an element to a position on the page using the mouse.
6077
6140
* @param fixture Fixture on which to run change detection.
0 commit comments