Skip to content

🐛Passing options to a PointerEvent through createEvent doesn't work #558

@dbismut

Description

@dbismut

Hey, I'm maintaining react-use-gesture and heavily rely on testing-library for tests (thanks so much btw).

I'm planning to move to PointerEvent instead of a mix of TouchEvent and MouseEvent for our drag recognizer. Our set of tests implies creating events that simulate pointer coordinates in the form of { clientX: number, clientY: number }.

  • DOM Testing Library version: 7.5.1 (from yarn.lock, I'm using @testing-library/react)
  • node version: 12.16.1
  • yarn version: 1.22.4

Relevant code or config:

// this works
const event = createEvent.mouseMove(element, { clientX: 30, clientY: 80 })
console.log(event.clientX) // <-- prints 30

// this doesn't work
const event = createEvent.pointerMove(element, { clientX: 30, clientY: 80 })
console.log(event.clientX) // <-- prints undefined

I'll link to a repro as soon as codesandbox works properly.

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