@@ -1392,6 +1392,21 @@ describe('CdkDrag', () => {
1392
1392
expect ( preview . getAttribute ( 'id' ) ) . toBeFalsy ( ) ;
1393
1393
} ) ) ;
1394
1394
1395
+ it ( 'should clear the ids from descendants of the preview' , fakeAsync ( ( ) => {
1396
+ const fixture = createComponent ( DraggableInDropZone ) ;
1397
+ fixture . detectChanges ( ) ;
1398
+ const item = fixture . componentInstance . dragItems . toArray ( ) [ 1 ] . element . nativeElement ;
1399
+ const extraChild = document . createElement ( 'div' ) ;
1400
+ extraChild . id = 'child-id' ;
1401
+ extraChild . classList . add ( 'preview-child' ) ;
1402
+ item . appendChild ( extraChild ) ;
1403
+
1404
+ startDraggingViaMouse ( fixture , item ) ;
1405
+
1406
+ expect ( document . querySelectorAll ( '.preview-child' ) . length ) . toBeGreaterThan ( 1 ) ;
1407
+ expect ( document . querySelectorAll ( '[id="child-id"]' ) . length ) . toBe ( 1 ) ;
1408
+ } ) ) ;
1409
+
1395
1410
it ( 'should not create a preview if the element was not dragged far enough' , fakeAsync ( ( ) => {
1396
1411
const fixture = createComponent ( DraggableInDropZone , [ ] , 5 ) ;
1397
1412
fixture . detectChanges ( ) ;
@@ -1597,6 +1612,21 @@ describe('CdkDrag', () => {
1597
1612
expect ( placeholder . getAttribute ( 'id' ) ) . toBeFalsy ( ) ;
1598
1613
} ) ) ;
1599
1614
1615
+ it ( 'should clear the ids from descendants of the placeholder' , fakeAsync ( ( ) => {
1616
+ const fixture = createComponent ( DraggableInDropZone ) ;
1617
+ fixture . detectChanges ( ) ;
1618
+ const item = fixture . componentInstance . dragItems . toArray ( ) [ 1 ] . element . nativeElement ;
1619
+ const extraChild = document . createElement ( 'div' ) ;
1620
+ extraChild . id = 'child-id' ;
1621
+ extraChild . classList . add ( 'placeholder-child' ) ;
1622
+ item . appendChild ( extraChild ) ;
1623
+
1624
+ startDraggingViaMouse ( fixture , item ) ;
1625
+
1626
+ expect ( document . querySelectorAll ( '.placeholder-child' ) . length ) . toBeGreaterThan ( 1 ) ;
1627
+ expect ( document . querySelectorAll ( '[id="child-id"]' ) . length ) . toBe ( 1 ) ;
1628
+ } ) ) ;
1629
+
1600
1630
it ( 'should not create placeholder if the element was not dragged far enough' , fakeAsync ( ( ) => {
1601
1631
const fixture = createComponent ( DraggableInDropZone , [ ] , 5 ) ;
1602
1632
fixture . detectChanges ( ) ;
0 commit comments