-
Notifications
You must be signed in to change notification settings - Fork 651
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
TypeError: element.setAttribute is not a function The above error occurred in the <Transition> component #436
Comments
got the same thing, on first trying a link, works after a reload... "apollo-boost": "^0.1.23", |
What does your test look like? I can't seem to find it in the CodeSandbox example. |
Not sure if it's helpful, but I had the same error and was able to fix it by mocking |
Any test examples where this error pops up? |
a wrapper div around the component helped. |
The problem seems to stem from using the deprecated |
In case anyone else hits the issue and wants a workaround, like those above I mocked out part of the library by adding the following to my Jest setup file:
Love to know what others did. |
@alicederyn I'm missing a reproducible example. The codesandbox in the initial post does not include any tests (among other issues like mismatching versions between post and package.json). I'm not familiar with ReactTestRenderer so without code I could only guess. |
@alicederyn your suggestion works but I am getting the following warning Warning: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it. |
@timurcatakli @alicederyn Any updates about this warning? How to remove this warning? |
I could fix this warning by calling |
Do you want to request a feature or report a bug?
Report a bug
What is the current behavior?
Jest tests failing with react-transition-group.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React.
Here's a minimal demo of my code: https://codesandbox.io/s/4RAqrkRkn
Everything runs fine in the browser, but when running my Jest tests, I get the above error.
What is the expected behavior?
Getting a node similar to the following. This comes from another test for a component which users Router, but not react-transition-group.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
"react": "^16.5.2",
"react-dom": "^16.5.2",
"react-transition-group": "2.5.1",
"@types/react-transition-group": "^2.0.14",
The text was updated successfully, but these errors were encountered: