-
Notifications
You must be signed in to change notification settings - Fork 728
docs: update waitForElementToBeRemoved
#652
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
Draft
shermanhui
wants to merge
1
commit into
testing-library:main
from
shermanhui:document-confusing-behavior-for-waitForElementToBeRemoved
Draft
docs: update waitForElementToBeRemoved
#652
shermanhui
wants to merge
1
commit into
testing-library:main
from
shermanhui:document-confusing-behavior-for-waitForElementToBeRemoved
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add clarification that a callback function is the recommended argument type to be passed into the `callback` argument of `waitForElementToBeRemoved` as DOM nodes are not guaranteed to be removed in frameworks such as React. They may be updated rather than removed as referenced in issue testing-library#409.
kentcdodds
kentcdodds
approved these changes
Oct 23, 2020
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.
Excellent 👍
kentr
commented
Oct 25, 2020
I couldn't figure out how to comment on the commit itself, so I'm putting this here.
I suggest a slight variation in the first 2 lines of the change by @shermanhui. The difference is the order in which the options are listed:
- The first argument must be a callback which returns an element or array of - elements, an element, or an array of elements. The recommended approach is to + The first argument must be an element, an array of elements, or a callback + which returns an element or array of elements, . The recommended approach is to
nikkhielseath
added a commit
to nikkhielseath/testing-library-docs
that referenced
this pull request
Apr 18, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I've added clarification that a callback function is the recommended argument type to be passed into the
callback
argument ofwaitForElementToBeRemoved
. As DOM nodes are not guaranteed to be removed in frameworks such as React; They may be updated rather than removed as referenced in issue #409.I'd like to add a vanilla JS example in the following
md
file, but I'm not sure how to replicate the issue that was described in the issue thread, and I'd appreciate any assistance with getting some working examples to add to the docs!I have a sandbox up here with a Vanilla JS example here, but I'm not sure how to test the text change (AFAIK - it should work as expected, it's
essentially the same logic as the React example).
I also have a React example here, where I was trying to reproduce the failing case that @kentcdodds reported here in order to add an example of the failure that was mentioned.
The second test case is where I pass an element directly instead of a callback, but it seems like this case passes 🤔