Skip to content

Conversation

@mdjastrzebski
Copy link
Member

Summary

TL/RN v6 has provided getQueriesForElement for scoping queries to given element & it's children. RNTL v2 had a similar within function. Both of these were modeled on similar RTLs helper. In RTL both names are available (as alias) to provide the same function.

I've added getQueriesForElement as an alias to within.

Resolves #457

Test plan

  • tests for checking that functions are the same
  • typescript type checks

@thymikee thymikee changed the title Feat/get queries for element alias feat: add getQueriesForElement alias to within Jul 28, 2020
within(instance).getByRole('button'),
within(instance).getByA11yState({ busy: true }),
within(instance).getByA11yValue({ min: 10 }),
getQueriesForElement(instance).getByText('Test'),
Copy link
Member

Choose a reason for hiding this comment

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

I wish we could do something like within === getQueriesForElement instead, but TS is structural and this will likely pass anyway. And I wouldn't like to resort to hacks like described here

@mdjastrzebski mdjastrzebski merged commit aa6fe56 into 7.x Jul 28, 2020
@mdjastrzebski mdjastrzebski deleted the feat/get-queries-for-element-alias branch July 28, 2020 09:12
thymikee pushed a commit that referenced this pull request Jul 30, 2020
* feat: getQueriesForElement alias implementation & test

* feat: added typescript types and tests

* feat: updated docs
thymikee pushed a commit that referenced this pull request Jul 30, 2020
* feat: getQueriesForElement alias implementation & test

* feat: added typescript types and tests

* feat: updated docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants