-
Notifications
You must be signed in to change notification settings - Fork 149
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
Conversation
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.
Awesome! Thank you so much for implementing this one too, really appreciate it. Just added some small requests related to the doc.
docs/rules/prefer-screen-queries.md
Outdated
|
||
## Rule Details | ||
|
||
This works better with autocomplete and makes each test a little simpler. |
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.
Could you elaborate little bit more here? Something like:
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'; | ||
|
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.
Could you add here the render line to have a full example?
render(<Component />); |
I edited to PR to point it to |
eb4f402
to
c100330
Compare
No problem! Should be good now, thanks for the review |
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.
Fantastic. Thanks again!
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]>
Closes #95