DevExpress/testcafe-react-selectors

withProps: allow partial matching of a prop that's an object

ktj opened this issue · 8 comments

ktj commented

Example I have

<List>
  <ListItem someProp={{ type: 'foobar', label: 'some random text' }} />
...

And a selector

ReactSelector('List').findReact('ListItem').withProp({ someProp: { type: 'foobar' } });

Hi @ktj,
Thank you for the suggestion. I agree it can be a quite useful feature. I need to figure out API for this feature.

Any news on this feature. Partial matching of objects in props would be great.

Same as above, this would really make a difference. Any suggestions on how to deal with that meanwhile ?

I'm going to implement it soon. I think the partial matching should be default behaviour, because it's the more common case. What do you think?

Definietly default, not sure if that’s case for everyone, but I often work with objects that have large number of props so in my case its most common scenario.

Implemented in testcafe-react-selectors@3.0.0

Can we do the same with array of strings.
withProps to allow partial matching of a prop that' an array.

<Card tags=['tag1','tag2']/>

ReactSelector('Card').withProps('tags', ['tag1'])
should give me all the ones that has 'tag1' but the partial matches are not returned

@saikumarr

Hello,

Thank you for your suggestion. I created a new issue about it: #158.

I cannot give you any estimate as to when this functionality will be implemented. Of course, your PR is welcome.