KDS to Studio: Use KModal in policy modals#3127
Merged
MisRob merged 12 commits intolearningequality:unstablefrom May 17, 2021
Merged
KDS to Studio: Use KModal in policy modals#3127MisRob merged 12 commits intolearningequality:unstablefrom
MisRob merged 12 commits intolearningequality:unstablefrom
Conversation
- get rid of `[vuex] unknown mutation type: policies/SET_POLICIES` error by importing the whole policies module and then overriding only values that are needed for a test - remove tests that were prone to giving false positives and weren't testing responsibilities of PolicyModals component
a744954 to
dcc4ca5
Compare
- user props and events in simpler modal components (PoliciesModal, TermsOfServiceModal, PrivacyPolicyModal, CommunityStandardsModal) to decouple them from store to make logic simpler and easier to test - related tests simplifications of PoliciesModal - related updates of store and PolicyModals component that is now the only controller component encapsulating all Vuex logic - some more tests for PoliciesModal nad PolicyModals
ebe86ed to
5d0a20f
Compare
- export getters, mutations, and actions to allow testing them directly instead of the need to initialize the whole store, similarly to how we test getters etc. of our other store modules (this has also allowed deletion of mocks that are not related to this test suite) - use hardcoded sample data in tests to improve clarity and make orientation in tests faster when reading them as documentation - add more documentation strings to store functions - move the test for updating `window.user` object to plugin.spec.js to make sure that `window.user` will be updated every time `setPolicies` mutation is called, and not only when `setPolicies` is called from `acceptPolicy` action
5d0a20f to
6a232af
Compare
f5f8b57 to
626ccb8
Compare
`KModal`'s content slot is already wrapped in form => leaving `VForm` here would result in nested forms, which is not supported and could result in bugs (see https://stackoverflow.com/questions/379610/can-you-nest-html-forms). - remove `VForm` - replace `Checkbox` with `KCheckbox` (related to `VForm` deletion in terms of validation logic) - update validation logic to resemble `VForm`'s behaviour but to work with `KCheckbox` and native `<form>` in `KModal`
626ccb8 to
6ae90c7
Compare
Because `PolicyModals` was in both `UsingStudio` and `SettingsIndex` components, it was open two times which also caused a focus bug. This removes `PolicyModals` component from `UsingStudio` and leaves it only in `SettingsIndex`.
marcellamaki
approved these changes
May 17, 2021
Member
marcellamaki
left a comment
There was a problem hiding this comment.
This looks great! Thank you (as always) for such a thorough PR write up 😄
Contributor
Contributor
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
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.


Summary
Description of the change(s) you made
Use
KModalin policy modals - Terms of Service, Privacy Policy, and Community Standards. It also contains simplifications of policies store tests and updates to policies modal components architecture that have made KDS refactor and updating/adding tests easier. See commit messages for detailed explanations.Manual verification steps performed
Preview policies on login page
Preview policies on registration page
Accept a policy after a policy update
Preview policies in "About Studio" tab in "Settings"
Important modals interactions
Screenshots
Does this introduce any tech-debt items?
It rather reduces it.
One thing to discuss is whether we want to support error state for
KCheckbox(see the "Error" before/after screenshots) toKCheckboxcomponent (it is implemented outside of it in this PR)I haven't seen many similar use cases though so maybe there won't be any further updates needed. I'd like to discuss this with KDS team and also chat about better error message instead of generic "Field is required" (e.g "You need to agree to Terms and Conditions") on that opportunity. If there are some updates needed, I will open follow-up KDS/Studio issues.
Reviewer guidance
How can a reviewer test these changes?
Please follow "Manual verification steps"
Are there any risky areas that deserve extra testing?
Policies are important part of the app and during components architecture simplifications I updated core parts of policies logic so please follow test steps thouroughly, especially "Accept a policy after a policy update"
References
Closes learningequality/kolibri-design-system#157
Closes learningequality/kolibri-design-system#159
Comments
I've added "user strings" tag. Although there are no new strings introduced, I moved some between components which will change their namespace and might require @radinamatic's approval on Crowdin.
Contributor's Checklist
PR process:
CHANGELOGlabel been added to this PR. Note: items with this label will be added to the CHANGELOG at a later timedocslabel has been added if this introduces a change that needs to be updated in the user docs?requirements.txtfiles also included in this PRStudio-specifc:
notranslateclass been added to elements that shouldn't be translated by Google Chrome's automatic translation feature (e.g. icons, user-generated text)pages,components, andlayoutsdirectories as described in the docsTesting:
Reviewer's Checklist
This section is for reviewers to fill out.
yarnandpip)