Describe the bug
The docs page for the byText API states that
[it] will search for all elements that have a text node with textContent matching the given TextMatch.
this is not true and will lead to confusion, since it's easy to find situations where trying to use getByText with the textContent of a node and not getting any match
To Reproduce
Here is a minimal codesandbox showing a case of getByText not matching the textContent of a node
Expected behavior
Either
- the docs reflect the actual implementation, which does not use textContent
- the implementation actually uses textContent for the matching.
Additional context
See also this issue on the dom-testing-library repo
Describe the bug
The docs page for the byText API states that
this is not true and will lead to confusion, since it's easy to find situations where trying to use
getByTextwith thetextContentof a node and not getting any matchTo Reproduce
Here is a minimal codesandbox showing a case of
getByTextnot matching the textContent of a nodeExpected behavior
Either
Additional context
See also this issue on the
dom-testing-libraryrepo