testing-library / jest-dom

:owl: Custom jest matchers to test the state of the DOM
https://testing-library.com/docs/ecosystem-jest-dom
MIT License
4.45k stars 401 forks source link

.toHaveAttribute('disabled') and .toBeDisabled() #560

Closed haroldmud closed 11 months ago

haroldmud commented 11 months ago

Discussed in https://github.com/testing-library/jest-dom/discussions/325

Originally posted by **StefanZivkovic** December 30, 2020 I am using Button from @material-ui/core, and my test have different output depending of which assert method I use. Initially button is disabled when page loads, and in snapshot there is confirmation about it. ```
gnapse commented 11 months ago

Mostly i am confused with last output, because disable="" even though it is disabled (i would expect to have value of true).

The answer is already in the very discussion thread that you linked to: https://github.com/testing-library/jest-dom/discussions/325

Check in particular this comment. Please, continue the discussion over there if you have any more questions.