-
Notifications
You must be signed in to change notification settings - Fork 47.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
shallow rendering / testing components with 'render callbacks' #4127
Comments
The way that we are handling it is to avoid render callbacks entirely and just use |
This doesn't work because after one shallow render, the rendered output is
and if that were rendered, you'd get
(At no point would you have You could try
and verify that Let me know if that doesn't make sense. |
Hi @spicyj, thanks for the response. That would 'work', but it would still require manually doing so for each case. I was hoping for some help in writing a somewhat-shallow renderer that could 'recognize' when a rendered child has a render-callback, and just render 'through'. I started with a naive implementation that just swapped in .children on these element, but it did't work. I'll investigate more, thank you for your time. |
based on this comment and this thread, starting this thread to discuss how to test components with 'render callbacks'.
Consider the following 'app'.
Now, if we wanted to test this, we could write something like -
However, we can't test beyond the callback boundary with
ReactShallowRenderer
.Unclear how to approach this, frankly. Should ShallowRenderer 'recognize' components like this? Or should they be marked with a flag? (this.rendersCallback = true ?). The only workaround for now is to not use the ShallowRenderer :(
/cc @pspeter3
The text was updated successfully, but these errors were encountered: