Landing page test problem

Hi!
It’s unfinished project but I don’t understand why I can’t pass this test:
User Story #4: I can see at least three clickable elements inside the nav element, each with the class nav-link .
I got this mistake:
The .nav-link with href="#features" is not linked to a corresponding element on the page : expected null to not equal null
And code:

var e=document.querySelectorAll("#nav-bar .nav-link");i.assert.isAtLeast(e.length,1,"The #nav-bar contains no .nav-link"),e.forEach(function(e){i.assert.isNotNull(e),i.assert.strictEqual(e.hasAttribute("href"),!0,"Each .nav-link element should have an href attribute ");var t=e.getAttribute("href").slice(1);i.assert.isNotNull(document.getElementById(t),'The .nav-link with href="'+e.getAttribute("href")+'" is not linked to a corresponding element on the page ')})

But anchors work fine. I don’t know why this appears.

Hi :slight_smile:
Have you got a link to your project on codepen for example? It will be easier to check the code :slight_smile:

Sorry, I was sleepy and forgot :neutral_face:

Hi,

Your problem is that you are linking to an anchor with name ‘features’ instead of id ‘features’ .

Change <a class='anchor' name="features"> to <a class='anchor' id="features">

The test is looking for an element with id=‘features’ and will not pass unless it finds one. Do the same for the other nav-links and it will pass the test.

Best of luck with the rest of them!

2 Likes

Thank you! I’ll try it!