In that case, I am required to do a non-shallow rendering/deep comparison with eql instead of equal. If I don't (and use equal), the rendered HTML that I get is <Component /> (which is to be expected).
That being said, what I am looking for here is doing a shallow rendering "two levels deep" where <Component /> gets rendered but not its children.
Is there any way to do that currently with preact-jsx-chai? Is there another way to provide the context without losing the ability to do shallow rendering?
Hmm - not sure if there's a way to do that via preact-jsx-chai, though the underlying preact-render-to-string/jsx library has an option { renderRootComponent: true } that does exactly what you described..
I am using a provider component to add context to the components I am testing.
Example:
In that case, I am required to do a non-shallow rendering/deep comparison with
eql
instead ofequal
. If I don't (and useequal
), the rendered HTML that I get is<Component />
(which is to be expected).That being said, what I am looking for here is doing a shallow rendering "two levels deep" where
<Component />
gets rendered but not its children.Is there any way to do that currently with
preact-jsx-chai
? Is there another way to provide the context without losing the ability to do shallow rendering?