@@ -493,6 +493,7 @@ describe('CdkDrag', () => {
493493 expect ( dragElement . style . touchAction )
494494 . not . toEqual ( 'none' , 'should not disable touchAction on when there is a drag handle' ) ;
495495 } ) ;
496+
496497 it ( 'should be able to reset a freely-dragged item to its initial position' , fakeAsync ( ( ) => {
497498 const fixture = createComponent ( StandaloneDraggable ) ;
498499 fixture . detectChanges ( ) ;
@@ -1760,6 +1761,31 @@ describe('CdkDrag', () => {
17601761 . toEqual ( [ 'Zero' , 'One' , 'Two' , 'Three' ] ) ;
17611762 } ) ) ;
17621763
1764+ it ( 'should not move the item if the group is disabled' , fakeAsync ( ( ) => {
1765+ const fixture = createComponent ( ConnectedDropZonesViaGroupDirective ) ;
1766+ fixture . detectChanges ( ) ;
1767+ const dragItems = fixture . componentInstance . groupedDragItems [ 0 ] ;
1768+
1769+ fixture . componentInstance . groupDisabled = true ;
1770+ fixture . detectChanges ( ) ;
1771+
1772+ expect ( dragItems . map ( drag => drag . element . nativeElement . textContent ! . trim ( ) ) )
1773+ . toEqual ( [ 'Zero' , 'One' , 'Two' , 'Three' ] ) ;
1774+
1775+ const firstItem = dragItems [ 0 ] ;
1776+ const thirdItemRect = dragItems [ 2 ] . element . nativeElement . getBoundingClientRect ( ) ;
1777+
1778+ dragElementViaMouse ( fixture , firstItem . element . nativeElement ,
1779+ thirdItemRect . right + 1 , thirdItemRect . top + 1 ) ;
1780+ flush ( ) ;
1781+ fixture . detectChanges ( ) ;
1782+
1783+ expect ( fixture . componentInstance . droppedSpy ) . not . toHaveBeenCalled ( ) ;
1784+
1785+ expect ( dragItems . map ( drag => drag . element . nativeElement . textContent ! . trim ( ) ) )
1786+ . toEqual ( [ 'Zero' , 'One' , 'Two' , 'Three' ] ) ;
1787+ } ) ) ;
1788+
17631789 } ) ;
17641790
17651791 describe ( 'in a connected drop container' , ( ) => {
@@ -2501,7 +2527,7 @@ class ConnectedDropZones implements AfterViewInit {
25012527 }
25022528 ` ] ,
25032529 template : `
2504- <div cdkDropListGroup>
2530+ <div cdkDropListGroup [cdkDropListGroupDisabled]="groupDisabled" >
25052531 <div
25062532 cdkDropList
25072533 [cdkDropListData]="todo"
@@ -2518,7 +2544,9 @@ class ConnectedDropZones implements AfterViewInit {
25182544 </div>
25192545 `
25202546} )
2521- class ConnectedDropZonesViaGroupDirective extends ConnectedDropZones { }
2547+ class ConnectedDropZonesViaGroupDirective extends ConnectedDropZones {
2548+ groupDisabled = false ;
2549+ }
25222550
25232551
25242552@Component ( {
0 commit comments