react-shallow-testutils
react-shallow-testutils copied to clipboard
findWithProps?
How would you feel about a 'findWithProp' interface? I like the convenience of the 'findWithClass' function. Is there any reason we couldn't do that with props not just classnames? I'd like to be able to use something like 'id' to select, too.
Yeah, good idea. Were you thinking something like this:
const found = findWithProp(component, 'propName', propValue);
We'd need to think about what would happen with objects and arrays though. Would it be deep or just look at top-level props?
You could use something like lodash's _.get and take a string that represents a deep query. Maybe even use lodash to make the call?
+1, would love this functionality.