-
Notifications
You must be signed in to change notification settings - Fork 46k
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
ReactTestRenderer custom depth rendering #7612
Comments
For reference, this change would not affect Enzyme's API as it does not rely on |
How about using This is the key functionality, in this case, mocking an jest.mock('react-select', () => {
const { createElement } = require('react')
const ReactSelect = require.requireActual('react-select')
const MockedAsync = props => createElement('Async', props)
MockedAsync.propTypes = ReactSelect.Async.propTypes
MockedAsync.defaultProps = ReactSelect.Async.defaultProps
ReactSelect.Async = MockedAsync
return ReactSelect
}) It seems like that sort of mocking could be wrapped up into a function and library so it doesn't get too repetitive. |
FWIW, |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you! |
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
This renders whole tree of DOM which is actually expected behaviour. The problem is, that I dont want render
ThirdPartyComponent
, onlyMyInternalComponent
. Shallow renderer isnt answer because shallow would not renderMyInternalComponent
at all. Which is problem because it's hard to divide component into smaller, internal chunks.I have done some work in order to achieve this in #5513. It was fully working patch. It was done as part of ShallowRenderer but now we have TestRenderer. Besides this patch is pretty old so resolving conflicts would be very hard.
What is the expected behavior?
I would love to provide "blacklist" of components which I don't want to render:
This would return jsx:
So we can test props returned for
ThirdPartyComponent
and internal logic.It's combine of full and shallow renderer.
I have some ideas of implementation but i dont want waste my time writing code which won't be marged into master anyway.
This possibly would allow to resolve enzymejs/enzyme#250.
The text was updated successfully, but these errors were encountered: