25+5 CLOCK_project - Audio Test Failing

Hello everyone,
I’ve been working on 25+5 clock project(pomodoro clock). Everything seems to be working as expected, though I am failing a couple of tests, User Story #26 and User Story #28. The error log is displaying: Timer has reached zero but audio is not playing while it should.: expected true to be false , for test 26 and Audio element was not stopped when reset was clicked.: expected false to be true for test 28. Despite those tests not passing, the behaviour of these two user stories seems to be as expected. Any kind of help on how to pass those tests would be much appreciated!

Link for the project:
https://codepen.io/kosn1/pen/XWRbWOW

Challenge: Build a 25 + 5 Clock

Link to the challenge:

Hi, have you tried moving your audio element out of your ‘Length’ component? Unless I’m mistaken, the ‘id’ attribute is supposed to be unique to each node in your DOM; here you are generating two DOM elements with the same id. That might be what’s causing the issue.

Just so you know, the ‘this’ keyword in your app refers to the Window object (if you console.log(this) you’ll see what I mean). You may have copied it from an example that uses class components, in which case the ‘this’ keyword refers to the component/class. If you need a global state which is shared horizontally across multiple components or vertically between components that are several levels deep, you should look into context and consider using the useContext hook.

Also, you should consider breaking your components up more; packing everything in one or two components makes them harder to maintain and decreases the performance benefit of using React.

1 Like

Hi @jacques.nikola !

This post has not been active for over 5 months.

We encourage our forum users to participate in newer posts.

Thanks!