Skip to content

Commit

Permalink
fix(core): improve account settings form (#1506)
Browse files Browse the repository at this point in the history
* fix(core): improve account settings form

* Update Account settings test

---------

Co-authored-by: anastasiia.zvierieva <anastasiia.zvierieva@bigcommerce.com>
  • Loading branch information
bc-yevhenii-buliuk and bc-azvierieva authored Oct 28, 2024
1 parent 691ec2b commit ac83d3e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/fast-students-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bigcommerce/catalyst-core": patch
---

remove unnecessary fields from account settings form and update confirmation message
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ export enum FieldNameToFieldId {
email = 1,
firstName = 4,
lastName,
company,
phone,
}

type FieldUnionType = keyof typeof FieldNameToFieldId;
Expand Down Expand Up @@ -192,10 +190,7 @@ export const UpdateSettingsForm = ({
if (submit.status === 'success') {
setFormStatus({
status: 'success',
message: t('successMessage', {
firstName: submit.data?.firstName,
lastName: submit.data?.lastName,
}),
message: t('successMessage'),
});
}

Expand Down
2 changes: 1 addition & 1 deletion core/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
"changePassword": "Change password",
"submit": "Update settings",
"submitting": "Update settings...",
"successMessage": "Dear {firstName} {lastName}, you successfully updated your account data",
"successMessage": "Your account settings have been updated",
"validationMessages": {
"email": "Enter a valid email such as name@domain.com",
"empty": "This field can not be empty",
Expand Down
10 changes: 3 additions & 7 deletions core/tests/ui/e2e/account-settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@ test('Update Account information', async ({ page, account }) => {
await page.goto('/account/settings');
await page.getByLabel('First NameRequired').fill('Updated');
await page.getByLabel('Last NameRequired').fill('Name');
await page.getByLabel('Phone Number').fill('12345678');
await page.getByLabel('Company').fill('Corporation');
await page.getByLabel('Email Address').fill('updated@email.com');

await page.getByRole('button', { name: 'Update settings' }).click();

await expect(
page.getByText('Dear Updated Name, you successfully updated your account data'),
).toBeVisible();
await expect(page.getByLabel('Company')).toHaveValue('Corporation');
await expect(page.getByLabel('Phone Number')).toHaveValue('12345678');
await expect(page.getByText('Your account settings have been updated')).toBeVisible();
await expect(page.getByLabel('First NameRequired')).toHaveValue('Updated');
await expect(page.getByLabel('Last NameRequired')).toHaveValue('Name');
await expect(page.getByLabel('Email Address')).toHaveValue('updated@email.com');
});

0 comments on commit ac83d3e

Please sign in to comment.