Skip to content

Commit 7fa182b

Browse files
committed
replace Vuetify components with KDS equivalents and update error handling text
1 parent 1534de0 commit 7fa182b

2 files changed

Lines changed: 22 additions & 28 deletions

File tree

contentcuration/contentcuration/frontend/accounts/pages/Create.vue

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
:style="{ color: $themeTokens.error }"
131131
class="field-error"
132132
>
133-
{{ $tr('fieldRequired') }}
133+
{{ fieldRequiredText }}
134134
</div>
135135

136136
<!-- Location -->
@@ -144,7 +144,7 @@
144144
:style="{ color: $themeTokens.error }"
145145
class="field-error"
146146
>
147-
{{ $tr('fieldRequired') }}
147+
{{ fieldRequiredText }}
148148
</div>
149149

150150
<!-- Source -->
@@ -182,7 +182,7 @@
182182
:style="{ color: $themeTokens.error }"
183183
class="field-error"
184184
>
185-
{{ $tr('fieldRequired') }}
185+
{{ fieldRequiredText }}
186186
</div>
187187

188188
<!-- Agreements -->
@@ -243,11 +243,6 @@
243243
<script>
244244
245245
import { mapActions, mapGetters, mapState } from 'vuex';
246-
import KTextbox from 'kolibri-design-system/lib/KTextbox';
247-
import KCheckbox from 'kolibri-design-system/lib/KCheckbox';
248-
import KTransition from 'kolibri-design-system/lib/KTransition';
249-
import KSelect from 'kolibri-design-system/lib/KSelect';
250-
import KRouterLink from 'kolibri-design-system/lib/buttons-and-links/KRouterLink';
251246
import { uses, sources } from '../constants';
252247
import StudioEmailField from '../components/form/StudioEmailField';
253248
import StudioPasswordField from '../components/form/StudioPasswordField';
@@ -262,16 +257,11 @@
262257
name: 'Create',
263258
components: {
264259
StudioImmersiveModal,
265-
KTextbox,
266-
KCheckbox,
267-
KTransition,
268-
KSelect,
269260
StudioEmailField,
270261
StudioPasswordField,
271262
CountryField,
272263
PolicyModals,
273264
StudioBanner,
274-
KRouterLink,
275265
},
276266
data() {
277267
return {
@@ -288,7 +278,7 @@
288278
storage: '',
289279
other_use: '',
290280
locations: [],
291-
source: {},
281+
source: { value: '', label: '' },
292282
organization: '',
293283
conference: '',
294284
other_source: '',
@@ -362,6 +352,10 @@
362352
policies() {
363353
return policies;
364354
},
355+
fieldRequiredText() {
356+
/* eslint-disable-next-line kolibri/vue-no-undefined-string-uses */
357+
return commonStrings.$tr('fieldRequired');
358+
},
365359
sourceOptions() {
366360
return [
367361
{
@@ -480,6 +474,9 @@
480474
showOtherField(id) {
481475
return id === uses.OTHER && this.form.uses.includes(id);
482476
},
477+
// Custom validation is used (not generateFormMixin) because KTextbox requires
478+
// field-specific error message strings via :invalidText, which generateFormMixin
479+
// does not support (it stores only boolean errors per field).
483480
validateField(field) {
484481
switch (field) {
485482
case 'first_name':
@@ -567,8 +564,7 @@
567564
return isValid;
568565
},
569566
submit() {
570-
// We need to check the "acceptedAgreement" here explicitly because it is not a
571-
// Vuetify form field and does not trigger the form validation.
567+
// acceptedAgreement must be checked explicitly here as it is not included in validateForm().
572568
if (this.validateForm() && this.acceptedAgreement) {
573569
// Prevent double submission
574570
if (this.submitting) {
@@ -677,7 +673,6 @@
677673
otherSourcePlaceholder: 'Please describe',
678674
679675
// Privacy policy + terms of service
680-
fieldRequired: 'Field is required',
681676
viewToSLink: 'View Terms of Service',
682677
ToSRequiredMessage: 'Please accept our terms of service and policy',
683678
@@ -718,6 +713,7 @@
718713
}
719714
720715
.banner {
716+
width: 100%;
721717
margin-bottom: 32px;
722718
}
723719

contentcuration/contentcuration/frontend/accounts/pages/__tests__/create.spec.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,16 @@ describe('Create account page', () => {
105105
// NOTE:
106106
// Full form submission tests are intentionally skipped here.
107107
//
108-
// This page still relies on Vuetify components (v-select / v-autocomplete)
109-
// for required fields such as "locations" and "source".
110-
// These components do not reliably update their v-model state when interacted
111-
// with via Vue Testing Library’s userEvent APIs, which prevents a fully
112-
// user-centric submission flow from being exercised.
108+
// The "locations" field uses CountryField, which internally uses VAutocomplete
109+
// (a Vuetify component). VAutocomplete does not reliably update its v-model
110+
// state when interacted with via Vue Testing Library's userEvent APIs, which
111+
// prevents a fully user-centric submission flow from being exercised.
113112
//
114-
// The previous Vue Test Utils tests worked around this by directly mutating
115-
// component data (setData), which is intentionally avoided when using
116-
// Testing Library.
113+
// The "source" field has been migrated to KSelect (KDS) and no longer has
114+
// this limitation, but "locations" remains the blocker.
117115
//
118-
// These tests will be re-enabled once this page is migrated to the
119-
// Kolibri Design System as part of the Vuetify removal effort .
116+
// These tests will be re-enabled once CountryField is migrated away from
117+
// VAutocomplete as part of the ongoing Vuetify removal effort.
120118
it.skip('creates an account when the user submits valid information', async () => {
121119
await renderComponent();
122120

@@ -143,7 +141,7 @@ describe('Create account page', () => {
143141
});
144142
});
145143

146-
// Skipped for the same reason as above
144+
// Skipped for the same reason as above — CountryField (VAutocomplete) blocker
147145
it.skip('shows an offline error when the user is offline', async () => {
148146
await renderComponent({ offline: true });
149147

0 commit comments

Comments
 (0)