feat: add toBeVisible as a presence query #730
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checks
Changes
toBeVisible
as a presence query, so thatexpect(screen.queryBy…).toBeVisible()
will be recommended to be changed toexpect(screen.getBy…).toBeVisible()
Context
Fixes #728
Questions
I am not fully confident if this PR yet handles the proposed behavior in #728 — both of the following should produce an error:
This is different from other presence queries, where
expect(screen.queryBy…).not.toBeVisible()
is correct.Could a review please check if that is or isn't working as desired?
Since I just copied the
toBeInTheDocument
tests, I would think that the tests are not specifying that this is the case. But I don't have enough confidence in my understanding of the test suite to be sure. Also, I wasn't able to figure out how to run my local branch in a real React project; I got the error "ESLint couldn't find the plugin" when I triedyarn publish
,yalc
, and just specifying apackage.json
path to my local plugin folder.