-
-
Notifications
You must be signed in to change notification settings - Fork 145
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
toHaveStyleRule with @media rule breaks after styled-components update #430
Comments
Removing the whitespace from the ast rule as well should be a simple and backwards compatible change:
|
If someone else encounters the same problem before this issue is closed a simple workaround is to add a second whitespace as in this example:
Note the two whitespaces in |
You saved my life, I'm about 2 days trying to fix that issue. |
@hemerson-git I'm glad this was helpful 🙂 |
Is there a plan to fix this in the package? In my case, media query strings are stored in a theme with a single whitespace after the colon, so this is a pain to manipulate the string every time I run a test like this. |
Same problem here.
This helped so much broh! Thank you! |
We recently updated styled-components to v6 and something caused some of our tests to fail. I was able to reproduce the issue in this repository (you can also run it here on Replit). Here's the example test:
This is the error I'm getting:
The problem seems to be that this check in toHaveStyleRule
rule[option] === options[option].replace(/:\s/g, ":")
is not working anymore.Before
rule.option
didn't have a whitespace. I'm not sure what changed but now it looks like this:I'm happy to create a PR but as I said, I'm not sure what the original cause of the whitespace not being removed is.
Edit: To run the tests in the Replit simply run
npm run test
.The text was updated successfully, but these errors were encountered: