Enzyme is not finding component by props
Line of code to mount rich text editor!
mount(<RichTextEditor />).find('StyleButton').find('[label="UL"]');
Since find
returns another ReactWrapper
you could chain them that way:
mount(<RichTextEditor />).find({label:"UL"}).find(StyleButton)
Note: the order matters.
Inspired by @romanlv's comment, but I find this syntax clearer.
In the docs there is no option to mix name of component with props:
- CSS Selectors
- Component Constructors
- Component Display Name
- Object Property Selector
You can use findWhere:
wrapper.findWhere(n => n.name() === 'StyleButton' && n.prop('label') === 'UL')