-
Notifications
You must be signed in to change notification settings - Fork 408
toHaveTextContent should support any Node #306
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
Labels
Comments
This comment has been minimized.
This comment has been minimized.
Makes sense. I think we should keep the check, even if changing it to check |
Same issue here, but with const { asFragment } = render(html`<${Home} />`)
expect(asFragment()).toHaveTextContent(/Hello from Preact/) Error:
|
Thanks |
julienw
added a commit
to julienw/jest-dom
that referenced
this issue
Apr 22, 2021
4 tasks
julienw
added a commit
to julienw/jest-dom
that referenced
this issue
Apr 22, 2021
🎉 This issue has been resolved in version 5.12.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@testing-library/jest-dom
version: 5.11.5node
version: 12.18.0yarn
version: 1.22.5react-testing-library
version: 11.1.0Relevant code or config:
What you did:
I'm in the process of installing and using jest-dom in our project. I installed the eslint plugin which converted this code:
What happened:
Here is the error I get:
Reproduction:
https://codesandbox.io/s/react-testing-library-demo-forked-0puq7
Problem description:
The property
textContent
is present in allNode
s, not onlyHTMLElement
. Therefore it would be nice if this expectation worked on allNode
s too, especially text nodes.See the MDN page about
textContent
:https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent
Suggested solution:
Is removing this line enough:
jest-dom/src/to-have-text-content.js
Line 8 in c11f9c5
Or should we replace it with a check for
instanceof Node
?The text was updated successfully, but these errors were encountered: