-
Notifications
You must be signed in to change notification settings - Fork 4k
Widget test cleanup #3286
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
Merged
tconkling
merged 12 commits into
streamlit:develop
from
tconkling:tim/WidgetTestCleanup
May 19, 2021
Merged
Widget test cleanup #3286
tconkling
merged 12 commits into
streamlit:develop
from
tconkling:tim/WidgetTestCleanup
May 19, 2021
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kantuni
approved these changes
May 19, 2021
Collaborator
kantuni
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.
👍
tconkling
added a commit
to tconkling/streamlit
that referenced
this pull request
May 19, 2021
* develop: Widget test cleanup (streamlit#3286) pin click to < 8.0 (streamlit#3256) Up version to 0.82.0 Update change log
tconkling
added a commit
that referenced
this pull request
May 24, 2021
Implements `clear_on_submit`, a new optional parameter for st.form. When a form has this flag, it means that the frontend "resets" all the form's widgets when the form is submitted. CustomComponents are _not_ currently affected by this flag (this is by design - properly handling this would require a CustomComponents API update, and all widget-like components in the wild would need updating. So we're punting on it for now). - `FormsManager` is now folded into `WidgetStateManager`. - When a form is submitted, `WidgetStateManager` emits a signal. All widgets in the form respond to this signal by resetting their values locally and committing those values back to the WidgetStateManager. - This resetting only happens on the frontend - the server doesn't know that values have been reset (this is by design). - `FormClearHelper` is a utility class that implements a `useEffect`-like pattern for subscribing to the `formCleared` events. (None of our widgets are currently implemented using React hooks, so this is a workaround for easily and correctly composing that behavior into each widget.) - Each widget has a new test for `clearOnSubmit` behavior. - `st.form_submit_button` now takes an optional "help" parameter. (Contains changes from #3286, which should be reviewed first)
tconkling
added a commit
to tconkling/streamlit
that referenced
this pull request
May 25, 2021
# By Ken McGrady (19) and others # Via GitHub (9) and others * develop: (96 commits) st.form: clear_on_submit (streamlit#3287) Init test variables in beforeEach Init test variables in beforeEach Add database tutorials to docs (streamlit#3272) update contact email to support (streamlit#3282) Better typing Remove dummy script Add testing and some comments Fix the bug, don't love the solution Improve test name Add script for testing Fix test after merge Make sure selected options aren't visible in the dropdown Widget test cleanup (streamlit#3286) Add test for the fuzzy filter Import filter function from another component Remove tag from PR template (streamlit#3284) Add test req version bound for TF to fix tests (streamlit#3266) pin click to < 8.0 (streamlit#3256) Up version to 0.82.0 ... # Conflicts: # frontend/src/components/shared/Dropdown/Selectbox.test.tsx
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Lots of drive-by cleanup on all our widget tests, in preparation for the incoming "clear-on-submit" forms PR.
it("renders a label"), instead ofit("should render a label"))propsandwrapperinstances outside of global scope, and into individual test scopesjest.spyOnon the single WidgetStateManager function each widget uses