-
Notifications
You must be signed in to change notification settings - Fork 41
feat(to-have-value): added new rule prefer-to-have-value #111
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
Codecov Report
@@ Coverage Diff @@
## master #111 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 12 13 +1
Lines 247 259 +12
Branches 37 37
=========================================
+ Hits 247 259 +12
Continue to review full report at Codecov.
|
src/rules/prefer-to-have-value.js
Outdated
| category: "jest-dom", | ||
| description: "prefer toHaveValue over checking element.value", | ||
| url: "prefer-to-have-value", | ||
| recommended: false, |
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.
Why not recommend this rule? Seems safe and it's still fixable.
| recommended: false, | |
| recommended: true, |
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.
Wanted to vet it a bit with the new smoke test feature we added. But yeah this is the plan
| }, | ||
|
|
||
| //expect(element).toHaveAttribute('value', 'foo') / Property | ||
| [`CallExpression[callee.property.name=/toHave(Attribute|Property)/][arguments.0.value=value][arguments.1][callee.object.callee.name=expect], CallExpression[callee.property.name=/toHave(Attribute|Property)/][arguments.0.value=value][arguments.1][callee.object.object.callee.name=expect][callee.object.property.name=not]`]( |
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.
Is [arguments.1] needed here?
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.
yeah here's it's needed. its essentially a non null check to ensure there's a 2nd param ("foo" in the commented example.)
Co-authored-by: Anton Niklasson <[email protected]>
…t-dom into feature/to-have-value
|
🎉 This PR is included in version 3.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What: Add new rule prefer-to-have-value
Why: all the matchers!
How: with code.
Checklist: