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
5 changes: 2 additions & 3 deletions src/lib/button-toggle/button-toggle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,8 @@ describe('MatButtonToggle without forms', () => {
fixture.detectChanges();
tick();

// The default browser behavior is to not emit a change event, when the value was set
// to false. That's because the current input type is set to `radio`
expect(changeSpy).toHaveBeenCalledTimes(1);
// Always emit change event when button toggle is clicked
expect(changeSpy).toHaveBeenCalledTimes(2);
}));

it('should emit a change event from the button toggle group', fakeAsync(() => {
Expand Down
5 changes: 2 additions & 3 deletions src/lib/button-toggle/button-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,9 @@ export class MatButtonToggle extends _MatButtonToggleMixinBase implements OnInit
this.buttonToggleGroup._syncButtonToggle(this, this._checked, true);
this.buttonToggleGroup._onTouched();
}

// Emit a change event when the native button does.
this.change.emit(new MatButtonToggleChange(this, this.value));
}
// Emit a change event when it's the single selector
this.change.emit(new MatButtonToggleChange(this, this.value));
}

/**
Expand Down