-
{_t("Sidebar")}
-
-
{_t("Spaces to show")}
-
- {_t(
+
+
+
-
-
- {_t("Home")}
-
-
- {_t("Home is useful for getting an overview of everything.")}
-
+
+
+
+ {_t("Home")}
+
+
+ {_t("Home is useful for getting an overview of everything.")}
+
+
- {
- SettingsStore.setValue("Spaces.allRoomsInHome", null, SettingLevel.ACCOUNT, e.target.checked);
- PosthogTrackers.trackInteraction("WebSettingsSidebarTabSpacesCheckbox", e, 1);
- }}
- className="mx_SidebarUserSettingsTab_homeAllRoomsCheckbox"
- >
- {_t("Show all rooms")}
-
-
- {_t("Show all your rooms in Home, even if they're in a space.")}
-
+
+ {_t("Show all rooms")}
+
+ {_t("Show all your rooms in Home, even if they're in a space.")}
+
+
-
- {_t("Favourites")}
-
-
- {_t("Group all your favourite rooms and people in one place.")}
-
+
+
+
+ {_t("Favourites")}
+
+
+ {_t("Group all your favourite rooms and people in one place.")}
+
+
-
- {_t("People")}
-
-
- {_t("Group all your people in one place.")}
-
+
+
+
+ {_t("People")}
+
+ {_t("Group all your people in one place.")}
+
-
- {_t("Rooms outside of a space")}
-
-
- {_t("Group all your rooms that aren't part of a space in one place.")}
-
-
-
+
+
+
+ {_t("Rooms outside of a space")}
+
+
+ {_t("Group all your rooms that aren't part of a space in one place.")}
+
+
+
+
+
);
};
diff --git a/src/components/views/settings/tabs/user/VoiceUserSettingsTab.tsx b/src/components/views/settings/tabs/user/VoiceUserSettingsTab.tsx
index ada24bdf27..2821817466 100644
--- a/src/components/views/settings/tabs/user/VoiceUserSettingsTab.tsx
+++ b/src/components/views/settings/tabs/user/VoiceUserSettingsTab.tsx
@@ -26,6 +26,9 @@ import { SettingLevel } from "../../../../../settings/SettingLevel";
import SettingsFlag from "../../../elements/SettingsFlag";
import LabelledToggleSwitch from "../../../elements/LabelledToggleSwitch";
import { requestMediaPermissions } from "../../../../../utils/media/requestMediaPermissions";
+import SettingsTab from "../SettingsTab";
+import { SettingsSection } from "../../shared/SettingsSection";
+import SettingsSubsection from "../../shared/SettingsSubsection";
interface IState {
mediaDevices: IMediaDevices | null;
@@ -128,7 +131,7 @@ export default class VoiceUserSettingsTab extends React.Component<{}, IState> {
let webcamDropdown: ReactNode | undefined;
if (!this.state.mediaDevices) {
requestButton = (
-
+
{_t("Missing media permissions, click the button below to request.")}
{_t("Request media permissions")}
@@ -148,33 +151,30 @@ export default class VoiceUserSettingsTab extends React.Component<{}, IState> {
}
return (
-
-
{_t("Voice & Video")}
- {requestButton}
-
- {_t("Voice settings")}
- {speakerDropdown}
- {microphoneDropdown}
- => {
- await MediaDeviceHandler.setAudioAutoGainControl(v);
- this.setState({ audioAutoGainControl: MediaDeviceHandler.getAudioAutoGainControl() });
- }}
- label={_t("Automatically adjust the microphone volume")}
- data-testid="voice-auto-gain"
- />
-
-
- {_t("Video settings")}
- {webcamDropdown}
-
-
+
+
+ {requestButton}
+
+ {speakerDropdown}
+ {microphoneDropdown}
+ => {
+ await MediaDeviceHandler.setAudioAutoGainControl(v);
+ this.setState({ audioAutoGainControl: MediaDeviceHandler.getAudioAutoGainControl() });
+ }}
+ label={_t("Automatically adjust the microphone volume")}
+ data-testid="voice-auto-gain"
+ />
+
+
+ {webcamDropdown}
+
+
+
- {_t("Advanced")}
-
-
{_t("Voice processing")}
-
+
+
=> {
@@ -193,9 +193,8 @@ export default class VoiceUserSettingsTab extends React.Component<{}, IState> {
label={_t("Echo cancellation")}
data-testid="voice-echo-cancellation"
/>
-
-
- {_t("Connection")}
+
+
{
level={SettingLevel.DEVICE}
onChange={this.changeFallbackICEServerAllowed}
/>
-
-
-
+
+
+
);
}
}
diff --git a/test/components/views/settings/tabs/user/SidebarUserSettingsTab-test.tsx b/test/components/views/settings/tabs/user/SidebarUserSettingsTab-test.tsx
new file mode 100644
index 0000000000..fc0c2a1264
--- /dev/null
+++ b/test/components/views/settings/tabs/user/SidebarUserSettingsTab-test.tsx
@@ -0,0 +1,88 @@
+/*
+Copyright 2023 The Matrix.org Foundation C.I.C.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+import React from "react";
+import { fireEvent, render, screen } from "@testing-library/react";
+
+import SidebarUserSettingsTab from "../../../../../../src/components/views/settings/tabs/user/SidebarUserSettingsTab";
+import PosthogTrackers from "../../../../../../src/PosthogTrackers";
+import SettingsStore from "../../../../../../src/settings/SettingsStore";
+import { MetaSpace } from "../../../../../../src/stores/spaces";
+import { SettingLevel } from "../../../../../../src/settings/SettingLevel";
+import { flushPromises } from "../../../../../test-utils";
+
+// used by checkbox to relate labels to inputs
+// make it stable for snapshot testing
+jest.mock("matrix-js-sdk/src/randomstring", () => ({
+ randomString: jest.fn().mockReturnValue("abcd"),
+}));
+
+describe("", () => {
+ beforeEach(() => {
+ jest.spyOn(PosthogTrackers, "trackInteraction").mockClear();
+ jest.spyOn(SettingsStore, "getValue").mockRestore();
+ jest.spyOn(SettingsStore, "setValue").mockReset();
+ });
+
+ it("renders sidebar settings", () => {
+ const { container } = render();
+ expect(container).toMatchSnapshot();
+ });
+
+ it("toggles all rooms in home setting", async () => {
+ jest.spyOn(SettingsStore, "getValue").mockImplementation((settingName) => {
+ if (settingName === "Spaces.enabledMetaSpaces") {
+ return {
+ [MetaSpace.Home]: true,
+ [MetaSpace.Favourites]: true,
+ [MetaSpace.People]: true,
+ [MetaSpace.Orphans]: true,
+ };
+ }
+ return false;
+ });
+ render();
+
+ fireEvent.click(screen.getByTestId("mx_SidebarUserSettingsTab_homeAllRoomsCheckbox"));
+
+ await flushPromises();
+ expect(SettingsStore.setValue).toHaveBeenCalledWith("Spaces.allRoomsInHome", null, SettingLevel.ACCOUNT, true);
+
+ expect(PosthogTrackers.trackInteraction).toHaveBeenCalledWith(
+ "WebSettingsSidebarTabSpacesCheckbox",
+ // synthetic event from checkbox
+ expect.objectContaining({ type: "change" }),
+ 1,
+ );
+ });
+
+ it("disables all rooms in home setting when home space is disabled", () => {
+ jest.spyOn(SettingsStore, "getValue").mockImplementation((settingName) => {
+ if (settingName === "Spaces.enabledMetaSpaces") {
+ return {
+ [MetaSpace.Home]: false,
+ [MetaSpace.Favourites]: true,
+ [MetaSpace.People]: true,
+ [MetaSpace.Orphans]: true,
+ };
+ }
+ return false;
+ });
+ render();
+
+ expect(screen.getByTestId("mx_SidebarUserSettingsTab_homeAllRoomsCheckbox")).toBeDisabled();
+ });
+});
diff --git a/test/components/views/settings/tabs/user/__snapshots__/SidebarUserSettingsTab-test.tsx.snap b/test/components/views/settings/tabs/user/__snapshots__/SidebarUserSettingsTab-test.tsx.snap
new file mode 100644
index 0000000000..c1933d6dca
--- /dev/null
+++ b/test/components/views/settings/tabs/user/__snapshots__/SidebarUserSettingsTab-test.tsx.snap
@@ -0,0 +1,215 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[` renders sidebar settings 1`] = `
+
+
+
+
+
+ Sidebar
+
+
+
+
+
+ Spaces to show
+
+
+
+
+ Spaces are ways to group rooms and people. Alongside the spaces you're in, you can use some pre-built ones too.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+`;