Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gndelia opened this issue Nov 26, 2020 · 6 comments · Fixed by #398
Closed
Assignees
Labels
enhancement New feature or request released

Comments

@gndelia
Copy link
Collaborator

gndelia commented Nov 26, 2020

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)

@gndelia gndelia added the enhancement New feature or request label Nov 26, 2020
@Belco90
Copy link
Member

Belco90 commented Dec 8, 2020

This one must wait until v4 is released.

@stale
Copy link

stale bot commented Apr 11, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Apr 11, 2021
@gndelia
Copy link
Collaborator Author

gndelia commented Apr 12, 2021

now that v4 is released, we can tackle this one. I think I can tackle it the next week, so if no one takes it during that time, I might do so

@stale stale bot removed the wontfix This will not be worked on label Apr 12, 2021
@stale
Copy link

stale bot commented Jun 11, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Jun 11, 2021
@MichaelDeBoey MichaelDeBoey removed the wontfix This will not be worked on label Jun 11, 2021
@gndelia
Copy link
Collaborator Author

gndelia commented Jun 12, 2021

I'm taking this one so stale bot doesn't close it 😆 I'll tackle it during the week

@gndelia gndelia self-assigned this Jun 12, 2021
Belco90 pushed a commit that referenced this issue Jul 4, 2021
* feat: add support for fireEvent as function in prefer-user-event

* refactor: use getDeepestIdentifierNode to detect in isCreateEventUtil

Co-authored-by: Mario Beltrán Alarcón <[email protected]>

Closes #261
@github-actions
Copy link

github-actions bot commented Jul 4, 2021

🎉 This issue has been resolved in version 4.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
3 participants