testing-library / testing-library/testing-library-docs
Document confusing behavior with waitForElementToBeRemoved
- Dominant language
- JavaScript
- Stars
- 479
- Forks
- 740
- PR merge metrics
- No merged PRs in 30d
Description
So, I added this feature:
- await waitForElementToBeRemoved(() => screen.getByText('foo'))
+ const element = screen.getByText('foo')
+ await waitForElementToBeRemoved(element)
Both work, but the first I think is easier most of the time.
But I just learned that in React applications (and likely other frameworks) the DOM nodes aren't always removed, rather they're updated. So, that cool new feature won't always work as you might expect. I think we should probably document this somewhere.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the documentation for waitForElementToBeRemoved and review how its callback and element forms are currently described. Document that framework updates may change or reuse DOM nodes instead of removing them, and confirm the examples clearly explain when each form works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- documentation, testing
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100