This is related to #439.
When .find()ing a component that contains a dot (.) in its name (e.g. <Some.Name />), enzyme is unable to get it.
Tried with:
component.find('Some.Name')
component.find('Some\.Name')
component.find('Some\\.Name')
But all of them return a 0-length wrapper.
It should return the components that match that tag name, probably with the escaped syntax: component.find('Some\.Name').
CSS selectors apparently support the \. escaping.
| library | version
| ---------------- | -------
| Enzyme | 3.2.0
| React | 16.1.1
I just noticed that Some acts as an object there, and what is actually rendered is Name. Absolute slip, sorry for the inconvenience!
I'm running into the same issue.
Thats my snapshot
<withTheme(Appbar.Header)>
<withTheme(Appbar.Content)
title="Flashcards"
/>
<Appbar.Action
icon="search"
onPress={[MockFunction]}
size={24}
/>
</withTheme(Appbar.Header)>
It didn't found anything when I've tried wrapper.find('Appbar.Action') .
@YagoGG how did you solve this problem?
@brunohkbx try finding it by reference instead of with a string name.
@ljharb sorry, can you provide me an example?
thanks.
Import it, and pass the component itself onto find
Thanks @ljharb, got it :smile:
Most helpful comment
Import it, and pass the component itself onto find