Front-End Drum Machine Test 7 failing

Hi everyone

This is my first post so I’m sorry if I haven’t linked the code correctly, the repo I’ve been using for this challenge is here https://github.com/rxb870/DrumMachine to view the code (I’ve been working locally rather than using codepen).

The test " 7. When a .drum-pad is triggered, a string describing the associated audio clip is displayed as the inner text of the #display element (each string must be unique)." consistently fails, I’ve different ways of getting the internal text, displaying it etc but never seems to work. Though from a user perspective, it works, the test for that clip is displayed by clicking the button or with a keydown.

Am I getting something wrong still or is this an issue with the test? I tried the nested button issue which someone else has reported here but to no avail for me (https://forum.freecodecamp.org/t/drum-machine-does-anyone-know-why-this-fails-test-7/203257)

Thanks for any help.

Cheers
Ryan

Hey Ryan,

nice to meet you! :slightly_smiling_face:

When you have code on Github,
you can show us a running project by using the Import Project function on Codesandbox.

So seeing that you are already able to write good code,
you should have a look at the test suite and see if there could be an issue with your code.

Keep us posted!

Hi Miku

Thanks - I’ve imported tp Sandbox - does this link work? https://codesandbox.io/s/elastic-water-eql33?fontsize=14&hidenavigation=1&theme=dark

I’ve looked through the test suite, the test seems to trigger each click event on each drum-pad and then grab the #display element’s inner text, then checks whether any are the same.

I can’t see why this doesn’t pass for my code, the display element get’s a unique string in it’s innerText for each event. Is it something really simple and obvious that I’m missing?

Hey there,

that’s right, it’s grabbing every #display.
But what would happen if your page would have a wrong #display somewhere in the page?

That’s so stupid! I’ve literally spent days trying to figure out what’s wrong and it’s just that I forgot that I moved the id…

Thanks for the help, will clean it up and submit it!

Cheers
Ryan

1 Like