Skip to content

[userEvent/fireEvent]: fireEvent docs say to use userEvent, but all React code samples use fireEvent #963

@greyscaled

Description

@greyscaled

Description:

Hey there 👋 - our team is newer to testing-library/react, and just had a bit of confusion in PR review whereby we went back and forth on whether to use fireEvent or userEvent.

All of the code examples in the react documentation:

https://testing-library.com/docs/react-testing-library/example-intro

https://testing-library.com/docs/react-testing-library/api/#asfragment

https://testing-library.com/docs/react-testing-library/cheatsheet/

use fireEvent, but then my colleague saw this:

firing-events

from the core API https://testing-library.com/docs/dom-testing-library/api-events

We're wondering if maybe some of the code examples in the React documentation should use userEvent, given that the API docs for fireEvent give an impression that userEvent is more useful in most projects.

Thanks!

To Reproduce:

  1. Observe all code samples in https://testing-library.com/docs/react-testing-library/intro use fireEvent
  2. Observe fireEvent API documentation recommends userEvent

Expected behavior:

The userEvent API is present in React code samples

Screenshots:

N/A

Desktop:

N/A

Smartphone:

N/A

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