Skip to content
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
12 changes: 12 additions & 0 deletions src/lib/select/select.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2580,6 +2580,18 @@ describe('MatSelect', () => {
expect(trigger.textContent).not.toContain('None');
}));

it('should not mark the reset option as selected ', fakeAsync(() => {
options[5].click();
fixture.detectChanges();
flush();

fixture.componentInstance.select.open();
fixture.detectChanges();
flush();

expect(options[5].classList).not.toContain('mat-selected');
}));

it('should not reset when any other falsy option is selected', fakeAsync(() => {
options[3].click();
fixture.detectChanges();
Expand Down
1 change: 1 addition & 0 deletions src/lib/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ export class MatSelect extends _MatSelectMixinBase implements AfterContentInit,
const wasSelected = this._selectionModel.isSelected(option);

if (option.value == null && !this._multiple) {
option.deselect();
this._selectionModel.clear();
this._propagateChanges(option.value);
} else {
Expand Down