Closed
Description
Describe the feature you'd like:
I want to be able to select an option by the text that it contains, or improve documentation to make an existing strategy easier to find.
I use react-testing-library
and cypress-testing-library
.
Suggested implementation:
getByRole('option', { contains: 'Some Option' })
Describe alternatives you've considered:
Best:
getByText('Some Option', { selector: '[role=option]' })
Not best:
getAllByRole('option').filter(option =>
checkOptionForText('Some Option') // not sure where to look
)
Teachability, Documentation, Adoption, Migration Strategy:
If a new option would not break anything. I realize that getByRole
supports every role available. Some roles like navigation
would be a bad case for this enhancement. Other roles such as link
would be improved.
Metadata
Metadata
Assignees
Labels
No labels