-
Notifications
You must be signed in to change notification settings - Fork 468
Closed
Description
Before getting started, let me say thank you for all the hard work to make devs` life easier with testing! Well done! 🍻
Problem description:
The example of getByText is incorrect and misleading in the readme.
It says running the following script would produce the result commented out above the script.
// <a href="/about">About ℹ️</a>
const aboutAnchorNode = getByText(container, 'about')Since options.exact is true by default, it won't find the anchor element unless we change the code a bit (see the Suggested solution: section).
Suggested solution:
I see three options here to solve this:
A:
// <a href="/about">About ℹ️</a>
const aboutAnchorNode = getByText(container, 'About ℹ️')B:
// <a href="/about">About ℹ️</a>
const aboutAnchorNode = getByText(container, 'about', {
exact: false
})C:
// <a href="/about">About ℹ️</a>
const aboutAnchorNode = getByText(container, /about/i)Let me know which one is preferred and I'll open a PR on this.
Cheers!
Metadata
Metadata
Assignees
Labels
No labels