@@ -28,7 +28,7 @@ import {_supportsShadowDom} from '@angular/cdk/platform';
2828import { of as observableOf } from 'rxjs' ;
2929
3030import { DragDropModule } from '../drag-drop-module' ;
31- import { CdkDragDrop , CdkDragEnter } from '../drag-events' ;
31+ import { CdkDragDrop , CdkDragEnter , CdkDragStart } from '../drag-events' ;
3232import { Point , DragRef } from '../drag-ref' ;
3333import { extendStyles } from '../drag-styling' ;
3434import { moveItemInArray } from '../drag-utils' ;
@@ -4022,6 +4022,20 @@ describe('CdkDrag', () => {
40224022 expect ( fixture . componentInstance . droppedSpy ) . toHaveBeenCalledTimes ( 1 ) ;
40234023 } ) ) ;
40244024
4025+ it ( 'should make the placeholder available in the start event' , fakeAsync ( ( ) => {
4026+ const fixture = createComponent ( DraggableInDropZone ) ;
4027+ fixture . detectChanges ( ) ;
4028+ const item = fixture . componentInstance . dragItems . toArray ( ) [ 1 ] . element . nativeElement ;
4029+ let placeholder : HTMLElement | undefined ;
4030+
4031+ fixture . componentInstance . startedSpy . and . callFake ( ( event : CdkDragStart ) => {
4032+ placeholder = event . source . getPlaceholderElement ( ) ;
4033+ } ) ;
4034+
4035+ startDraggingViaMouse ( fixture , item ) ;
4036+ expect ( placeholder ) . toBeTruthy ( ) ;
4037+ } ) ) ;
4038+
40254039 } ) ;
40264040
40274041 describe ( 'in a connected drop container' , ( ) => {
@@ -5409,6 +5423,7 @@ const DROP_ZONE_FIXTURE_TEMPLATE = `
54095423 [cdkDragPreviewClass]="previewClass"
54105424 [style.height.px]="item.height"
54115425 [style.margin-bottom.px]="item.margin"
5426+ (cdkDragStarted)="startedSpy($event)"
54125427 style="width: 100%; background: red;">{{item.value}}</div>
54135428 </div>
54145429` ;
@@ -5430,6 +5445,7 @@ class DraggableInDropZone {
54305445 droppedSpy = jasmine . createSpy ( 'dropped spy' ) . and . callFake ( ( event : CdkDragDrop < string [ ] > ) => {
54315446 moveItemInArray ( this . items , event . previousIndex , event . currentIndex ) ;
54325447 } ) ;
5448+ startedSpy = jasmine . createSpy ( 'started spy' ) ;
54335449}
54345450
54355451@Component ( {
0 commit comments