Skip to content

prefer-user-event should consider the use case where fireEvent is used as a function #261

Closed
@gndelia

Description

@gndelia

In addition to the method events like fireEvent.click, it is also possible to create custom events objects and use fireEvent as a function, as the documentation for fireEvent shows

// form 1
const myEvent = createEvent.click(node)
fireEvent(node, myEvent)

// form 2
fireEvent(
  input,
  createEvent('click', input)
)

The rule should recommend to use userEvent.click()

the rule should consider this form too

Note: This rule has been migrated in the v4 branch, so anyone taking this issue should do so starting from branch v4 (And targeting it as well)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions