-
Notifications
You must be signed in to change notification settings - Fork 24
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
Added filterWhere function to FindWrapper #55
Added filterWhere function to FindWrapper #55
Conversation
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 think we could also possibly bake this functionality into the existing filter()
method, we don't currently have a filter(functionPredicate)
but it would be really easy to support.
Perhaps, find(vnode => shouldInclude)
, filter(vnode => shouldInclude)
and filterWhere(wrappedNode => shouldInclude)
?
Thoughts? Either way, lets add a usage example to the docs as this is a fairly complicated use, it would be nice to see the use case.
README.md
Outdated
@@ -166,6 +166,9 @@ Returns a new `FindWrapper` with a subset of the previously selected elements gi | |||
|
|||
Uses the same possible selectors as [`RenderContext#find(selector)`](#rendercontextfindselector). | |||
|
|||
### `FindWrapper#filterWhere(predicate)` | |||
Returns a new `FindWrapper` with a subset of the previously selected elements which, when passed into the provided predicate function, return true. |
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.
A small usage example here would be useful.
Also 😍 thanks for all the submissions! |
I concur with #55 (review) @gnarf. We can overload |
I'm sorry for the delay, I had a hectic end of the month, I will have the changes ready by the end of the week. For this pull request I still need to update |
filterWhere
function was added mimicking enzyme's functionalityResolves #54