Skip to content

Commit

Permalink
fix(drag-drop): disabled value not being synced to drop list ref (#15065
Browse files Browse the repository at this point in the history
)

Fixes the input value from the `CdkDropList` directive not being synced to the `DropListRef`.
  • Loading branch information
crisbeto authored and jelbourn committed Feb 22, 2019
1 parent 629460f commit 1aafdbe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/cdk/drag-drop/directives/drag.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,25 @@ describe('CdkDrag', () => {
expect(fixture.componentInstance.dropInstance.data).toBe(fixture.componentInstance.items);
});

it('should sync the drop list inputs with the drop list ref', () => {
const fixture = createComponent(DraggableInDropZone);
fixture.detectChanges();

const dropInstance = fixture.componentInstance.dropInstance;
const dropListRef = dropInstance._dropListRef;

expect(dropListRef.lockAxis).toBeFalsy();
expect(dropListRef.disabled).toBe(false);

dropInstance.lockAxis = 'x';
dropInstance.disabled = true;

dropListRef.beforeStarted.next();

expect(dropListRef.lockAxis).toBe('x');
expect(dropListRef.disabled).toBe(true);
});

it('should be able to attach data to a drag item', () => {
const fixture = createComponent(DraggableInDropZone);
fixture.detectChanges();
Expand Down
1 change: 1 addition & 0 deletions src/cdk/drag-drop/directives/drop-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ export class CdkDropList<T = any> implements CdkDropListContainer, AfterContentI
});
}

ref.disabled = this.disabled;
ref.lockAxis = this.lockAxis;
ref.sortingDisabled = this.sortingDisabled;
ref
Expand Down

0 comments on commit 1aafdbe

Please sign in to comment.