Skip to content

fix(drag-drop): disabled value not being synced to drop list ref #15065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -839,6 +839,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 @@ -306,6 +306,7 @@ export class CdkDropList<T = any> implements CdkDropListContainer, AfterContentI
});
}

ref.disabled = this.disabled;
ref.lockAxis = this.lockAxis;
ref
.connectedTo(siblings.filter(drop => drop && drop !== this).map(list => list._dropListRef))
Expand Down