Skip to content

within for mutliple elements #420

Closed
Closed
@benmonro

Description

@benmonro

Describe the feature you'd like:

I'm aware of the callback function that allows you to accomplish this, but we've seen this pattern emerge enough times that it made me wonder if the ability to combine queries would be possible, and maybe make the tests a little more readable:

i.e. if i want to combine getByText & getByRole i know I can do this:

getByText((text, element => text === "Have an issue?" && element.getAttribute('role') === 'button'))

it would be nice to do something like this:

within(getAllByRole("button")).getByText("Have an issue?")

Suggested implementation:

modify within to accept a NodeList / array perhaps?

Describe alternatives you've considered:

none that i can think of

Teachability, Documentation, Adoption, Migration Strategy:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions