-
-
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
how to select root DOM element rendered with mount
#446
Comments
Are you looking for |
@finaiized thanks! but no, I want the root DOM element that was rendered |
mount
mount
Wouldn't you just query for it like anything else since wrappers are just a HOC? So if your component renders a I don't really see the need for a separate method for getting that. |
if you have a component that conditionally renders either a |
feels moot. If it conditionally renders that. You are going to know what condition triggers which, and test for both of those. And if that is the only use case I don't see the benefit of an API here still, seems too one-off. |
another problem is that by selecting all |
Pretty sure. Can't see any reason why it wouldn't be? Worth some investigation. But I think so. |
yep, from looking at https://github.com/airbnb/enzyme/blob/master/src/MountedTraversal.js#L245 it does look like the array of nodes outputted by |
With this example:
How do I select the root rendered node of a
mount
wrapper? Note I'm not asking about how to select the div in this particular example (eg..find('div')
,.find({className: 'foo'})
. I want to select the root rendered node of this wrapper so that I can assert something about it, so I can't select by the type nor by its props.@aweary this is kind of related to the issue you just posted #445 because basically what I'm asking is, when using
mount
, how do I select the node thatshallow
always returnsThe text was updated successfully, but these errors were encountered: