testcafe-react-selectors icon indicating copy to clipboard operation
testcafe-react-selectors copied to clipboard

Add predicate for the '.withProps' method

Open ChrisLane opened this issue 1 year ago • 5 comments

I would like a new version of withProps that is able to accept a function as an argument that determines whether a component should be returned.

Example use case: We pass Immutable.js objects to component properties and want to match against their values. Currently, I'm not aware of a clean way that we can do this but with the above proposal, we could hopefully do something like this:

const mySelector = ReactSelector("MyComponent").withProps(props => props.config.toJS().valueToCheck === "matching value")

ChrisLane avatar Apr 26 '23 15:04 ChrisLane

Hi @ChrisLane,

Thank you for sharing this idea with us.

miherlosev avatar Apr 28 '23 07:04 miherlosev

This issue has been automatically marked as stale because it has not had any activity for a long period. It will be closed and archived if no further activity occurs. However, we may return to this issue in the future. If it still affects you or you have any additional information regarding it, please leave a comment and we will keep it open.

github-actions[bot] avatar Mar 16 '24 01:03 github-actions[bot]

Bump

ChrisLane avatar Mar 16 '24 08:03 ChrisLane