-
Notifications
You must be signed in to change notification settings - Fork 405
toHaveStyle() doesn't behave as expected #281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
In your case, you're not setting the unit of measurement for |
@nersoh Thanks, I didn't realize that units must be specified. Could the error message give that hint? How about In 5.11.0, it failed with:
In 5.11.1, it fails with:
|
This is a regression in 5.11.1. Numbers were accepted and interpreted as px before this release. |
Seems another unwanted consequence of #276. We should've had tests for this feature of accepting numbers so that regressions wouldn't occur. #280 is another regression for which we also did not have tests. I may work on fixing both soon if no one beats me to it. For the moment you can fix your version to v5.11.0. |
Great catch, everyone. That's an opportunity to improve the tests 😃 |
🎉 This issue has been resolved in version 5.11.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
@gnapse @luanraithz It still doesn't work for me :( Example of failing test:
Failure
|
For reference to whoever lands here, the problem reported in the previous comment was opened as an issue (see #288). |
The following test fails with:
Am I using
toHaveStyle()
the wrong way, or is this a bug?The error message is also pretty confusing 😕
CodeSandbox
@testing-library/jest-dom
version: 5.11.1node
version: 12.6.0npm
version: 6.14.6react-testing-library
version: 10.4.7The text was updated successfully, but these errors were encountered: