Pomodoro clock works but marked as wrong

(Please ignore how I haven’t styled it at all)

So, besides the code being really janky it seems to me like it fulfills all the stories excepts its telling me it doesn’t reach 00:00 when it clearly does.
It also says the play and pause and pause doesn’t work, which it does when I try it but I admit that the test suite somehow breaks it.

Its the problem my janky code or did I somehow trigger a bug in the test suite?

Hi there!

Please do not undo moderator actions when a topic is moved to the appropriate category.

Since this is a javascript project, this post belongs in the javascript category.
General is for topics that don’t fit in any of the categories.


When I tested your clock, there was a slight delay from when I pressed the button to when it actually starts.

That might be part of the issue.

Also, it seems to skip from 25:00 to 24:58.

I can tell you that if I change the session length a few times and reset a few times that at some point the play button stops working and won’t do anything when I click it.

After I run the test suite that also happens, so the problem probably lies there. Can you be a bit more specific with what you tried? I tried the following steps and it seemed to work:

  1. Start clock with default session length
  2. Let it run for a couple of seconds
  3. Reset
  4. Increase/Decrease session length
  5. Repeat steps

Did you do something different or maybe did it in quick succession or something?

I would suggest you log out the state variables in different places, see if you can catch the state being inconsistent at some point. You can also use a method like componentDidUpdate to log out the state.

You also have a bit of pure DOM manipulation I would suggest you avoid and for the buttons, I’m not sure I really see why you need to use addEventListener. Not that you can’t use addEventListener but I wouldn’t suggest using it unless you need some global event listener on the document. For individual buttons, you should try to use the React event system.

Here’s what I just did:

  1. With the default set up, clicked play button to let the clock run for a few seconds then clicked it again to stop the clock.
  2. Set the session length lower (19 in this case but I’m guessing it doesn’t matter how low you set it)
  3. Clicked the reset button.
  4. Now the play button does not work.

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