Skip to content

Conversation

@domasx2
Copy link
Contributor

@domasx2 domasx2 commented Oct 25, 2020

Hi! Thanks for a great testing lib. Wrote a small lib for reusable selectors https://github.com/domasx2/testing-library-selector

Copy link
Member

@nickserv nickserv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example and your library look good thanks.

Pipe dream: Maybe it would be simpler if we just curried all of the query functions. If anyone's interested I can try to make an alternate API.

@domasx2 domasx2 force-pushed the domas/ecosystem-testing-library-selector branch from 9194cc1 to e455e86 Compare November 22, 2020 09:23
@domasx2
Copy link
Contributor Author

domasx2 commented Nov 22, 2020

thanks! rebased on latest master

@domasx2
Copy link
Contributor Author

domasx2 commented Nov 23, 2020

Pipe dream: Maybe it would be simpler if we just curried all of the query functions. If anyone's interested I can try to make an alternate API.

I've been thinking about something similar... There's a common use case where I want to scope queries to a particular container, typically identified with a data-testid.
Currently we typically get the container dom node, then query against it. However, sometimes React will recreate the container dom node or elements, making the old dom node reference stale. So I'm toying with the idea to extend this library with smth like this:

const inputInContainer = byTestId('foo-container').byLabelText('my input')

then inputInContainer.get() would get the container first, if that succeeds, get the input inside it, and so on

@nickserv nickserv merged commit ef7a906 into testing-library:master Nov 29, 2020
@nickserv
Copy link
Member

@all-contributors add @domasx2 for docs

@allcontributors
Copy link
Contributor

@nickmccurdy

I've put up a pull request to add @domasx2! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants