-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Dialog][Enzyme] mount not render inner components, stops on <RenderToLayer /> #6290
Comments
👍 I'm also experiencing this issue. For some reason it looks like the Dialog body/children is being passed in a wrapped function as I'm guessing this RenderToLayer component is to make it lazily render the child components or something? If it's necessary for performance then it'd be nice to have |
I checked out in I wonder if there is any way (even via javascript API like |
I had to attach the component to a DOM element (via |
Thanks for sharing your workaround @aryo 😄 Perhaps a good solution for this would be to add an option to (the props of?) the |
Is there any way to test this in v1.0.0? |
I got it working using shallow rendering and then using |
Closing this issue for #7970 |
@monkeybeans How you did it using dive? Can you give us an example? |
@talmukund was some time ago, but i think this should work :)
|
@monkeybeans problem with dialog component is that actions are defined inside props like: Above dom implementation may work but we are using typescript which is not supporting react test utils. We have to use enzyme only. |
Not sure if that's exactly what is the problem here, but I've had similar problem and this worked: import { DialogActions, Button } from 'material-ui';
/* Component has a <Dialog /> with a set of action buttons defined inside as children */
const component = shallow(<Component />);
const dialogActions = component.find(DialogActions);
const okButton = [ ...dialogActions.find(Button) ].find(e => e.props.raised);
const actionFunction = okButton.props.onClick;
/* ... */ |
Problem description
I created component with
<Dialog />
and I want to test it withenzyme
, but when Imount
component (with muiTheme context) I can't find inner components (action buttons etc.).console.log with
wrapper.debug()
shows:when original component is:
So it looks like it stops on
RenderToLayer
and not render anything deeper (especially not render action buttons). I tried to mount it with this helpers described here: #4664 but it didn't help.Versions
The text was updated successfully, but these errors were encountered: