Broken script in challenges

Hello,
I have just finished the 3rd HTML-CSS challenge, so I ran the script that shows me if I fulfilled all the tests. The problem is here:
Even though everything works as it should and everything has the correct id, the script (which checks if all User stories are fulfilled) spits irrelevant errors.
My codepen: https://codepen.io/samokosik/pen/zYKbBJy?editors=1100

Possible causes:

  • there is a bug in the script and my code has a trigger which triggers the bug
  • an aspect, which should be in the added to my code is not mentioned in the user stories

If anyone has the same problem or knows what this causes, let me know.
Thanks

The tests are very specific. It can be frustrating, but this in many ways mimics problems you will encounter as a software dev.

I assume this is the product landing page.

The first error I get:

  1. When I click a .nav-link button in the nav element, I am taken to the corresponding section of the landing page.’

Each .nav-link element should have an href attribute : expected false to equal true

I look at the code:

        <ul>
          <li class="nav-link" id="li1"><a href="#link1">Link1</a></li>
          <li class="nav-link" id="li2"><a href="#link2">Link2</a></li>
          <li class="nav-link" id="li3"><a href="#link3">Link3</a></li>
        </ul>

The class should be on the link, the anchor - not the li.

When I fix that, that test passes.

2 Likes

The next error says:

  1. Within the form, there is a submit with corresponding id=“submit”.

#submit should be an element : expected ‘BUTTON’ to equal ‘INPUT’ AssertionError: #submit should be an element : expected ‘BUTTON’ to equal ‘INPUT’

It is telling you what the problem is:

    <button id="submit" type="submit">Submit</button>

You have a button, it wants and input. Look up how how these are used. It will take a little adjustment, but that’s the idea.

The last thing:

  1. When I click the #submit element, the email is submitted to a static page (use this mock URL: https://www.freecodecamp.com/email-submit).

The #email input should have a name attribute : expected false to equal true AssertionError: The #email input should have a name attribute : expected false to equal true

That tells you exactly what the problem is.

When I fix these three things, all the tests pass for me.

Part of being a developer is paying attention to tiny details. And the finished product isn’t done if you think it’s done, it’s done when the product owners think it’s done and meets their specifications.

1 Like