Markdown preview tests doesn't pass even though it seems like they should

Tell us what’s happening:
Describe your issue in detail here.
I have a working Markdown Previewer that loads example text but the test case doesn’t recognize it.

" 5. When my markdown previewer first loads, the default text in the #editor field should contain valid markdown that represents at least one of each of the following elements: a header (H1 size), a sub header (H2 size), a link, inline code, a code block, a list item, a blockquote, an image, and bolded text"

This test fails even though it should pass. I do have H1 etc. in my placeholder text.
Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36

Challenge: Build a Markdown Previewer

Link to the challenge:

Some people got this kind of problem a few weeks ago and found what caused it. Just search it in this sub-forum. Quite probably will be useful for you.

Well, it works manually. The tests are pretty serious about the content being there on load and it seems like anything that move the content from being available on load fails these tests.

Since your code is similar enough to one of my projects, I just ripped all the redux stuff out and made a few other rearrangements (rename, reorganize, lift state, etc., all essentially cosmetic), and the tests passed. So, I believe the problem is in the redux stuff.

I don’t do redux, so you can either chase through the redux path with some debugging console.log() statements or you can tear it out and do just react. I suppose it could also be how you are setting the initial values for the text and the markdown in the components. I know that it’s set on the first render if you pass the initial text in via props from the top level state in plain react. The preview as you have it looks like it has to go through a dispatch to get transformed from string to html by marked and I wonder if that delay is enough to fail one or both tests and if a similar problem is affecting the editor.

1 Like

There is a fix in the works. It just has to be committed and pushed.

@niin44 FYI, your project passes with the new tests so you do not have to make any changes.

Edit: I should have also mentioned the workaround right now is to use import.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.