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

SelectControl: Use roles and @testing-library/user-event in unit tests #42308

Merged
merged 4 commits into from
Jul 11, 2022

Conversation

walbo
Copy link
Member

@walbo walbo commented Jul 11, 2022

What?

Updates the SelectControl unit tests to use @testing-library/user-event for interacting with the component and getting elements by role.

Why?

  • Makes the tests much closer to what users actually experience, increasing likelihood of catching bugs.
  • Getting elements by role is the preferred way.

How?

Refactored SelectControl unit tests.

Testing Instructions

npm run test-unit

@walbo walbo added [Type] Enhancement A suggestion for improvement. [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Package] Components /packages/components labels Jul 11, 2022
@walbo walbo requested a review from ajitbohra as a code owner July 11, 2022 07:11
@walbo walbo changed the title SelectControl: Use roles and @testing-library/user-event in tests SelectControl: Use roles and @testing-library/user-event in unit tests Jul 11, 2022
@walbo walbo requested a review from mirka July 11, 2022 11:33
Copy link
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one! 🚀

@walbo walbo merged commit 9a06585 into trunk Jul 11, 2022
@walbo walbo deleted the update/select-control-use-user-event-in-tests branch July 11, 2022 20:38
@github-actions github-actions bot added this to the Gutenberg 13.7 milestone Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants