-
Notifications
You must be signed in to change notification settings - Fork 471
feat(queries): allow overriding queries in getQueriesForElement #67
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
feat(queries): allow overriding queries in getQueriesForElement #67
Conversation
src/get-queries-for-element.js
Outdated
* @param {FuncMap|FuncMap[]} queries object of functions, or array of objects | ||
* @returns {FuncMap} returns object of functions bound to container | ||
*/ | ||
function getQueriesForElement(element, queries = defaultQueries) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that passing custom queries overrides the default instead of merging. If you want to merge you need to import queries
and add it to the array, too.
Open to changing this but I think it makes sense; wrappers like react-testing-library's render
can merge queries by default on top of this API if they prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just one feature I want removed.
src/get-queries-for-element.js
Outdated
*/ | ||
function getQueriesForElement(element, queries = defaultQueries) { | ||
let flattenedQueries | ||
if (Array.isArray(queries)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather not have this logic here. If someone wants to merge the built in queries they can be responsible for doing that themselves when they call the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super!
🎉 This PR is included in version 2.9.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
* chore: document GitHub issues flow * chore: Link to issues policy * chore: update policies, badges * minor updates
What:
Why:
How:
Checklist: