Repository navigation
[Remove Vuetify from Studio] Replace CountryField VAutocomplete with KDS KMultiSelect #6293
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
akolson
merged 4 commits into
learningequality:unstable
from
LightCreator1007:replace-countryfield-kmultiselect
Nov 3, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
03b1a94
Replace CountryField VAutocomplete with KDS KMultiSelect
LightCreator1007 9da4b59
Fill the account form inline in the re-enabled create tests
LightCreator1007 6b77938
Address review feedback on CountryField tests and strings
LightCreator1007 c3865e3
Validate CountryField via validate() and tighten tests
LightCreator1007 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,16 @@ import Vuex from 'vuex'; | |
| import { render, screen, waitFor } from '@testing-library/vue'; | ||
| import userEvent from '@testing-library/user-event'; | ||
| import Create from '../Create'; | ||
| import CountryField from 'shared/views/form/CountryField'; | ||
| import { createTranslator } from 'shared/i18n'; | ||
|
|
||
| const { sourcePlaceholder$, websiteSourceOption$, registrationFailedOffline$ } = createTranslator( | ||
| 'Create', | ||
| Create.$trs, | ||
| ); | ||
| const { locationLabel$ } = createTranslator('CountryField', CountryField.$trs); | ||
|
|
||
| const KENYA = 'Kenya'; | ||
|
|
||
| const routes = [ | ||
| { path: '/', name: 'Main' }, | ||
|
|
@@ -31,8 +41,19 @@ const makeStore = ({ offline = false } = {}) => | |
| online: !offline, | ||
| }, | ||
| }, | ||
| actions: { | ||
| register: mockRegisterAction, | ||
| modules: { | ||
| account: { | ||
| namespaced: true, | ||
| actions: { | ||
| register: mockRegisterAction, | ||
| }, | ||
| }, | ||
| policies: { | ||
| namespaced: true, | ||
| getters: { | ||
| getPolicyAcceptedData: () => () => ({}), | ||
| }, | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
|
|
@@ -102,20 +123,7 @@ describe('Create account page', () => { | |
| }); | ||
| }); | ||
|
|
||
| // NOTE: | ||
| // Full form submission tests are intentionally skipped here. | ||
| // | ||
| // The "locations" field uses CountryField, which internally uses VAutocomplete | ||
| // (a Vuetify component). VAutocomplete does not reliably update its v-model | ||
| // state when interacted with via Vue Testing Library's userEvent APIs, which | ||
| // prevents a fully user-centric submission flow from being exercised. | ||
| // | ||
| // The "source" field has been migrated to KSelect (KDS) and no longer has | ||
| // this limitation, but "locations" remains the blocker. | ||
| // | ||
| // These tests will be re-enabled once CountryField is migrated away from | ||
| // VAutocomplete as part of the ongoing Vuetify removal effort. | ||
| it.skip('creates an account when the user submits valid information', async () => { | ||
| it('creates an account when the user submits valid information', async () => { | ||
| await renderComponent(); | ||
|
|
||
| await userEvent.type(screen.getByLabelText(/first name/i), 'Test'); | ||
|
|
@@ -126,6 +134,12 @@ describe('Create account page', () => { | |
|
|
||
| await userEvent.click(screen.getByLabelText(/tagging content sources/i)); | ||
|
|
||
| await userEvent.type(screen.getByRole('combobox', { name: locationLabel$() }), KENYA); | ||
| await userEvent.click(await screen.findByRole('option', { name: KENYA })); | ||
|
|
||
| await userEvent.click(screen.getByText(sourcePlaceholder$())); | ||
| await userEvent.click(await screen.findByText(websiteSourceOption$())); | ||
|
|
||
| await userEvent.click(screen.getByLabelText(/i have read and agree to terms of service/i)); | ||
|
|
||
| const finishButton = screen.getByRole('button', { name: /finish/i }); | ||
|
|
@@ -137,27 +151,17 @@ describe('Create account page', () => { | |
| await userEvent.click(finishButton); | ||
|
|
||
| await waitFor(() => { | ||
| expect(mockRegisterAction).toHaveBeenCalled(); | ||
| expect(mockRegisterAction).toHaveBeenCalledWith( | ||
| expect.anything(), | ||
| expect.objectContaining({ locations: KENYA }), | ||
| ); | ||
| }); | ||
| }); | ||
|
|
||
| // Skipped for the same reason as above — CountryField (VAutocomplete) blocker | ||
| it.skip('shows an offline error when the user is offline', async () => { | ||
| it('shows an offline error and disables Finish when the user is offline', async () => { | ||
| await renderComponent({ offline: true }); | ||
|
|
||
| await userEvent.type(screen.getByLabelText(/first name/i), 'Test'); | ||
| await userEvent.type(screen.getByLabelText(/last name/i), 'User'); | ||
| await userEvent.type(screen.getByLabelText(/email/i), '[email protected]'); | ||
| await userEvent.type(screen.getByLabelText(/^password$/i), 'tester123'); | ||
| await userEvent.type(screen.getByLabelText(/confirm password/i), 'tester123'); | ||
|
|
||
| await userEvent.click(screen.getByLabelText(/tagging content sources/i)); | ||
|
|
||
| await userEvent.click(screen.getByLabelText(/i have read and agree to terms of service/i)); | ||
|
|
||
| const finishButton = screen.getByRole('button', { name: /finish/i }); | ||
| await userEvent.click(finishButton); | ||
|
|
||
| expect(await screen.findByText(/offline/i)).toBeInTheDocument(); | ||
| expect(screen.getByTestId('studio-banner')).toHaveTextContent(registrationFailedOffline$()); | ||
| expect(screen.getByRole('button', { name: /finish/i })).toBeDisabled(); | ||
| }); | ||
| }); | ||
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
suggestion: No test covers the single-mode branch (
optionRemovedLabel$({ label })). If both modes useselectionsClearedLabel$, all 13 tests still pass.languageDropdown.spec.jstests the same branch by mockingsendPoliteMessage. That is safer than reading the shared live region, which keeps text between tests.studio/contentcuration/contentcuration/frontend/shared/views/__tests__/languageDropdown.spec.js
Lines 99 to 106 in 75ada9b