From 1a8106de24bb50ddb6b8c9a77ced7f28a4e3aca4 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Tue, 13 Mar 2018 12:01:35 -0400 Subject: [PATCH] refactor(chips): remove 6.0.0 deletion targets (#10311) Removes the deletion targets for 6.0.0 in the `material/chips` entry point. BREAKING CHANGES: * `remove` which was deprecated in 5.0.0 has been removed. Use `removed` instead. * `destroy` which was deprecated in 5.0.0 has been removed. Use `destroyed` instead. --- src/demo-app/a11y/chips/chips-a11y.html | 2 +- src/demo-app/chips/chips-demo.html | 12 ++++++------ src/lib/chips/chip-list.ts | 2 +- src/lib/chips/chip-remove.spec.ts | 4 ++-- src/lib/chips/chip.spec.ts | 8 ++++---- src/lib/chips/chip.ts | 16 +--------------- .../chips-input/chips-input-example.html | 2 +- 7 files changed, 16 insertions(+), 30 deletions(-) diff --git a/src/demo-app/a11y/chips/chips-a11y.html b/src/demo-app/a11y/chips/chips-a11y.html index 481039952be..14eb3599ec3 100644 --- a/src/demo-app/a11y/chips/chips-a11y.html +++ b/src/demo-app/a11y/chips/chips-a11y.html @@ -23,7 +23,7 @@ - + {{person.name}} cancel diff --git a/src/demo-app/chips/chips-demo.html b/src/demo-app/chips/chips-demo.html index 692d23e40da..c7f6d84083e 100644 --- a/src/demo-app/chips/chips-demo.html +++ b/src/demo-app/chips/chips-demo.html @@ -25,7 +25,7 @@ Selected/Colored + (destroyed)="displayMessage('chip destroyed')" (removed)="toggleVisible()"> With Events cancel @@ -101,7 +101,7 @@ + [removable]="removable" (removed)="remove(person)"> {{person.name}} cancel @@ -123,7 +123,7 @@ + [removable]="removable" (removed)="remove(person)"> {{person.name}} cancel @@ -143,7 +143,7 @@ + [removable]="removable" (removed)="remove(person)"> {{person.name}} cancel @@ -180,7 +180,7 @@

NgModel with chip list

+ [value]="aColor.name" (removed)="removeColor(aColor)"> {{aColor.name}} cancel @@ -191,7 +191,7 @@

NgModel with single selection chip list

+ [value]="aColor.name" (removed)="removeColor(aColor)"> {{aColor.name}} cancel diff --git a/src/lib/chips/chip-list.ts b/src/lib/chips/chip-list.ts index db465395c1c..c48e3a2a12e 100644 --- a/src/lib/chips/chip-list.ts +++ b/src/lib/chips/chip-list.ts @@ -306,7 +306,7 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo /** Combined stream of all of the child chips' remove change events. */ get chipRemoveChanges(): Observable { - return merge(...this.chips.map(chip => chip.destroy)); + return merge(...this.chips.map(chip => chip.destroyed)); } /** Event emitted when the selected chip list value has been changed by the user. */ diff --git a/src/lib/chips/chip-remove.spec.ts b/src/lib/chips/chip-remove.spec.ts index b8fabef214d..e9294176b28 100644 --- a/src/lib/chips/chip-remove.spec.ts +++ b/src/lib/chips/chip-remove.spec.ts @@ -36,7 +36,7 @@ describe('Chip Remove', () => { expect(hrefElement.classList).toContain('mat-chip-remove'); }); - it('should emits (remove) on click', () => { + it('should emits (removed) on click', () => { let hrefElement = chipNativeElement.querySelector('a')!; testChip.removable = true; @@ -53,7 +53,7 @@ describe('Chip Remove', () => { @Component({ template: ` - + ` }) class TestChip { diff --git a/src/lib/chips/chip.spec.ts b/src/lib/chips/chip.spec.ts index f45b37ae92e..58f4e0e1079 100644 --- a/src/lib/chips/chip.spec.ts +++ b/src/lib/chips/chip.spec.ts @@ -215,7 +215,7 @@ describe('Chips', () => { fixture.detectChanges(); }); - it('DELETE emits the (remove) event', () => { + it('DELETE emits the (removed) event', () => { const DELETE_EVENT = createKeyboardEvent('keydown', DELETE) as KeyboardEvent; spyOn(testComponent, 'chipRemove'); @@ -227,7 +227,7 @@ describe('Chips', () => { expect(testComponent.chipRemove).toHaveBeenCalled(); }); - it('BACKSPACE emits the (remove) event', () => { + it('BACKSPACE emits the (removed) event', () => { const BACKSPACE_EVENT = createKeyboardEvent('keydown', BACKSPACE) as KeyboardEvent; spyOn(testComponent, 'chipRemove'); @@ -246,7 +246,7 @@ describe('Chips', () => { fixture.detectChanges(); }); - it('DELETE does not emit the (remove) event', () => { + it('DELETE does not emit the (removed) event', () => { const DELETE_EVENT = createKeyboardEvent('keydown', DELETE) as KeyboardEvent; spyOn(testComponent, 'chipRemove'); @@ -258,7 +258,7 @@ describe('Chips', () => { expect(testComponent.chipRemove).not.toHaveBeenCalled(); }); - it('BACKSPACE does not emit the (remove) event', () => { + it('BACKSPACE does not emit the (removed) event', () => { const BACKSPACE_EVENT = createKeyboardEvent('keydown', BACKSPACE) as KeyboardEvent; spyOn(testComponent, 'chipRemove'); diff --git a/src/lib/chips/chip.ts b/src/lib/chips/chip.ts index f61d525d5d1..c3f0714d8ed 100644 --- a/src/lib/chips/chip.ts +++ b/src/lib/chips/chip.ts @@ -183,7 +183,7 @@ export class MatChip extends _MatChipMixinBase implements FocusableOption, OnDes protected _selectable: boolean = true; /** - * Determines whether or not the chip displays the remove styling and emits (remove) events. + * Determines whether or not the chip displays the remove styling and emits (removed) events. */ @Input() get removable(): boolean { return this._removable; } @@ -205,23 +205,9 @@ export class MatChip extends _MatChipMixinBase implements FocusableOption, OnDes /** Emitted when the chip is destroyed. */ @Output() readonly destroyed: EventEmitter = new EventEmitter(); - /** - * Emitted when the chip is destroyed. - * @deprecated Use 'destroyed' instead. - * @deletion-target 6.0.0 - */ - @Output() readonly destroy: EventEmitter = this.destroyed; - /** Emitted when a chip is to be removed. */ @Output() readonly removed: EventEmitter = new EventEmitter(); - /** - * Emitted when a chip is to be removed. - * @deprecated Use `removed` instead. - * @deletion-target 6.0.0 - */ - @Output('remove') onRemove: EventEmitter = this.removed; - /** The ARIA selected applied to the chip. */ get ariaSelected(): string | null { return this.selectable ? this.selected.toString() : null; diff --git a/src/material-examples/chips-input/chips-input-example.html b/src/material-examples/chips-input/chips-input-example.html index 1307f3c4ee1..3ae37accbb1 100644 --- a/src/material-examples/chips-input/chips-input-example.html +++ b/src/material-examples/chips-input/chips-input-example.html @@ -1,7 +1,7 @@ + [removable]="removable" (removed)="remove(fruit)"> {{fruit.name}} cancel