-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Material-ui FloatingActionButton simulate click doesn't call onClick method #780
Comments
If you want to test In other words, I think you're trying to test too much in one file. |
I am sorry I didn't explain. FloatingActionButton, TexField are material-ui component. The only component I try to test is InputLocker. The TestComponent is just a wrapper to be able to render the TextField as InputLocker's child.
Thank you again. |
You don't need to test material-ui's components, that's material-ui's job. All you need to test is that you're rendering its components with the correct props. |
The props are definitely correct as long as rendered in the browser the component works perfect. |
So, for everyone having problems with enzyme's simulate method on material-ui FloatingActionButtons components: simulate('click') does not work probably because the component is wrapped in a div which doesn't respond to an onClick event. |
I was able to simulate on click on a material-ui component using the following code. I hope it can help others.
|
I admit testing material-ui is a headache generator.
The code is the same from #778 with shallow changed to mount.
The test is:
I checked and the onClick method of the FloatingActionButton is never called.
Thank you for your time
The text was updated successfully, but these errors were encountered: