Skip to content

Can't use MouseEvent properties that aren't supported by jsdom #268

Closed
@julienw

Description

@julienw

I'm migrating our tests from enzyme to react-testing-library and encountered a roadblock. Indeed some of our code relies on the properties offsetX offsetY pageX pageY of a MouseEvent instance. In Enzyme we could simply pass these as part of a simulate call.

But because fireEvent relies on real DOM events, and we rely on jsdom, and jsdom's MouseEvent doesn't support these properties, we can't test this code anymore.

There's an issue for pageX and pageY at jsdom/jsdom#1911, I mentioned the other missing properties there too. But maybe the issue is broader than just for these properties.

What's the best path forward in your opinion? Is it the best path to add the support to jsdom, or can we somehow pass the direct values to React's event subsystem?

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