Calculator tests are not getting passed


I’m currently working on the Front End Development Libraries projects. I’m on the Javascript Calculator.

you can find my code under:

(I havent really done any styling yet, as I want to get the functionality down first).

When I press to run the tests, it only gives me 4/16 passes. and tests that aren’t passing are like i.e. " My calculator should contain a clickable element containing an “=” (equal sign) with a corresponding id=“equals”"
But I have that on line 105.
same with having clickable elements that contain the numbers, operators, etc.

And the same for pretty much all other tests that aren’t passing, I feel like I fulfill them. I’m confused as I feel like my code fulfills the functionality of a calculator, but those tests are not passing, despite when I try to do the tests manually, I can do it.

Am I misunderstanding the exercise here? Or what is wrong in my code here?

thank you!

here you passing the prop called id to Button component

 <Button value = "=" id = "equals" handleEvent = {handleOperators} />

but, in the Button component, your actual button htnl elment does not have any id attribute

const Button = ({handleEvent, value}) => {
  return (
      <button onClick={() => handleEvent(value)}>{value}</button>

thus, you are rendering button html elements without id-s

1 Like

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