My ponent renders HTML using dangerouslySetInnerHTML
property. I need to access this rendered HTML in my enzyme tests. How can I do that?
I already tried ponent.html()
but it returns something like <button ...>[object Object]</button>
.
My ponent renders HTML using dangerouslySetInnerHTML
property. I need to access this rendered HTML in my enzyme tests. How can I do that?
I already tried ponent.html()
but it returns something like <button ...>[object Object]</button>
.
1 Answer
Reset to default 8You can access it via the ponent props ...
const { dangerouslySetInnerHTML: { __html } } = ponent.props();
console.log('__html', __html);