Check That A Component Renders As Null
Last updated
Was this helpful?
Last updated
Was this helpful?
Consider a component that sometimes renders as null
.
How can we test the version of this component that renders as null
when hidden
is true
?
When renders a component, it wraps the whole thing in a surrounding <div>
. Knowing this, we can check if a component renders to null
by checking the contents of the wrapping <div>
container.
The component renders as null
, so the firstChild
of the RTL container
will be null
.