Skip to content

RFC for fetchBy* queries #769

@balavishnuvj

Description

@balavishnuvj

Describe the feature you'd like:

To get an element from the dom, we have 6 variants viz. getBy, getAllBy, queryBy, queryAllBy, findBy, and findAllBy.

More often than I like to admit I would visit cheatsheet to find the method I'm looking for.

Suggested implementation:

A sample usage for react(can be adopted for rest)

fetchByText(/text/, { allowEmpty: true, allowMultiple: false });

This would be able to combine get* and query* queries. We would still need to consider find* because of thats the only async query.

Proposal for findBy* is

asyncFetchByText(/text/, { allowMultiple: false });
fetchByTextAsync(/text/, { allowMultiple: false });

Describe alternatives you've considered:

Visit cheatsheet when you forget what does what

Teachability, Documentation, Adoption, Migration Strategy:

We should be able to include this along with the rest of the variants.

Would be happy to implement it myself  😀

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions