Front End Development Libraries - Build a Drum Machine Test 6 Fails

Test 6 requires that pressing a button on the keyboard makes the corresponding audio component play. I believe my code already achieves this effect, but I cannot get the test to pass.

Codepen: https://codepen.io/platformer/full/vYReMzM

Try logging out event.key inside the handlers and look at the console when running the tests.

1 Like

Thank you, I figured it out! I had previously determined that event.key was lowercase whenever I press buttons on my keyboard, so I only converted the target of the comparison to lowercase. But it seems that when the tests are run, event.key becomes uppercase. I fixed it by converting both sides to lowercase. I actually didn’t realize that a KeyboardEvent would signify a key’s shiftedness in this way, and I was not expecting the tests to fire events using uppercase keys.

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