Skip to content

Commit

Permalink
refactor(chips): remove 6.0.0 deletion targets (#10311)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
crisbeto authored and mmalerba committed Mar 13, 2018
1 parent 88abd9e commit 1a8106d
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/demo-app/a11y/chips/chips-a11y.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h2>Removable chips in a form field</h2>

<mat-form-field>
<mat-chip-list matPrefix #chipList>
<mat-chip *ngFor="let person of people" [color]="color" (remove)="remove(person)">
<mat-chip *ngFor="let person of people" [color]="color" (removed)="remove(person)">
{{person.name}}
<mat-icon matChipRemove>cancel</mat-icon>
</mat-chip>
Expand Down
12 changes: 6 additions & 6 deletions src/demo-app/chips/chips-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h4>Advanced</h4>
<mat-chip color="accent" selected="true">Selected/Colored</mat-chip>

<mat-chip color="warn" selected="true" *ngIf="visible"
(destroy)="displayMessage('chip destroyed')" (remove)="toggleVisible()">
(destroyed)="displayMessage('chip destroyed')" (removed)="toggleVisible()">
With Events
<mat-icon matChipRemove>cancel</mat-icon>
</mat-chip>
Expand Down Expand Up @@ -101,7 +101,7 @@ <h4>Form Field</h4>
<mat-form-field class="has-chip-list">
<mat-chip-list [tabIndex]="tabIndex" #chipList1 [(ngModel)]="selectedPeople" required>
<mat-chip *ngFor="let person of people" [color]="color" [selectable]="selectable"
[removable]="removable" (remove)="remove(person)">
[removable]="removable" (removed)="remove(person)">
{{person.name}}
<mat-icon matChipRemove *ngIf="removable">cancel</mat-icon>
</mat-chip>
Expand All @@ -123,7 +123,7 @@ <h4>Form Field</h4>
<mat-form-field>
<mat-chip-list [tabIndex]="tabIndex" #chipList2 [(ngModel)]="selectedPeople" required>
<mat-chip *ngFor="let person of people" [color]="color" [selectable]="selectable"
[removable]="removable" (remove)="remove(person)">
[removable]="removable" (removed)="remove(person)">
{{person.name}}
<mat-icon matChipRemove *ngIf="removable">cancel</mat-icon>
</mat-chip>
Expand All @@ -143,7 +143,7 @@ <h4>Form Field</h4>
<mat-form-field class="has-chip-list">
<mat-chip-list #chipList3>
<mat-chip *ngFor="let person of people" [color]="color" [selectable]="selectable"
[removable]="removable" (remove)="remove(person)">
[removable]="removable" (removed)="remove(person)">
{{person.name}}
<mat-icon matChipRemove *ngIf="removable">cancel</mat-icon>
</mat-chip>
Expand Down Expand Up @@ -180,7 +180,7 @@ <h4>Stacked Chips</h4>
<h4>NgModel with chip list</h4>
<mat-chip-list [multiple]="true" [(ngModel)]="selectedColors">
<mat-chip *ngFor="let aColor of availableColors" color="{{aColor.color}}"
[value]="aColor.name" (remove)="removeColor(aColor)">
[value]="aColor.name" (removed)="removeColor(aColor)">
{{aColor.name}}
<mat-icon matChipRemove>cancel</mat-icon>
</mat-chip>
Expand All @@ -191,7 +191,7 @@ <h4>NgModel with chip list</h4>
<h4>NgModel with single selection chip list</h4>
<mat-chip-list [(ngModel)]="selectedColor">
<mat-chip *ngFor="let aColor of availableColors" color="{{aColor.color}}"
[value]="aColor.name" (remove)="removeColor(aColor)">
[value]="aColor.name" (removed)="removeColor(aColor)">
{{aColor.name}}
<mat-icon matChipRemove>cancel</mat-icon>
</mat-chip>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/chips/chip-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<MatChipEvent> {
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. */
Expand Down
4 changes: 2 additions & 2 deletions src/lib/chips/chip-remove.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -53,7 +53,7 @@ describe('Chip Remove', () => {

@Component({
template: `
<mat-chip [removable]="removable" (remove)="didRemove()"><a matChipRemove></a></mat-chip>
<mat-chip [removable]="removable" (removed)="didRemove()"><a matChipRemove></a></mat-chip>
`
})
class TestChip {
Expand Down
8 changes: 4 additions & 4 deletions src/lib/chips/chip.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand Down
16 changes: 1 addition & 15 deletions src/lib/chips/chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand All @@ -205,23 +205,9 @@ export class MatChip extends _MatChipMixinBase implements FocusableOption, OnDes
/** Emitted when the chip is destroyed. */
@Output() readonly destroyed: EventEmitter<MatChipEvent> = new EventEmitter<MatChipEvent>();

/**
* Emitted when the chip is destroyed.
* @deprecated Use 'destroyed' instead.
* @deletion-target 6.0.0
*/
@Output() readonly destroy: EventEmitter<MatChipEvent> = this.destroyed;

/** Emitted when a chip is to be removed. */
@Output() readonly removed: EventEmitter<MatChipEvent> = new EventEmitter<MatChipEvent>();

/**
* Emitted when a chip is to be removed.
* @deprecated Use `removed` instead.
* @deletion-target 6.0.0
*/
@Output('remove') onRemove: EventEmitter<MatChipEvent> = this.removed;

/** The ARIA selected applied to the chip. */
get ariaSelected(): string | null {
return this.selectable ? this.selected.toString() : null;
Expand Down
2 changes: 1 addition & 1 deletion src/material-examples/chips-input/chips-input-example.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<mat-form-field class="demo-chip-list">
<mat-chip-list #chipList>
<mat-chip *ngFor="let fruit of fruits" [selectable]="selectable"
[removable]="removable" (remove)="remove(fruit)">
[removable]="removable" (removed)="remove(fruit)">
{{fruit.name}}
<mat-icon matChipRemove *ngIf="removable">cancel</mat-icon>
</mat-chip>
Expand Down

0 comments on commit 1a8106d

Please sign in to comment.