Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support React Native events in prefer-user-event #957

Open
Labels
enhancementNew feature or request
@ddrozdov

Description

What rule do you want to change?

prefer-user-event

Does this change cause the rule to produce more or fewer warnings?

More warnings

How will the change be implemented?

Add more fireEvent -> userEvent mappings.

React Native Testing Library has its own fireEvent function and the same idea of proposing to use userEvent if possible.

According to the docs, it's recommended to use:

  • User Event press instead of fireEvent.press
  • User Event type instead of fireEvent.changeText
  • User Event scrollTo instead of fireEvent.scroll

Example code

fireEvent.press(screen.getByText('Press me'))

How does the current rule affect the code?

It doesn't suggest any changes to fireEvent calls for React Native projects.

How will the new rule affect the code?

It'll suggest to use User Event as per the docs.

Anything else?

No response

Do you want to submit a pull request to change the rule?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    Projects

    Status

    Backlog

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /