From 1a3a6543dc752d950da0cdc9c1ef3e0690bd1441 Mon Sep 17 00:00:00 2001 From: Siyasanga Date: Tue, 15 Oct 2024 14:21:40 +0200 Subject: [PATCH] Remove Eng suffix for the firstName in user form We currently don't support milti language support for both surname and first names so the ENG/EN suffixes are not needed. Also remove EN bits that were left for the surname field https://github.com/opencrvs/opencrvs-core/issues/6830 --- .../src/forms/user/fieldDefinitions/createUser.ts | 4 ++-- packages/client/src/i18n/messages/views/userForm.ts | 6 +++--- packages/client/src/tests/forms.json | 4 ++-- packages/client/src/tests/util.tsx | 12 +++++------- .../Team/user/userCreation/CreateNewUser.test.tsx | 4 ++-- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/packages/client/src/forms/user/fieldDefinitions/createUser.ts b/packages/client/src/forms/user/fieldDefinitions/createUser.ts index adb2b035721..d89a71dfc8b 100644 --- a/packages/client/src/forms/user/fieldDefinitions/createUser.ts +++ b/packages/client/src/forms/user/fieldDefinitions/createUser.ts @@ -96,9 +96,9 @@ export function userSectionFormType(): ISerializedFormSection { } }, { - name: 'firstNamesEng', + name: 'firstName', type: TEXT, - label: userFormMessages.firstNameEn, + label: userFormMessages.firstName, required: true, initialValue: '', validator: [{ operation: 'englishOnlyNameFormat' }], diff --git a/packages/client/src/i18n/messages/views/userForm.ts b/packages/client/src/i18n/messages/views/userForm.ts index 1453946f163..f4b46709183 100644 --- a/packages/client/src/i18n/messages/views/userForm.ts +++ b/packages/client/src/i18n/messages/views/userForm.ts @@ -49,15 +49,15 @@ export const messages = { description: 'User details section', id: 'form.section.userDetails' }, - firstNameEn: { + firstName: { defaultMessage: "User's first name", description: "User's English first name", - id: 'form.field.label.firstNameEN' + id: 'form.field.label.userFirstName' }, lastName: { defaultMessage: "User's surname", description: "User's English surname", - id: 'form.field.label.lastName' + id: 'form.field.label.userSurname' }, phoneNumber: { defaultMessage: 'Phone number', diff --git a/packages/client/src/tests/forms.json b/packages/client/src/tests/forms.json index 81437e72d29..07a7aefd20e 100644 --- a/packages/client/src/tests/forms.json +++ b/packages/client/src/tests/forms.json @@ -12203,7 +12203,7 @@ "label": { "defaultMessage": "Last name", "description": "English last name", - "id": "form.field.label.lastNameEN" + "id": "form.field.label.userSurname" }, "required": true, "initialValue": "", @@ -12528,7 +12528,7 @@ "label": { "defaultMessage": "Last name", "description": "English last name", - "id": "form.field.label.lastNameEN" + "id": "form.field.label.userSurname" }, "required": true, "initialValue": "", diff --git a/packages/client/src/tests/util.tsx b/packages/client/src/tests/util.tsx index 6c352dcd0df..4e49085df6e 100644 --- a/packages/client/src/tests/util.tsx +++ b/packages/client/src/tests/util.tsx @@ -1447,8 +1447,7 @@ export const mockCompleteFormData = { assignedRegistrationOffice: '', device: '', familyName: 'Hossain', - firstNames: 'Jeff', - firstNamesEng: 'Jeff', + firstName: 'Jeff', nid: '123456789', phoneNumber: '01662132132', email: 'jeff.hossain@gmail.com', @@ -1599,7 +1598,7 @@ export const mockUserGraphqlOperation = { } }, { - name: 'firstNamesEng', + name: 'firstNames', type: 'TEXT', label: { defaultMessage: 'English first name', @@ -1621,12 +1620,12 @@ export const mockUserGraphqlOperation = { } }, { - name: 'familyNameEng', + name: 'familyName', type: 'TEXT', label: { defaultMessage: 'English last name', description: 'English last name', - id: 'form.field.label.lastNameEN' + id: 'form.field.label.userSurname' }, required: true, initialValue: '', @@ -1795,8 +1794,7 @@ export const mockDataWithRegistarRoleSelected = { assignedRegistrationOffice: '', device: '', familyName: 'Hossain', - firstNames: 'Jeff', - firstNamesEng: 'Jeff', + firstName: 'Jeff', email: 'jeff@gmail.com', nid: '101488192', phoneNumber: '01662132132', diff --git a/packages/client/src/views/SysAdmin/Team/user/userCreation/CreateNewUser.test.tsx b/packages/client/src/views/SysAdmin/Team/user/userCreation/CreateNewUser.test.tsx index 3586c34ff0e..1c490b511c6 100644 --- a/packages/client/src/views/SysAdmin/Team/user/userCreation/CreateNewUser.test.tsx +++ b/packages/client/src/views/SysAdmin/Team/user/userCreation/CreateNewUser.test.tsx @@ -288,13 +288,13 @@ describe('create new user tests', () => { it('clicking change button on a field takes user back to form', async () => { testComponent - .find('#btn_change_firstNamesEng') + .find('#btn_change_firstName') .hostNodes() .first() .simulate('click') await flushPromises() expect(history.location.pathname).toBe('/createUser/user/user-view-group') - expect(history.location.hash).toBe('#firstNamesEng') + expect(history.location.hash).toBe('#firstName') }) it('clicking submit button submits the form data', async () => {