-
Notifications
You must be signed in to change notification settings - Fork 790
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
React bindings cause errors when unit testing application #2277
Comments
I got the same issue. From the answer, replace/replaceSync is only available in new chrome instance? No clue for now. |
construct-style-sheets-polyfill is the one to help support replace in all modern browsers. Load it by configure |
Thanks @chiyema - I will give it a go and let you know how we get on. |
The overall problem for 2 is: Stencil does check for support of CSSStyleSheet via "supportsConstructibleStylesheets"-check, but does not consider there are browsers around that do support it without implementing the replace-method. I attached a PR for that. |
Fixed in #2773. This will be available in the next Stencil release. Thanks for the PR, @MBlanquett! 🙌 |
Thanks all! |
Stencil version:
I'm submitting a:
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/
Current behavior:
We are trying to run unit tests in a React app that uses Stencil React bindings.
Example tests (using
@testing-library/react
):Note: MyComponentWrapper wraps a Stencil react component so we are not testing the component directly
Expected behavior:
All tests pass.
Steps to reproduce:
I have created a repo that shows this issue.
https://github.com/TomHancock2/stenciljs-react-bindings
Master branch does not have JSDOM Sixteeen.
I have created a separate branch which has JSDOM Sixteen set as the environment - https://github.com/TomHancock2/stenciljs-react-bindings/tree/fix/jsdom-sixteen
yarn install
yarn test
(in root or inpackages/my-app
) - if you are on the JSDOM Sixteen branch please run multiple times to see it fail.Related code:
Repo above has code examples
Other information:
The text was updated successfully, but these errors were encountered: