Skip to content

feat(prefer-screen-queries): add prefer-screen-queries #99

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 2 commits into from
Mar 26, 2020

Conversation

timdeschryver
Copy link
Member

Closes #95

@timdeschryver timdeschryver added the new rule New rule to be included in the plugin label Mar 25, 2020
@Belco90 Belco90 changed the base branch from master to v3 March 25, 2020 20:49
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.

Awesome! Thank you so much for implementing this one too, really appreciate it. Just added some small requests related to the doc.


## Rule Details

This works better with autocomplete and makes each test a little simpler.
Copy link
Member

Choose a reason for hiding this comment

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

Could you elaborate little bit more here? Something like:

Suggested change
This works better with autocomplete and makes each test a little simpler.
DOM Testing Library (and other Testing Library frameworks built on top of it) exports a `screen` object which has every query. This works better with autocomplete and makes each test a little simpler to write and maintain.
This rule aims to force writing tests using queries directly from `screen` object rather than destructuring them from `render` result.


```js
import { screen } from '@testing-library/any-framework';

Copy link
Member

@Belco90 Belco90 Mar 25, 2020

Choose a reason for hiding this comment

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

Could you add here the render line to have a full example?

Suggested change
render(<Component />);

@Belco90
Copy link
Member

Belco90 commented Mar 25, 2020

I edited to PR to point it to v3 branch and now you get some conflicts. Sorry about that.

@timdeschryver timdeschryver force-pushed the pr/prefer-screen-queries branch from eb4f402 to c100330 Compare March 26, 2020 17:47
@timdeschryver
Copy link
Member Author

No problem! Should be good now, thanks for the review

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.

Fantastic. Thanks again!

@Belco90 Belco90 merged commit d60b762 into v3 Mar 26, 2020
@Belco90 Belco90 deleted the pr/prefer-screen-queries branch March 26, 2020 18:03
Belco90 added a commit that referenced this pull request Mar 29, 2020
feat(await-async-utils): reflect waitFor changes (#89)
feat: new rule no-wait-for-empty-callback (#94)
feat: new rule prefer-wait-for (#88)
feat: new rule prefer-screen-queries (#99)
BREAKING CHANGE: drop support for node v8. Min version allowed is node v10.12 (#96)
BREAKING CHANGE: rule `no-get-by-for-checking-element-not-present` removed in favor of new rule `prefer-presence-queries` (#98)

Closes #85
Closes #86
Closes #90
Closes #92
Closes #95

Co-authored-by: timdeschryver <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new rule New rule to be included in the plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: new rule to prefer the usage of screen
2 participants