-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Tests: Add Component Tests for DuotonePicker Component #69264
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
base: trunk
Are you sure you want to change the base?
Tests: Add Component Tests for DuotonePicker Component #69264
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. |
|
Hi @t-hamano , When you have a moment, Please review my work in this PR. Looking forward to your feedback |
t-hamano
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
Adding unit tests would be great, but here are some suggestions.
- We might also need unit tests for the
DuotoneSwatchcomponent. - This component is based on the
CircularOptionPickercomponent, but it would be nice to have some tests specific to theDuotonePickercomponent. For example:should not render the unset option when the `unsetable` prop is falseshould not render the custom duotone bar when the `disableCustomDuotone` prop or `disableCustomColors` prop is true
|
|
||
| await user.click( unsetOption ); | ||
|
|
||
| expect( handleChange ).toHaveBeenCalledWith( 'unset' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This contradicts the test title. Because the test title mentions that onChange should be called with undefined.
What?
This PR introduces unit tests for the DuotonePicker Component
Related comment: #48353 (comment)
Related issues: #48347, #48346
Why?
Adding these tests ensures that the components render correctly and behave as expected when interacting with the duotone color options. This improves confidence in the component functionality and helps catch regressions.
How?
- Rendering of duotone options.
- Proper handling of onChange when selecting and clearing duotone values.
Testing Instruction
Confirm tests pass.
Screenshots