Repository navigation
fix(material/input): input harness not dispatching change event - #34042
ewerton336 wants to merge 1 commit into
Conversation
Fixes that `MatInputHarness.setValue` didn't dispatch a `change` event after updating the value. This meant that listeners bound to `(change)` on the input weren't invoked, even though the value had been changed. The datepicker input harness already dispatches the event in its `setValue` method. Fixes angular#30160
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
I signed it! |
|
I think this was intentional, because if I remember correctly, the change event gets dispatched when the user blurs the input. |
|
Thanks for taking a look! That makes sense for real user interaction, since If you'd rather keep the current behavior, I'm happy to close this, or alternatively update the |
MatInputHarness.setValueupdates the value by clearing the input, sending keys and setting thevalue property, but it never dispatches a
changeevent. As a result,(change)listeners on amatInputaren't invoked in tests, even though the value changed (see the reproduction in the issue).This change dispatches a
changeevent at the end ofsetValue, which is consistent with whatMatDatepickerInputHarness.setValuealready does (#20877). A unit test was added that fails withoutthe fix.
Fixes #30160