web-monetization-extension icon indicating copy to clipboard operation
web-monetization-extension copied to clipboard

Switch component test error

Open raducristianpopa opened this issue 1 year ago • 1 comments

console.error
      Warning: You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.
          at input
          at label
          at Switch (/Users/radu/dev/web-monetization-extension/packages/extension/src/components/switch.tsx:39:9)

      31 |
      32 |   it('forwards checked prop to input element', () => {
    > 33 |     render(<Switch checked />)
         |           ^
      34 |     const inputElement = screen.getByRole('switch')
      35 |     expect(inputElement).toBeChecked()
      36 |   })

raducristianpopa avatar Jan 19 '24 05:01 raducristianpopa

@devcer thanks for raising this 👍 I've noticed the test error too and added a default value in the props here

ionutanin avatar Feb 19 '24 18:02 ionutanin