Skip to content

Child context for shallow rendering API #567

@DullReferenceException

Description

@DullReferenceException

When testing our HOC-wrapped components, we often use the pattern of shallow-rendering one more level deep:

class MainComponent { /*...*/ };
export default connect(/*...*/)(MainComponent);
const tree = shallow(<WrappedComponent/>, { context }).shallow();

The problem is that the child context is not being propagated, so when the inner component is rendered, its context is missing.

I see that a childContextTypes option was provided when doing a full render here: #171, but shouldn't we have the same thing for shallow rendering?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions