My clock is working fine, but when i run the test it always fail. I had tried many ways to fix it but it still have the same error.
My CodePen for reference
Test fail:
14. When a break countdown reaches zero (NOTE: timer MUST reach 00:00), and a new countdown begins, the element with the id of “timer-label” should display a string indicating a session has begun.
I had tried the clock but it does reach 00:00 but it still fail.
If I use the old render method and remove the two 500ms inner setTimeout you have, it passes the tests.
The fact that it break the way it does without the two setTimeouts with the new render is suspicious to me. But I didn’t try to debug it.
Edit: I didn’t test it, but I might suggest switching the time ref to a state variable and using updater functions for its state updates.
1 Like
I had tried useState but it went worse so I changed to ref. Idk is it ok to pass in the current version but thank you for the suggestion.
lasjorg
September 1, 2024, 6:04pm
6
You shouldn’t submit unless it is passing all the tests.
As I said, I can make it pass using the old render method (read the issue) and removing the two 500ms setTimeout
1 Like