const Preview = (props) => {
return (
<div id="preview"
dangerouslySetInnerHTML={{
__html: marked(props.input, {renderer: renderer, breaks: true})
}}
/>
);
}
<Preview input={this.state.markdown} />
When I do it this way I fail lots of tests. When I switch the preview id to the parent div like below I only fail test #4:
<div id="preview"
<Preview input={this.state.markdown} />
</div>
Then it says “#preview’s only children should be those rendered by marked.js”. I think it’s suggesting that I give the preview id to the root div rendered by the Preview function (like in the first snippet) but when I do that I fail lots of tests even though the app’s function doesn’t change in any way. I feel like moving on since I’ve been tinkering with this one test for hours.