Skip to content
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

Text Field fails on Jest snapshot test, with error Cannot read property 'scrollHeight' of null #5531

Closed
tomrbowden opened this issue Nov 10, 2016 · 3 comments
Labels
component: text field This is the name of the generic UI component, not the React module!

Comments

@tomrbowden
Copy link

tomrbowden commented Nov 10, 2016

Text Field fails on Jest snapshot test, with error Cannot read property 'scrollHeight' of null

Link to test project on Github

Versions

  • Material-UI: 0.16.1
  • React: 15.3.2
  • Browser: Jest 16.0.2

Comment

I am trying to render a Jest snapshot of a component that includes a Material UI Text Field, and I encountered this error. I've included a link above to a repo which reproduces this problem. Any help you could provide is greatly appreciated. Thank you.

@lucasbento lucasbento added bug 🐛 Something doesn't work component: text field This is the name of the generic UI component, not the React module! labels Nov 10, 2016
@lucasbento
Copy link

Hey @tomrbowden, thanks for opening an issue about this.

This is actually not a problem with Jest nor Material UI itself, if you check the code on EnhancedTextarea.js you will see that it uses ref, which is not possible to render through react-test-renderer.

This detailed issue comment explains what is happening and a possible workaround for it, I guess it will also be fixed on React 0.14.

@lucasbento lucasbento added waiting for 👍 Waiting for upvotes and removed bug 🐛 Something doesn't work labels Nov 10, 2016
@tomrbowden
Copy link
Author

@lucasbento Thanks very much for the feedback and potential workarounds. It may be best for me to wait for React 0.14 to be released.

@lucasbento lucasbento removed the waiting for 👍 Waiting for upvotes label Nov 11, 2016
@lucasbento
Copy link

@tomrbowden: awesome, let me know how that worked out.

I'll close this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: text field This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

2 participants