I’m trying to complete the freeCodeCamp project “Build a 25 + 5 Clock” but I have several issues that won’t pass their Test Suite. I’ve been trying to fix these issues for several days. I’d be grateful if someone could take a look at my project and offer some feedback.
I’m using React 18.2.0 and have seen recommendations in other threads to try React 17. So, I tried 17.0.2 and still failed all of the same tests.
I’ve inserted id="time-left" into a <div> as shown below, and can be seen on Line 153 of my codepen project. I tried using <span> instead of <div> but that didn’t fix the error.
At this point, I don’t know what I should do to even begin to solve the #Timer issues? Is there a technique that I could use in the browser dev tools to narrow this down? My intuition leads me to believe that there is a problem with my order of operations which the freeCodeCamp Test Suite doesn’t like.
Try logging the changes made from your handleLengthChange() function and run the tests again. You won’t see any output, but you should, which means that during the tests the increment/decrement buttons are being pressed and nothing is happening.
In general, if there is a react version problem on these tests, you’ll get different test failures from <=17 and >=18. The same failures indicate code problems.
Thanks Jeremy! This didn’t help me solve my particular issue…HOWEVER, learning how to console.log in React was super beneficial to me because I wasn’t aware that it required something different from standard JavaScript. A few minutes ago, it just occured to me that the freeCodeCamp is running their increment/decrement tests on the <button> element. I had placed my onClick event within an <i> element wrapped inside a <button> …as shown here… <button><i onClick={}></button>. That explains the fact that the clock was operating perfectly when I mouse-clicked on the increment/decrement ICONS, but failed the tests from freeCodeCamp which was engaging with the BUTTON. After I moved the onClick event to the <button> elements, all of my tests passed!