Skip to content

fix(prefer-screen-queries): take container into account #150

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

Merged
merged 4 commits into from
Jun 10, 2020
Merged

fix(prefer-screen-queries): take container into account #150

merged 4 commits into from
Jun 10, 2020

Conversation

lourenci
Copy link
Contributor

@lourenci lourenci commented Jun 5, 2020

It fixes #149.

Copy link
Member

@Belco90 Belco90 left a comment

Choose a reason for hiding this comment

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

Hi Leandro and thanks for your PR! The fix itself looks fine. Could you add couple of examples using container to valid and invalid sections within rule doc?

@lourenci lourenci requested a review from Belco90 June 7, 2020 00:04
@@ -4,9 +4,11 @@ import { ALL_QUERIES_COMBINATIONS } from '../../../lib/utils';

const ruleTester = createRuleTester();

const ALL_QUERIES_COMBINATIONS_PLUS_CONTAINER = [...ALL_QUERIES_COMBINATIONS, 'container']
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that it would be better to keep ALL_QUERIES_COMBINATIONS and then use container for its specific scenarios. As this would test as valid scenarios that do not match real tests. For instance, in the line 12 it would translate to

screen.container()

which is not RTL valid code. Same below for

within(component).container()

@gndelia
Copy link
Collaborator

gndelia commented Jun 7, 2020

Thank you for the PR!

I added a couple of small comments 😄

@Belco90 Belco90 merged commit a783036 into testing-library:master Jun 10, 2020
@Belco90
Copy link
Member

Belco90 commented Jun 10, 2020

🎉 This PR is included in version 3.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Belco90
Copy link
Member

Belco90 commented Jun 10, 2020

@all-contributors please add @lourenci for bug, code and test

@allcontributors
Copy link
Contributor

@Belco90

I've put up a pull request to add @lourenci! 🎉

gndelia added a commit to gndelia/eslint-plugin-testing-library that referenced this pull request Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shouldn't prefer-screen-queries takes into account querySelector?
3 participants