-
Notifications
You must be signed in to change notification settings - Fork 469
Open
Description
Describe the feature you'd like:
I'd like to have an includeDescendents
option to *ByText
which would effectively be the same as searching by innerText
(but it's not that simple since it needs to respect the ignore
option).
I'm new to testing-library and have more familiarity with Cypress. I was hoping to find similar behaviour to cy.contains
.
Suggested implementation:
Describe alternatives you've considered:
cy.contains
but this is always an { exact: false}
match which is usually less than ideal.
Teachability, Documentation, Adoption, Migration Strategy:
Given this:
<p>
Refer to the
<a
href="https://testing-library.com/docs/dom-testing-library/api-custom-queries"
>Custom Queries</a
>
section for more details.
</p>
Then this:
findByText('Refer to the Custom Queries section for more details.', { includeDescendents: true })
Should match the p
node.
marcelhohn
Metadata
Metadata
Assignees
Labels
No labels