Pls help with Front End Development Libraries Projects - Challenge: Build a 25 + 5 Clock

Hi,

I’ve been working hard on my “Build a 25 + 5 Clock” project. Could you please help me find out why the tests are not working? I have reviewed the user stories and tests errors but haven’t found out what I am missing.

If I test the program manually it seems to work correctly, however, when running the tests I get the following errors:

  1. I can see an element with corresponding id=“time-left”. NOTE: Paused or running, the value in this field should always be displayed in mm:ss format (i.e. 25:00).
    time-left is not formatted correctly: expected ‘01’ to equal ‘60’

  2. When I click the element with the id of “break-increment”, the value within id=“break-length” increments by a value of 1, and I can see the updated value.
    expected ‘1’ to equal ‘9’

  3. When I click the element with the id of “session-increment”, the value within id=“session-length” increments by a value of 1, and I can see the updated value.
    expected ‘21’ to equal ‘29’

  4. I should not be able to set a session or break length to > 60.
    Value in element with id of “break-length” is greater than 60.: expected ‘1’ to equal ‘60’

Thank you in advance.

I managed to passed the tests :slight_smile:
I was using a unique function called changeSession() to manage the session length increase/decrease buttons. In order to know which button had been pressed I was using:
let parent = event.target.parentElement.id;
if (parent == “session-increment”) {//increment length }else{//decrement length }
I splitted this functionality into 2 different functions and the tests are passing now correctly.

1 Like

congrats, i was also getting error for those test cases, and i was also managing all click events from a single function, good to know solution to that is to split’em up, thanks and happy coding :slight_smile:

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