Skip to content
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

mat-slide-toggle component's toggle() method does not emit change event #11812

Closed
ychaikin opened this issue Jun 17, 2018 · 2 comments · Fixed by #11846
Closed

mat-slide-toggle component's toggle() method does not emit change event #11812

ychaikin opened this issue Jun 17, 2018 · 2 comments · Fixed by #11846
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@ychaikin
Copy link

Bug, feature request, or proposal:

Bug

What is the expected behavior?

When calling component's toggle method programmatically, change event should be emitted.

What is the current behavior?

Simply flips the boolean value of its checked property.

What are the steps to reproduce?

StackBlitz code sample with the test:
https://stackblitz.com/edit/angular-material-slide-toggle-test-qzbvad?file=app%2Fmat-slide-toggle-bug.component.spec.ts

What is the use-case or motivation for changing an existing behavior?

This would be very useful when testing behavior, but I can see how it would be useful for some programmatic toggling during regular use as well.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

All

Is there anything else we should know?

no

@ychaikin ychaikin changed the title mat-slide-toggle component's toggle method does not emit change event mat-slide-toggle component's toggle() method does not emit change event Jun 17, 2018
@ychaikin
Copy link
Author

If this is indeed a bug and not "as intended", I can probably help out and put together a PR to fix.

@crisbeto crisbeto self-assigned this Jun 19, 2018
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent has pr labels Jun 19, 2018
crisbeto added a commit to crisbeto/material2 that referenced this issue Jun 19, 2018
…m toggle method

Fixes the slide toggle not propagating its value to the `ControlValueAccessor` or dispatching its change event when its value is changed through the `toggle` method. It seems like we had a test for one of these cases, but it wasn't failing when it was supposed to.

Fixes angular#11812.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jun 19, 2018
Fixes the slide toggle not propagating its value to the `ControlValueAccessor` when its value is changed through the `toggle` method.

Fixes angular#11812.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jun 23, 2018
Along the same lines as angular#11812. The checkbox doesn't update its `ControlValueAccessor` value when it is toggled via the `toggle` method.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jun 30, 2018
Along the same lines as angular#11812. The checkbox doesn't update its `ControlValueAccessor` value when it is toggled via the `toggle` method.
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 1, 2018
Along the same lines as angular#11812. The checkbox doesn't update its `ControlValueAccessor` value when it is toggled via the `toggle` method.
jelbourn pushed a commit that referenced this issue Aug 23, 2018
Along the same lines as #11812. The checkbox doesn't update its `ControlValueAccessor` value when it is toggled via the `toggle` method.
jelbourn pushed a commit that referenced this issue Aug 25, 2018
Along the same lines as #11812. The checkbox doesn't update its `ControlValueAccessor` value when it is toggled via the `toggle` method.
vivian-hu-zz pushed a commit that referenced this issue Nov 6, 2018
Along the same lines as #11812. The checkbox doesn't update its `ControlValueAccessor` value when it is toggled via the `toggle` method.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 4, 2019
Along the same lines as angular#11812. The checkbox doesn't update its `ControlValueAccessor` value when it is toggled via the `toggle` method.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jun 19, 2019
Along the same lines as angular#11812. The checkbox doesn't update its `ControlValueAccessor` value when it is toggled via the `toggle` method.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants