preact-render-to-string
preact-render-to-string copied to clipboard
Add support for mixed rendering
Mixed rendering is a mode that works like shallow rendering, but where you can specify a list of components you want to render even tho they are deeply nested.
We have a use case where we are using shallow rendering and Cheerio for unit testing our Preact components. We are using a redux-connect like higher order component to connect some components to our global state. When testing a component, that uses another component that is wrapped in a HOC, the shallow renderer stops at the HOC.
With mixed rendering we can white list components we want to render and test that the wrapped components are used correctly.
@developit I've updated the PR, but kept the unit tests in a separate file. Do you want me to move them as well?
Hi @Saegrov! Sorry for the delay - happy to have the unit tests in their own file. I think this should be good to merge, just need to check the file size.