Here is a link to my project: https://codepen.io/moizhasan/pen/XxmJxe
I can’t get tests 3 or 4 to pass even though it seems to be updating correctly when I try it out.
Thanks in advance.
Here is a link to my project: https://codepen.io/moizhasan/pen/XxmJxe
I can’t get tests 3 or 4 to pass even though it seems to be updating correctly when I try it out.
Thanks in advance.
I’m on Firefox on Windows. It doesn’t update for me.
A couple of things:
#editor in the componentDidMount() event handler. You should set a default attribute that gets passed in to your MarkdownPreview component and handled in the constructor’s this.state={} statement.onChange, not onchange
event, but not declared it within updatePreview.
Making these changes got it to live update, but the tests still don’t acknowledge it. Did you link to and older version?
I also remember that when I got stuck, I check the test bundle (URL in the test failure messages with a :line number). So, if you download that into a code editor like Notepad++, you can read the conditions that caused the error message.
For example: Your specific test error messages (inside the border):
3. #preview is not being updated as I type into #editor (should update on every keyup)
4. preview’s only children should be those rendered by marked.js : expected ‘<h2>Preview</h2><div id=“preview-text”></div>’ to equal ‘’
Tells me that if you fix #4, you might also pass #3.
It seems like the issue was having any child elements inside #preview cause the test to fail. Dumb mistake on my part -_-
Renaming preview-text to preview passes 3 and 4.
Mark my prior hint as the solution, then.