Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 4e4c5c7

Browse files
dbkrrobintown
andauthored
Rename general user settings to account (#12841)
* Rename general user settings to account Everything 'general' is now elsewhere, so this is ready for its new name. * Update snapshots * Rename & update playwright test * Rename class & remove unused CSS class * Change test ID * rethemendex * More tests!! * snapshots * Put the screenshots back in the new place * Fix tests with restoreAllMocks * More screenshot renaming * More test fixes & screenshot updates * More test fixes * un-skip * Typo Co-authored-by: Robin <[email protected]> --------- Co-authored-by: Robin <[email protected]>
1 parent 1be4c12 commit 4e4c5c7

File tree

20 files changed

+173
-55
lines changed

20 files changed

+173
-55
lines changed

playwright/e2e/oidc/oidc-aware.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ test.describe("OIDC Aware", () => {
3131
await expect(page.getByRole("heading", { name: "Welcome alice", exact: true })).toBeVisible();
3232

3333
// Open settings and navigate to account management
34-
await app.settings.openUserSettings("General");
34+
await app.settings.openUserSettings("Account");
3535
const newPagePromise = context.waitForEvent("page");
3636
await page.getByRole("button", { name: "Manage account" }).click();
3737

playwright/e2e/oidc/oidc-native.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ test.describe("OIDC Native", () => {
4444

4545
const deviceId = await page.evaluate<string>(() => window.localStorage.mx_device_id);
4646

47-
await app.settings.openUserSettings("General");
47+
await app.settings.openUserSettings("Account");
4848
const newPagePromise = context.waitForEvent("page");
4949
await page.getByRole("button", { name: "Manage account" }).click();
5050
await app.settings.closeDialog();

playwright/e2e/settings/general-user-settings-tab.spec.ts renamed to playwright/e2e/settings/account-user-settings-tab.spec.ts

+11-12
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@ import { test, expect } from "../../element-web-test";
1919
const USER_NAME = "Bob";
2020
const USER_NAME_NEW = "Alice";
2121

22-
test.describe("General user settings tab", () => {
22+
test.describe("Account user settings tab", () => {
2323
test.use({
2424
displayName: USER_NAME,
2525
config: {
2626
default_country_code: "US", // For checking the international country calling code
2727
},
2828
uut: async ({ app, user }, use) => {
29-
const locator = await app.settings.openUserSettings("General");
29+
const locator = await app.settings.openUserSettings("Account");
3030
await use(locator);
3131
},
3232
});
3333

3434
test("should be rendered properly", async ({ uut, user }) => {
35-
await expect(uut).toMatchScreenshot("general.png");
35+
await expect(uut).toMatchScreenshot("account.png");
3636

3737
// Assert that the top heading is rendered
38-
await expect(uut.getByRole("heading", { name: "General" })).toBeVisible();
38+
await expect(uut.getByRole("heading", { name: "Account", exact: true })).toBeVisible();
3939

4040
const profile = uut.locator(".mx_UserProfileSettings_profile");
4141
await profile.scrollIntoViewIfNeeded();
@@ -49,12 +49,11 @@ test.describe("General user settings tab", () => {
4949
await expect(uut.getByTestId("discoverySection").locator(".mx_Spinner")).not.toBeVisible();
5050

5151
const accountSection = uut.getByTestId("accountSection");
52+
accountSection.scrollIntoViewIfNeeded();
5253
// Assert that input areas for changing a password exists
53-
const changePassword = accountSection.locator("form.mx_GeneralUserSettingsTab_section--account_changePassword");
54-
await changePassword.scrollIntoViewIfNeeded();
55-
await expect(changePassword.getByLabel("Current password")).toBeVisible();
56-
await expect(changePassword.getByLabel("New Password")).toBeVisible();
57-
await expect(changePassword.getByLabel("Confirm password")).toBeVisible();
54+
await expect(accountSection.getByLabel("Current password")).toBeVisible();
55+
await expect(accountSection.getByLabel("New Password")).toBeVisible();
56+
await expect(accountSection.getByLabel("Confirm password")).toBeVisible();
5857

5958
// Check email addresses area
6059
const emailAddresses = uut.getByTestId("mx_AccountEmailAddresses");
@@ -82,13 +81,13 @@ test.describe("General user settings tab", () => {
8281

8382
test("should respond to small screen sizes", async ({ page, uut }) => {
8483
await page.setViewportSize({ width: 700, height: 600 });
85-
await expect(uut).toMatchScreenshot("general-smallscreen.png");
84+
await expect(uut).toMatchScreenshot("account-smallscreen.png");
8685
});
8786

8887
test("should show tooltips on narrow screen", async ({ page, uut }) => {
8988
await page.setViewportSize({ width: 700, height: 600 });
90-
await page.getByRole("tab", { name: "General" }).hover();
91-
await expect(page.getByRole("tooltip")).toHaveText("General");
89+
await page.getByRole("tab", { name: "Account" }).hover();
90+
await expect(page.getByRole("tooltip")).toHaveText("Account");
9291
});
9392

9493
test("should support adding and removing a profile picture", async ({ uut, page }) => {
Loading
Loading
Binary file not shown.

src/components/views/dialogs/UserSettingsDialog.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import HelpIcon from "@vector-im/compound-design-tokens/assets/web/icons/help";
3232

3333
import TabbedView, { Tab, useActiveTabWithDefault } from "../../structures/TabbedView";
3434
import { _t, _td } from "../../../languageHandler";
35-
import GeneralUserSettingsTab from "../settings/tabs/user/GeneralUserSettingsTab";
35+
import AccountUserSettingsTab from "../settings/tabs/user/AccountUserSettingsTab";
3636
import SettingsStore from "../../../settings/SettingsStore";
3737
import LabsUserSettingsTab, { showLabsFlags } from "../settings/tabs/user/LabsUserSettingsTab";
3838
import AppearanceUserSettingsTab from "../settings/tabs/user/AppearanceUserSettingsTab";
@@ -65,8 +65,8 @@ function titleForTabID(tabId: UserTab): React.ReactNode {
6565
strong: (sub: string) => <span className="mx_UserSettingsDialog_title_strong">{sub}</span>,
6666
};
6767
switch (tabId) {
68-
case UserTab.General:
69-
return _t("settings|general|dialog_title", undefined, subs);
68+
case UserTab.Account:
69+
return _t("settings|account|dialog_title", undefined, subs);
7070
case UserTab.SessionManager:
7171
return _t("settings|sessions|dialog_title", undefined, subs);
7272
case UserTab.Appearance:
@@ -103,10 +103,10 @@ export default function UserSettingsDialog(props: IProps): JSX.Element {
103103

104104
tabs.push(
105105
new Tab(
106-
UserTab.General,
107-
_td("common|general"),
106+
UserTab.Account,
107+
_td("settings|account|title"),
108108
<UserProfileIcon />,
109-
<GeneralUserSettingsTab closeSettingsFn={props.onFinished} />,
109+
<AccountUserSettingsTab closeSettingsFn={props.onFinished} />,
110110
"UserSettingsGeneral",
111111
),
112112
);
@@ -216,7 +216,7 @@ export default function UserSettingsDialog(props: IProps): JSX.Element {
216216
return tabs as NonEmptyArray<Tab<UserTab>>;
217217
};
218218

219-
const [activeTabId, _setActiveTabId] = useActiveTabWithDefault(getTabs(), UserTab.General, props.initialTabId);
219+
const [activeTabId, _setActiveTabId] = useActiveTabWithDefault(getTabs(), UserTab.Account, props.initialTabId);
220220
const setActiveTabId = (tabId: UserTab): void => {
221221
_setActiveTabId(tabId);
222222
// Clear this so switching away from the tab and back to it will not show the QR code again

src/components/views/dialogs/UserTab.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ limitations under the License.
1515
*/
1616

1717
export enum UserTab {
18-
General = "USER_GENERAL_TAB",
18+
Account = "USER_ACCOUNT_TAB",
1919
Appearance = "USER_APPEARANCE_TAB",
2020
Notifications = "USER_NOTIFICATIONS_TAB",
2121
Preferences = "USER_PREFERENCES_TAB",

src/components/views/settings/notifications/NotificationPusherSettings.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function generalTabButton(content: string): JSX.Element {
3737
onClick={() => {
3838
dispatcher.dispatch({
3939
action: Action.ViewUserSettings,
40-
initialTabId: UserTab.General,
40+
initialTabId: UserTab.Account,
4141
});
4242
}}
4343
>

src/components/views/settings/tabs/user/GeneralUserSettingsTab.tsx renamed to src/components/views/settings/tabs/user/AccountUserSettingsTab.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ const AccountSection: React.FC<AccountSectionProps> = ({
6262
>
6363
<SettingsSubsectionText>{_t("settings|general|password_change_section")}</SettingsSubsectionText>
6464
<ChangePassword
65-
className="mx_GeneralUserSettingsTab_section--account_changePassword"
6665
rowClassName=""
6766
buttonKind="primary"
6867
onError={onPasswordChangeError}
@@ -93,7 +92,7 @@ const ManagementSection: React.FC<ManagementSectionProps> = ({ onDeactivateClick
9392
);
9493
};
9594

96-
const GeneralUserSettingsTab: React.FC<IProps> = ({ closeSettingsFn }) => {
95+
const AccountUserSettingsTab: React.FC<IProps> = ({ closeSettingsFn }) => {
9796
const [externalAccountManagementUrl, setExternalAccountManagementUrl] = React.useState<string | undefined>();
9897
const [canMake3pidChanges, setCanMake3pidChanges] = React.useState<boolean>(false);
9998
const [canSetDisplayName, setCanSetDisplayName] = React.useState<boolean>(false);
@@ -189,7 +188,7 @@ const GeneralUserSettingsTab: React.FC<IProps> = ({ closeSettingsFn }) => {
189188
}
190189

191190
return (
192-
<SettingsTab data-testid="mx_GeneralUserSettingsTab">
191+
<SettingsTab data-testid="mx_AccountUserSettingsTab">
193192
<SettingsSection>
194193
<UserProfileSettings
195194
externalAccountManagementUrl={externalAccountManagementUrl}
@@ -208,4 +207,4 @@ const GeneralUserSettingsTab: React.FC<IProps> = ({ closeSettingsFn }) => {
208207
);
209208
};
210209

211-
export default GeneralUserSettingsTab;
210+
export default AccountUserSettingsTab;

src/hooks/useUserOnboardingTasks.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ const tasks: UserOnboardingTask[] = [
127127
PosthogTrackers.trackInteraction("WebUserOnboardingTaskSetupProfile", ev);
128128
defaultDispatcher.dispatch({
129129
action: Action.ViewUserSettings,
130-
initialTabId: UserTab.General,
130+
initialTabId: UserTab.Account,
131131
});
132132
},
133133
},

src/i18n/strings/en_EN.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -2422,6 +2422,10 @@
24222422
}
24232423
},
24242424
"settings": {
2425+
"account": {
2426+
"dialog_title": "<strong>Settings:</strong> Account",
2427+
"title": "Account"
2428+
},
24252429
"all_rooms_home": "Show all rooms in Home",
24262430
"all_rooms_home_description": "All rooms you're in will appear in Home.",
24272431
"always_show_message_timestamps": "Always show message timestamps",
@@ -2497,7 +2501,6 @@
24972501
"deactivate_confirm_erase_label": "Hide my messages from new joiners",
24982502
"deactivate_section": "Deactivate Account",
24992503
"deactivate_warning": "Deactivating your account is a permanent action — be careful!",
2500-
"dialog_title": "<strong>Settings:</strong> General",
25012504
"discovery_email_empty": "Discovery options will appear once you have added an email.",
25022505
"discovery_email_verification_instructions": "Verify the link in your inbox",
25032506
"discovery_msisdn_empty": "Discovery options will appear once you have added a phone number.",

test/components/views/dialogs/UserSettingsDialog-test.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ describe("<UserSettingsDialog />", () => {
9898
it("should render general settings tab when no initialTabId", () => {
9999
const { container } = render(getComponent());
100100

101-
expect(getActiveTabLabel(container)).toEqual("General");
101+
expect(getActiveTabLabel(container)).toEqual("Account");
102102
});
103103

104104
it("should render initial tab when initialTabId is set", () => {
@@ -111,7 +111,7 @@ describe("<UserSettingsDialog />", () => {
111111
// mjolnir tab is only rendered in some configs
112112
const { container } = render(getComponent({ initialTabId: UserTab.Mjolnir }));
113113

114-
expect(getActiveTabLabel(container)).toEqual("General");
114+
expect(getActiveTabLabel(container)).toEqual("Account");
115115
});
116116

117117
it("renders tabs correctly", () => {

test/components/views/dialogs/__snapshots__/UserSettingsDialog-test.tsx.snap

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
exports[`<UserSettingsDialog /> renders tabs correctly 1`] = `
44
NodeList [
55
<li
6-
aria-controls="mx_tabpanel_USER_GENERAL_TAB"
6+
aria-controls="mx_tabpanel_USER_ACCOUNT_TAB"
77
aria-selected="true"
88
class="mx_AccessibleButton mx_TabbedView_tabLabel mx_TabbedView_tabLabel_active"
9-
data-testid="settings-tab-USER_GENERAL_TAB"
9+
data-testid="settings-tab-USER_ACCOUNT_TAB"
1010
role="tab"
1111
tabindex="0"
1212
>
@@ -29,9 +29,9 @@ NodeList [
2929
</svg>
3030
<span
3131
class="mx_TabbedView_tabLabel_text"
32-
id="mx_tabpanel_USER_GENERAL_TAB_label"
32+
id="mx_tabpanel_USER_ACCOUNT_TAB_label"
3333
>
34-
General
34+
Account
3535
</span>
3636
</li>,
3737
<li

0 commit comments

Comments
 (0)