@@ -636,6 +636,19 @@ describe('CdkDrag', () => {
636636 expect ( dragElement . style . transform ) . toBeFalsy ( ) ;
637637 } ) ) ;
638638
639+ it ( 'should be able to set an alternate drag root element for ng-container' , fakeAsync ( ( ) => {
640+ const fixture = createComponent ( DraggableNgContainerWithAlternateRoot ) ;
641+ fixture . detectChanges ( ) ;
642+
643+ const dragRoot = fixture . componentInstance . dragRoot . nativeElement ;
644+
645+ expect ( dragRoot . style . transform ) . toBeFalsy ( ) ;
646+
647+ dragElementViaMouse ( fixture , dragRoot , 50 , 100 ) ;
648+
649+ expect ( dragRoot . style . transform ) . toBe ( 'translate3d(50px, 100px, 0px)' ) ;
650+ } ) ) ;
651+
639652 it ( 'should preserve the initial transform if the root element changes' , fakeAsync ( ( ) => {
640653 const fixture = createComponent ( DraggableWithAlternateRoot ) ;
641654 fixture . detectChanges ( ) ;
@@ -7150,6 +7163,21 @@ class DraggableWithRadioInputsInDropZone {
71507163 ] ;
71517164}
71527165
7166+
7167+ @Component ( {
7168+ template : `
7169+ <div #dragRoot class="alternate-root" style="width: 200px; height: 200px; background: hotpink">
7170+ <ng-container cdkDrag cdkDragRootElement=".alternate-root">
7171+ <div style="width: 100px; height: 100px; background: red;"></div>
7172+ </ng-container>
7173+ </div>
7174+ `
7175+ } )
7176+ class DraggableNgContainerWithAlternateRoot {
7177+ @ViewChild ( 'dragRoot' ) dragRoot : ElementRef < HTMLElement > ;
7178+ @ViewChild ( CdkDrag ) dragInstance : CdkDrag ;
7179+ }
7180+
71537181/**
71547182 * Drags an element to a position on the page using the mouse.
71557183 * @param fixture Fixture on which to run change detection.
0 commit comments