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

ref(tests): Use screen for querying in RTL #29312

Merged
merged 2 commits into from
Oct 15, 2021
Merged

ref(tests): Use screen for querying in RTL #29312

merged 2 commits into from
Oct 15, 2021

Conversation

matejminar
Copy link
Member

@matejminar matejminar commented Oct 14, 2021

The benefit of using screen is you no longer need to keep the render call destructure up-to-date as you add/remove the queries you need. You only need to type screen. and let your editor's magic autocomplete take care of the rest.

screen was added in react testing library v9.

This is now the preferred/suggested way of querying by the library author.

@matejminar matejminar marked this pull request as ready for review October 14, 2021 10:52
@matejminar matejminar requested a review from a team as a code owner October 14, 2021 10:52
@matejminar matejminar requested review from a team and removed request for a team October 14, 2021 10:52
@priscilawebdev
Copy link
Member

Nice... thanks @matejminar 🙏

This is now the preferred/suggested way of querying by the library author.

would you have a link to share? I'd love to read more about it

@matejminar
Copy link
Member Author

@priscilawebdev he talks about it in the course and it's also mentioned in this article: https://kentcdodds.com/blog/common-mistakes-with-react-testing-library#not-using-screen

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants