Skip to content

refactor(cdk-experimental/menu): rename cdk selectable output and add cdk specific output naming #20267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
2 changes: 1 addition & 1 deletion src/cdk-experimental/menu/menu-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class CdkMenuGroup implements AfterContentInit, OnDestroy {

/** Register each selectable to emit on the change Emitter when clicked */
private _registerClickListener(selectable: CdkMenuItemSelectable) {
selectable.clicked
selectable.toggled
.pipe(takeUntil(this._selectableChanges))
.subscribe(() => this.change.next(selectable));
}
Expand Down
4 changes: 2 additions & 2 deletions src/cdk-experimental/menu/menu-item-checkbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('MenuItemCheckbox', () => {

it('should emit on clicked emitter when triggered', () => {
const spy = jasmine.createSpy('cdkMenuItemCheckbox clicked spy');
checkbox.clicked.subscribe(spy);
checkbox.toggled.subscribe(spy);

checkbox.trigger();

Expand All @@ -87,7 +87,7 @@ describe('MenuItemCheckbox', () => {

it('should not emit on clicked emitter when disabled', () => {
const spy = jasmine.createSpy('cdkMenuItemCheckbox clicked spy');
checkbox.clicked.subscribe(spy);
checkbox.toggled.subscribe(spy);
checkbox.disabled = true;

checkbox.trigger();
Expand Down
4 changes: 2 additions & 2 deletions src/cdk-experimental/menu/menu-item-radio.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('MenuItemRadio', () => {

it('should emit on clicked emitter when triggered', () => {
const spy = jasmine.createSpy('cdkMenuItemRadio clicked spy');
radioButton.clicked.subscribe(spy);
radioButton.toggled.subscribe(spy);

radioButton.trigger();

Expand All @@ -83,7 +83,7 @@ describe('MenuItemRadio', () => {

it('should not emit on clicked emitter when disabled', () => {
const spy = jasmine.createSpy('cdkMenuItemRadio clicked spy');
radioButton.clicked.subscribe(spy);
radioButton.toggled.subscribe(spy);
radioButton.disabled = true;

radioButton.trigger();
Expand Down
4 changes: 2 additions & 2 deletions src/cdk-experimental/menu/menu-item-selectable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let nextId = 0;
@Directive()
export abstract class CdkMenuItemSelectable extends CdkMenuItem {
/** Event emitted when the selectable item is clicked */
@Output() clicked: EventEmitter<CdkMenuItemSelectable> = new EventEmitter();
@Output('cdkMenuItemToggled') toggled: EventEmitter<CdkMenuItemSelectable> = new EventEmitter();

/** Whether the element is checked */
@Input()
Expand All @@ -41,7 +41,7 @@ export abstract class CdkMenuItemSelectable extends CdkMenuItem {
/** If the element is not disabled emit the click event */
trigger() {
if (!this.disabled) {
this.clicked.next(this);
this.toggled.next(this);
}
}

Expand Down