Skip to content

Commit d8a365e

Browse files
crisbetommalerba
authored andcommitted
refactor(list): remove 6.0.0 deletion targets (#10398)
Removes the 6.0.0 deletion targets from `material/list`. BREAKING CHANGES: * `selectionChange` on the `MatListOption`, which was deprecated in 5.0.0 has been removed. Use `selectionChange` on the `MatSelectionList` instead. * `MatListOptionChange` which was deprecated in 5.0.0 has been removed.
1 parent 27e5f6e commit d8a365e

File tree

2 files changed

+0
-50
lines changed

2 files changed

+0
-50
lines changed

src/lib/list/selection-list.spec.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {By} from '@angular/platform-browser';
1111
import {
1212
MatListModule,
1313
MatListOption,
14-
MatListOptionChange,
1514
MatSelectionList,
1615
MatSelectionListChange
1716
} from './index';
@@ -91,22 +90,6 @@ describe('MatSelectionList without forms', () => {
9190
expect(fixture.componentInstance.onValueChange).toHaveBeenCalledTimes(1);
9291
});
9392

94-
it('should emit a deprecated selectionChange event on the list option that got clicked', () => {
95-
const optionInstance = listOptions[2].componentInstance as MatListOption;
96-
let lastChangeEvent: MatListOptionChange | null = null;
97-
98-
optionInstance.selectionChange.subscribe(ev => lastChangeEvent = ev);
99-
100-
expect(lastChangeEvent).toBeNull();
101-
102-
dispatchFakeEvent(listOptions[2].nativeElement, 'click');
103-
fixture.detectChanges();
104-
105-
expect(lastChangeEvent).not.toBeNull();
106-
expect(lastChangeEvent!.source).toBe(optionInstance);
107-
expect(lastChangeEvent!.selected).toBe(true);
108-
});
109-
11093
it('should be able to dispatch one selected item', () => {
11194
let testListItem = listOptions[2].injector.get<MatListOption>(MatListOption);
11295
let selectList =

src/lib/list/selection-list.ts

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,6 @@ export const MAT_SELECTION_LIST_VALUE_ACCESSOR: any = {
5656
multi: true
5757
};
5858

59-
/**
60-
* Change event object emitted by MatListOption whenever the selected state changes.
61-
* @deprecated Use the `MatSelectionListChange` event on the selection list instead.
62-
* @deletion-target 6.0.0
63-
*/
64-
export class MatListOptionChange {
65-
constructor(
66-
/** Reference to the list option that changed. */
67-
public source: MatListOption,
68-
/** The new selected state of the option. */
69-
public selected: boolean) {}
70-
}
71-
7259
/** Change event that is being fired whenever the selected state of an option changes. */
7360
export class MatSelectionListChange {
7461
constructor(
@@ -148,14 +135,6 @@ export class MatListOption extends _MatListOptionMixinBase
148135
}
149136
}
150137

151-
/**
152-
* Emits a change event whenever the selected state of an option changes.
153-
* @deprecated Use the `selectionChange` event on the `<mat-selection-list>` instead.
154-
* @deletion-target 6.0.0
155-
*/
156-
@Output() readonly selectionChange: EventEmitter<MatListOptionChange> =
157-
new EventEmitter<MatListOptionChange>();
158-
159138
constructor(private _element: ElementRef,
160139
private _changeDetector: ChangeDetectorRef,
161140
/** @docs-private */
@@ -224,9 +203,6 @@ export class MatListOption extends _MatListOptionMixinBase
224203

225204
// Emit a change event if the selected state of the option changed through user interaction.
226205
this.selectionList._emitChangeEvent(this);
227-
228-
// TODO: the `selectionChange` event on the option is deprecated. Remove that in the future.
229-
this._emitDeprecatedChangeEvent();
230206
}
231207
}
232208

@@ -261,12 +237,6 @@ export class MatListOption extends _MatListOptionMixinBase
261237

262238
this._changeDetector.markForCheck();
263239
}
264-
265-
/** Emits a selectionChange event for this option. */
266-
_emitDeprecatedChangeEvent() {
267-
// TODO: the `selectionChange` event on the option is deprecated. Remove that in the future.
268-
this.selectionChange.emit(new MatListOptionChange(this, this.selected));
269-
}
270240
}
271241

272242

@@ -492,9 +462,6 @@ export class MatSelectionList extends _MatSelectionListMixinBase implements Focu
492462
// Emit a change event because the focused option changed its state through user
493463
// interaction.
494464
this._emitChangeEvent(focusedOption);
495-
496-
// TODO: the `selectionChange` event on the option is deprecated. Remove that in the future.
497-
focusedOption._emitDeprecatedChangeEvent();
498465
}
499466
}
500467
}

0 commit comments

Comments
 (0)