I'm not sure if this is an issue for here or an issue for Enzyme but I've only ever encountered it while using svg-inline-react.
If I am shallow rendering a component to test, such as
import InlineSVG from 'svg-inline-react'
import mapMarker from '../../assets/icons/map-marker.svg'
const LocationDetails = ({ words }) => (
<div>
<InlineSVG src={mapMarker}/>
<div>{words}</div>
</div>
)
during the test I can output the shallow(<LocationDetails />).debug() and I see the <InlineSVG> with its attributes but doing a shallow(<LocationDetails />).contains(<InlineSVG />) fails. However doing shallow(<LocationDetails />).find('InlineSVG').length returns 1.
:(
References
http://airbnb.io/enzyme/docs/api/shallow.html
I'm not sure if this is an issue for here or an issue for Enzyme but I've only ever encountered it while using
svg-inline-react.If I am
shallowrendering a component to test, such asduring the test I can output the
shallow(<LocationDetails />).debug()and I see the<InlineSVG>with its attributes but doing ashallow(<LocationDetails />).contains(<InlineSVG />)fails. However doingshallow(<LocationDetails />).find('InlineSVG').lengthreturns 1.:(
References
http://airbnb.io/enzyme/docs/api/shallow.html