-
Notifications
You must be signed in to change notification settings - Fork 4k
[chore] Modernize SettingsDialog #9684
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
Conversation
a6f9b92 to
45b1a3e
Compare
45b1a3e to
17c192f
Compare
lukasmasuch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
| expect(screen.getByText("Run on save")).toBeInTheDocument() | ||
|
|
||
| screen.getByText("Run on save").click() | ||
| await user.click(screen.getByText("Run on save")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious question: what is the benefit of user.click() vs screen.getByText("Run on save").click()? From reading the docs, it sounds like that user-events is a more realistic simulation of user events. It might be good to start a list of tips & tricks in our wiki related to writing RTL tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct, user-event is more realistic to how a user interacts with the application. Generally speaking I prefer to lean on automated enforcement rather than documentation, so in that spirit, I have a follow-up PR that enforces user-event via eslint here
## Describe your changes - Based on some feedback in #9684 this PR introduces a new lint rule for RTL, encouraging usage of user-event. - user-events gives us greater confidence in the way we write tests because "fireEvent dispatches DOM events, whereas user-event simulates full interactions, which may fire multiple events and do additional checks along the way." [[docs](https://testing-library.com/docs/user-event/intro/)] - This PR adds inline disable comments to any usages that are currently in violation, so there should be no changes to code as written today. ## GitHub Issue Link (if applicable) ## Testing Plan - Explanation of why no additional tests are needed - Unit Tests (JS and/or Python) ✅ - E2E Tests - Any manual testing needed? --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
## Describe your changes - Modernizes `SettingsDialog` and its tests - There should be no functional changes, just a refactor onto modern React patterns ## GitHub Issue Link (if applicable) ## Testing Plan - Explanation of why no additional tests are needed - Unit Tests (JS and/or Python) - E2E Tests - Any manual testing needed? --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
## Describe your changes - Based on some feedback in streamlit#9684 this PR introduces a new lint rule for RTL, encouraging usage of user-event. - user-events gives us greater confidence in the way we write tests because "fireEvent dispatches DOM events, whereas user-event simulates full interactions, which may fire multiple events and do additional checks along the way." [[docs](https://testing-library.com/docs/user-event/intro/)] - This PR adds inline disable comments to any usages that are currently in violation, so there should be no changes to code as written today. ## GitHub Issue Link (if applicable) ## Testing Plan - Explanation of why no additional tests are needed - Unit Tests (JS and/or Python) ✅ - E2E Tests - Any manual testing needed? --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
Describe your changes
SettingsDialogand its testsGitHub Issue Link (if applicable)
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.