Please assist: my 25 + 5 clock is failing 9 tests

Could someone assist me. I have finished building my 25 + 5 clock and it is working fine, however, it is inexplicably failing 9 of the tests. The tests, it is failing are as listed below (with their error messages.):

  • Failed #Timer tests, 10 and 11 with the error message: 25 + 5 clock has started, but time displayed is not changing. Expected ‘00’ to equal ‘00’.

  • Failed #Timer tests 1, 12, 13, 14, 15 and #Audio test 1 with the error message: Timer has not reached 00:00.

  • Failed #Timer test 9 with the error message: 25 + 5 clock has started, but time displayed is not changing: expected 0 to be above 0.

I have tried unsuccessfully to debug these error messages, as well as read related forum posts, but have still been unable to resolve the issues. Also here is the codepen link of my code: My 25 + 5 Clock


Please could someone take pity on me and look at my issue, as I have put in a lot of effort to resolve it, but to no avail.

What I can see from testing your buttons is that when I click:
“start/stop” -> “reset” -> “start/stop”
the timer doesn’t run unless I click on “start/stop” a second time.

Hope that helps to find the bug

Thanks for the response.

however, I would like to recheck your answer, as I have tried clicking on the “start/stop” and it does start on the first click. It also stops while running on the first click. And this should be expected, because from my code, the startStopTimer function, only runs , if clicked, if runningFlag is false and only stops, when running, if clicked, when runningFlag is true.

So please could you recheck again? Thanks.

The problem appears if you don’t stop the timer before pressing the reset button. The reset button does stop the timer (which is as it should be), but after that, it takes two clicks on the start button to restart it.

Thanks a bunch, as I have finally resolved the issue, thanks to your help. However, my code actually had two issues, and your input helped me to resolve one.

The one your input helped, I resolved because after you told me in your second post, how the double-click-before-starting-occurred, I realised that what was causing it was my runningFlag. At default, it was set to false. however, when it is false and the startStopTimer function called(via the appropriate onClick function, by pressing the startstop icon), the timer is supposed to start running (the runningFlag is also set to true then). While when the timer was running and runningFlag true, calling the startStopTimer by clicking the startStop icon, should stop the timer (at the same time , the runningFlag would be set to false.) The problem was that in my reset function, i didn’t remember to initialize runningFlag to default(false), hence if the timer was stopped by the reset button instead of the startStop icon, the action of setting the runningFlag to false, by the startStop button would not be done, so the flag would still be true. Hence, clicking the startStop icon to start the timer would not work the first time, as the runningFlag would still be true and only change to false after that first click. On the second click of the startStop Timer, the timer would start running, because the runningFlag was then already false! So that issue disappeared after i set the runningFlag to false in the reset function.

The second issue, i discovered and resolved by virtue of scrolling through so many reported issues on the same project on this forum. And the problem, was from the placement of my id (specifically the id=“start_stop”) in my TimerControls component. And it was a nesting problem. This was because the two font awesome icons I used for the combined start and stop icon were nested inside one span tag. So I initially placed the id in the span tag, and not the i tags of the font awesome icons. So the issue was solved, when I moved the id from the span tag to each of the two i tags of the font awesome icons inside the span.

Solving just one of the two issues was not enough to solve my main issue (the failing tests), it was when I solved the two, that all the tests passed. Once again, I thank you the great role you played in the resolution. Thanks again.

Awesome you got all tests to pass, the detailed description of what the problem was will help others in the future with this tricky challenge :love_you_gesture:

No way! Thank you, so much. I just passed 8 tests because of this silly oversight. Just one more test to figure out! Thank you again for posting your detailed explanation.