Skip to content

New: expose option to override bound queries #177

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 3 commits into from
Sep 18, 2018

Conversation

alexkrolick
Copy link
Collaborator

@alexkrolick alexkrolick commented Sep 18, 2018

What:

Useful if you want to add or change the queries

Why:

The custom render method documented in the README works well for wrapping the rendered node, but needs an extension point for adding/overriding queries. For example this would let you override the getByTestId query with a query for a different data-attribute (common request).

How:

getQueriesForElement already takes a query argument, this exposes it in the render options argument

Checklist:

  • Documentation ❌
  • Tests ❌
  • Ready to be merged ❌
  • Added myself to contributors table

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

Very cool 👍 Thanks @alexkrolick!!

@kentcdodds kentcdodds merged commit 57dd63d into testing-library:master Sep 18, 2018
@kentcdodds
Copy link
Member

Do you think we should document this? I'm on the fence.

@kentcdodds
Copy link
Member

🎉 This PR is included in version 5.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@alexkrolick
Copy link
Collaborator Author

I'll make a PR to document after using it more - might be part of a larger effort to show how to use custom queries

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