Skip to content
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

test(ui): Vendor react-select-event, use user events #66441

Merged
merged 4 commits into from Mar 6, 2024

Conversation

scttcper
Copy link
Member

@scttcper scttcper commented Mar 6, 2024

Instead of using the library react-select-event this adds the one file and switches it from fireEvent to userEvent. User Event properly wraps each event in act which prevents act warnings in react 18.

Changes:

  • openMenu is now async because userEvent.click is async
  • Tests that did selectEvent.openMenu and then selectEvent.select were switched to just selectEvent.openMenu and userEvent.click since select tries to click the dropdown button again which means it's closed. Somehow it was fast enough before to select something before the menu closed?

part of https://github.com/getsentry/frontend-tsc/issues/22

Instead of using the library [react-select-event](https://github.com/lokalise/react-select-event) this adds the one file and switches it from fireEvent to userEvent. User Event properly awaits and wraps events in `act` to prevent act warnings with react 18.

Changes:
- `openMenu` is now async because `userEvent.click` is async
- Tests that did `selectEvent.openMenu` and then `selectEvent.select` were switched to just `selectEvent.openMenu` and `userEvent.click` since select tries to click the dropdown button again which means it's closed. Somehow it was fast enough before to select something before the menu closed?

part of getsentry/frontend-tsc#22
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 6, 2024
@@ -0,0 +1,184 @@
// From https://github.com/romgain/react-select-event
//
// Copyright 2019 Romain Bertrand
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scttcper scttcper marked this pull request as ready for review March 6, 2024 19:52
@scttcper scttcper requested review from a team as code owners March 6, 2024 19:52
@scttcper scttcper requested a review from a team March 6, 2024 19:52
@scttcper scttcper requested review from a team as code owners March 6, 2024 19:52
@scttcper scttcper requested a review from a team March 6, 2024 19:52
@scttcper scttcper merged commit d7c5ffc into master Mar 6, 2024
39 checks passed
@scttcper scttcper deleted the scttcper/test-select-events branch March 6, 2024 23:02
@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants