-
Notifications
You must be signed in to change notification settings - Fork 49
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
Testing with Jest & testing-library GBI with Styled-Components: Cannot read property 'cssRules' of null #120
Comments
Hi @wesleylhandy, gonna look into it as soon as can, but am quite booked right now : /. Best, Tim. |
Hi @wesleylhandy, it would be much easier (and faster) for me to help you with a minimal reproduction repo (or at least a complete js file + according test file)... The second edit about styled being overwritten I can't really grok, as Will happily help should you be able to provide a reproduction case : )! Best, Tim. |
Addendum: Best, Tim. |
@timhagn Sorry it took me so long to respond. Too many projects at the same time. I recreated the warning I'm getting, but I'm not able to consistently reproduce the issue that I feel stuck! Here is a repo with code https://github.com/wesleylhandy/gbitest yarn test:product |
No problem, as I have the same "problem" ; ). Thanks a lot for the reproduction-repo, gonna try investigating it this weekend - already have a hunch what I have to change to prevent both cases from happening. Best, Tim. |
Hi there! |
Hi @wesleylhandy, took way longer until I came around taking a look and fixing this - what it now should be with the just published Alas, hope this fix is still relevant, just wanted to do at least something on the package again % ). Best, Tim. P.S.: Should it solve your issue, feel free to close this one - else I'm gonna do it in a few weeks at the latest : ). |
Thanks @timhagn for coming back to this. It seems the upgrade to |
Hi @wesleylhandy, no prob, this was a bug & I finally found the time to fix it, so no worries ; ). Best, Tim. |
Description
I'm writing tests for a client's
Gatsby
project. The site is already live, I have been hired to write tests. Within some components, I have been able to successfully test components that use GBI by mockinguuid
as proscribed in the documentation. However, within one component, they style GBI withstyled-components
(again using the method proscribed in documentation), but when I run tests for the component, I get an errorError: Uncaught [TypeError: Cannot read property 'cssRules' of null]
Steps to reproduce
index.js
index.test.js
Expected result
Tests should run without Error
Actual result
Environment
EDIT
I upgraded GBI to
^1.1.1
, and get a different error:SECOND EDIT
I reverted back to client's original version and made the following updates, which fixed the errors.
However, I noticed the
background-position
was being overwritten by inline styles that must be defaults coming from the component.THIRD EDIT
The console warning has returned inexplicably:
The text was updated successfully, but these errors were encountered: