Skip to content

fireEvent missing documentation and requires unnecessary element reference #153

@jakst

Description

@jakst
  • dom-testing-library version: 3.12.0 (RTL 5.1.0)
  • react version: 16.7.0
  • node version: -
  • npm (or yarn) version: yarn 1.12.1

Problem description:

Events like fireEvent.keyDown don't have any documentation.

The obvious way (for me at least) to fire these events would be fireEvent.keyDown('Enter'), but through looking at the code I found out that you have to do fireEvent.keyDown(someElement, { key: 'Enter' }), where someElement can be any element on the page, and is therefore very unintuitive. Key events really have no connection to an element.

Could this be, if not changed, at least clarified in documentation here and in react-testing-library?

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