My component renders HTML using dangerouslySetInnerHTML
property. I need to access this rendered HTML in my enzyme tests. How can I do that?
I already tried component.html()
but it returns something like <button ...>[object Object]</button>
.
You can access it via the component props ...
const { dangerouslySetInnerHTML: { __html } } = component.props();
console.log('__html', __html);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With