The calculator project does not pass the test

Hello

I am working on a JavaScript Calculator project.

Although I made all the requirements, and when I actually calculate the calculator everything fits what it takes.
I don’t pass tests 9, 12, 13, 14. I don’t know why.

The code can be found here: https://github.com/yitzhak-bloy/calculator

Live demo found here: https://yitzhak-bloy.github.io/calculator/

Thanks in advance!

Put a live demo on codepen, and add the testing suite. Then we will be able to help you track down your problem.
FYI: Looks good, I bet it’s just a small issue with the tester.

1 Like

your #displaySum should be the #display ID. that is where the tester is looking for the result.
#9) "…the correct result should be shown in the element with the id of “display”

I also noticed the 1+2......... is not prevented :slight_smile:

But very nice! It looks great!

Thanks pjonp

I tried to change from #displaySum to #display but it didn’t matter, probably not the problem because above all, the div with #display surrounds, here:

Note that Test 7 and 8 I passed even though the requirement is:

I should be able to see my input in the element with the id of “display”.

You’re right in your comment about 1+2… ,
I’ll try to fix it later, but the test of it is passing.

Did you remember to change the container div id to something else? Because it will just see the container id first if you have the same id on both elements. I can make your project pass all tests except #13 if I change the id and make both count and sum be inside an element with the id of display.

I’m just not sure what the best way of having two readouts and still passing all the tests is. But you can look at the example project and see how it is done there.

Do you mean writing the code like this?

 <div id='display'>
    {count ? count : '0'}
    {sum}
 </div>

I tried to do so but it didn’t change the test result.