-
-
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
Mixed-depth shallow rendering mode #250
Comments
Wouldn't this end up being more like It seems closer to a partial mount to me, than a shallow render, but maybe I'm missing some of the semantic differences. |
@ljharb mount indicates that it will actually mount onto a root DOM node. |
hm, ok - so then If so then this new thing maybe should be a new top-level thing - that mount calls into? |
@ljharb i'm not sure that's a good way to describe mount. Because this method is "opt in"... ie, you have to provide all of the components you want the renderer to expand, I think having this on |
I like that this solution allows the user to specify which components should be shallow rendered in the subtree (compared to #249), which is useful for keeping the spec more isolate. However, #249 has the advantage that it will work for un-exported components in the root component's subtree, as are often used with stateless functional components. This will require that we export anything we want to |
@sjdemartini that is true. You could similarly provide a |
Nice, yeah, a |
I've made PR to React to support similar functionality in Shallow Renderer itself: But Facebook doesn't seem to be interested. Another problem is that original shallow renderer doesn't support functional components (primitives) because it doesnt have to - to test primitives call it and check output is enough. The good idea would be build own shallow renderer outside react. I think it is possible but I React doesnt expose all internals (like Package could contain react codebase which is not desirable. React should stay as peer dependency. So... We'd need to build our own shallow renderer. It is possible but really hard to accomplish. Any ideas? Maybe we can convince React team to merge my PR? Or provide another way to partial deep render? |
We could implement an option
expand
toshallow
that allowed you to specify components that you'd like to "expand" the shallow render tree into, while all other components are considered leaf nodes.would output something like this:
The text was updated successfully, but these errors were encountered: