InputControl: Make onChange observable in Storybook#60055
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Does the job 👍
Any concerns with this bit from Storybook docs?
This is quite useful when your component has dozens (or hundreds) of methods and you do not want to manually apply the
fnutility for each of those methods. However, this is not the recommended way of writing actions. That's because automatically inferred args are not available as spies in your play function. If you useargTypesRegexand your stories have play functions, you will need to also define args with thefnutility to test them in your play function.
I personally don't have concerns about tracking them all, was just curious if you had any thoughts about it.
Note: unit test failures are unrelated and should disappear after a rebase.
|
This information is new to me, thanks for surfacing! I don't foresee us using Play functions in this main Storybook instance, so I think the convenience of the catch-all still outweighs the potential downsides. In this PR too, I likely would've forgotten |
Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org>
Required for testing IME keydown handling (follow-up to #59081)
What?
Enhances the Storybook stories for InputControl so
onChangeevents can be tested using the Actions panel.Why?
We generally want all our
onChangeevents to be testable in Storybook.Testing Instructions
In trunk Storybook, we can see that change events aren't logged in the Actions panel.
isPressEnterToChangeprop and reload.onChangeshould only be logged after blurring the input or hitting the Enter key. TheonValidatecalls should also be logged.