Skip to content

Show a friendly error when using TestUtils.Simulate with shallow rendering #5284

@StevenLangbroek

Description

@StevenLangbroek

I'm doing a simple shallow render on a component which has a button (<a>) with an onClick handler. I can correctly assert most of its properties, but I can't get asserting whether the button has been clicked (by using TestUtils.Simulate.click(output.props.children[1]) and a sinon.spy() passed in as handler) to work. TestUtils doesn't throw any Invariant Violation or whatever other error, the spy just never gets called. When I manually call it through this.props.children[1].props.onClick() it works. Is this expected behavior?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions