Skip to content

within operator for bound queries #306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 14, 2020

Conversation

mdjastrzebski
Copy link
Member

Summary

This commit implements #297. New within operator, inspired by RTL operator of the same name exposes queries bound to given element.

Available queries are the same as those from render (so getBy, queryBy, incl. A11y). Additional render specific operations like update, unmount, debug, toJSON are NOT included.

Test plan

Added unit test for within operator as well as typescript type definitions tests.

@mdjastrzebski mdjastrzebski linked an issue May 14, 2020 that may be closed by this pull request
@thymikee
Copy link
Member

Missing the docs :)

@mdjastrzebski mdjastrzebski marked this pull request as draft May 14, 2020 09:09
@mdjastrzebski mdjastrzebski marked this pull request as ready for review May 14, 2020 10:24
@mdjastrzebski
Copy link
Member Author

Added docs for within operator

Copy link
Member

@thymikee thymikee left a comment

Choose a reason for hiding this comment

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

Looking good!

expect(secondQueries.getByPlaceholder('Same Placeholder')).toBeTruthy();
});

test('within() exposes a11y queries', () => {
Copy link
Member

Choose a reason for hiding this comment

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

I think we could merge these 2 tests, but no biggie

@thymikee thymikee merged commit 1809825 into callstack:master May 14, 2020
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.

Ability to query children of given element
2 participants