Fixup unit tests to check correct attributes.

This commit is contained in:
Half-Shot 2025-07-08 17:03:56 +01:00
parent f83bf60a14
commit 7df3b45ee3
28 changed files with 4447 additions and 3988 deletions

View File

@ -26,9 +26,6 @@ describe("<CreateRoomDialog />", () => {
});
const getE2eeEnableToggleInputElement = () => screen.getByLabelText("Enable end-to-end encryption");
// labelled toggle switch doesn't set the disabled attribute, only aria-disabled
const getE2eeEnableToggleIsDisabled = () =>
getE2eeEnableToggleInputElement().getAttribute("aria-disabled") === "true";
beforeEach(() => {
mockClient.doesServerForceEncryptionForPreset.mockResolvedValue(false);
@ -66,7 +63,7 @@ describe("<CreateRoomDialog />", () => {
await flushPromises();
expect(getE2eeEnableToggleInputElement()).not.toBeChecked();
expect(getE2eeEnableToggleIsDisabled()).toBeFalsy();
expect(getE2eeEnableToggleInputElement()).not.toBeDisabled();
expect(
screen.getByText(
"Your server admin has disabled end-to-end encryption by default in private rooms & Direct Messages.",
@ -86,7 +83,7 @@ describe("<CreateRoomDialog />", () => {
await flushPromises();
expect(getE2eeEnableToggleInputElement()).not.toBeChecked();
expect(getE2eeEnableToggleIsDisabled()).toBeTruthy();
expect(getE2eeEnableToggleInputElement()).toBeDisabled();
expect(
screen.getByText(
"Your server admin has disabled end-to-end encryption by default in private rooms & Direct Messages.",
@ -106,7 +103,7 @@ describe("<CreateRoomDialog />", () => {
await flushPromises();
// encryption enabled
expect(getE2eeEnableToggleInputElement()).toBeChecked();
expect(getE2eeEnableToggleIsDisabled()).toBeFalsy();
expect(getE2eeEnableToggleInputElement()).not.toBeDisabled();
});
it("should use defaultEncrypted prop when it is false", async () => {
@ -122,7 +119,7 @@ describe("<CreateRoomDialog />", () => {
// encryption disabled
expect(getE2eeEnableToggleInputElement()).not.toBeChecked();
// not forced to off
expect(getE2eeEnableToggleIsDisabled()).toBeFalsy();
expect(getE2eeEnableToggleInputElement()).not.toBeDisabled();
});
it("should override defaultEncrypted when server .well-known forces disabled encryption", async () => {
@ -137,7 +134,7 @@ describe("<CreateRoomDialog />", () => {
// server forces encryption to disabled, even though defaultEncrypted is false
expect(getE2eeEnableToggleInputElement()).not.toBeChecked();
expect(getE2eeEnableToggleIsDisabled()).toBeTruthy();
expect(getE2eeEnableToggleInputElement()).toBeDisabled();
expect(
screen.getByText(
"Your server admin has disabled end-to-end encryption by default in private rooms & Direct Messages.",
@ -152,7 +149,7 @@ describe("<CreateRoomDialog />", () => {
// server forces encryption to enabled, even though defaultEncrypted is true
expect(getE2eeEnableToggleInputElement()).toBeChecked();
expect(getE2eeEnableToggleIsDisabled()).toBeTruthy();
expect(getE2eeEnableToggleInputElement()).toBeDisabled();
expect(screen.getByText("Your server requires encryption to be enabled in private rooms.")).toBeDefined();
});
@ -162,7 +159,7 @@ describe("<CreateRoomDialog />", () => {
await flushPromises();
expect(getE2eeEnableToggleInputElement()).toBeChecked();
expect(getE2eeEnableToggleIsDisabled()).toBeTruthy();
expect(getE2eeEnableToggleInputElement()).toBeDisabled();
expect(screen.getByText("Your server requires encryption to be enabled in private rooms.")).toBeDefined();
});
@ -255,7 +252,7 @@ describe("<CreateRoomDialog />", () => {
it("should create a knock room with public visibility", async () => {
fireEvent.click(
screen.getByRole("checkbox", { name: "Make this room visible in the public room directory." }),
screen.getByRole("switch", { name: "Make this room visible in the public room directory." }),
);
fireEvent.click(screen.getByText("Create room"));
await flushPromises();

View File

@ -31,67 +31,77 @@ exports[`ConfirmRejectInviteDialog can reject with options selected 1`] = `
Are you sure you want to decline the invitation to join "foo"?
</p>
<div
class="mx_SettingsFlag"
class="_inline-field_19upo_32"
>
<span
class="mx_SettingsFlag_label"
<div
class="_inline-field-control_19upo_44"
>
<div
id="mx_LabelledToggleSwitch_«r7»"
class="_container_19o42_10"
>
<input
class="_input_19o42_24"
id="«rb»"
role="switch"
type="checkbox"
/>
<div
class="_ui_19o42_34"
/>
</div>
</div>
<div
class="_inline-field-body_19upo_38"
>
<label
class="_label_19upo_59"
for="«rb»"
>
Ignore user
</div>
</label>
<span
class="mx_Caption"
id="mx_LabelledToggleSwitch_«r7»_caption"
class="_message_19upo_85 _help-message_19upo_91"
id="radix-«rd»"
>
You will not see any messages or room invites from this user.
</span>
</span>
<div
aria-checked="true"
aria-describedby="mx_LabelledToggleSwitch_«r7»_caption"
aria-disabled="false"
aria-labelledby="mx_LabelledToggleSwitch_«r7»"
class="mx_AccessibleButton mx_ToggleSwitch mx_ToggleSwitch_on mx_ToggleSwitch_enabled"
role="switch"
tabindex="0"
>
<div
class="mx_ToggleSwitch_ball"
/>
</div>
</div>
<div
class="mx_SettingsFlag"
class="_inline-field_19upo_32"
>
<span
class="mx_SettingsFlag_label"
<div
class="_inline-field-control_19upo_44"
>
<div
id="mx_LabelledToggleSwitch_«r8»"
class="_container_19o42_10"
>
<input
class="_input_19o42_24"
id="«re»"
role="switch"
type="checkbox"
/>
<div
class="_ui_19o42_34"
/>
</div>
</div>
<div
class="_inline-field-body_19upo_38"
>
<label
class="_label_19upo_59"
for="«re»"
>
Report room
</div>
</label>
<span
class="mx_Caption"
id="mx_LabelledToggleSwitch_«r8»_caption"
class="_message_19upo_85 _help-message_19upo_91"
id="radix-«rg»"
>
Report this room to your account provider.
</span>
</span>
<div
aria-checked="true"
aria-describedby="mx_LabelledToggleSwitch_«r8»_caption"
aria-disabled="false"
aria-labelledby="mx_LabelledToggleSwitch_«r8»"
class="mx_AccessibleButton mx_ToggleSwitch mx_ToggleSwitch_on mx_ToggleSwitch_enabled"
role="switch"
tabindex="0"
>
<div
class="mx_ToggleSwitch_ball"
/>
</div>
</div>
<div

View File

@ -105,117 +105,127 @@ exports[`DevtoolsDialog renders the devtools dialog 1`] = `
End-to-end encryption
</button>
</div>
<div>
<form
class="_root_19upo_16"
>
<h3>
Options
</h3>
<div
class="mx_SettingsFlag"
>
<label
class="mx_SettingsFlag_label"
for="mx_SettingsFlag_vY7Q4uEh9K38"
>
<span
class="mx_SettingsFlag_labelText"
>
Developer mode
</span>
</label>
<div
aria-checked="false"
aria-disabled="false"
aria-label="Developer mode"
class="mx_AccessibleButton mx_ToggleSwitch mx_ToggleSwitch_enabled"
id="mx_SettingsFlag_vY7Q4uEh9K38"
role="switch"
tabindex="0"
>
<div
class="mx_ToggleSwitch_ball"
/>
</div>
</div>
<div
class="mx_SettingsFlag"
>
<label
class="mx_SettingsFlag_label"
for="mx_SettingsFlag_QgU2PomxwKpa"
>
<span
class="mx_SettingsFlag_labelText"
>
Show hidden events in timeline
</span>
</label>
<div
aria-checked="false"
aria-disabled="false"
aria-label="Show hidden events in timeline"
class="mx_AccessibleButton mx_ToggleSwitch mx_ToggleSwitch_enabled"
id="mx_SettingsFlag_QgU2PomxwKpa"
role="switch"
tabindex="0"
>
<div
class="mx_ToggleSwitch_ball"
/>
</div>
</div>
<div
class="mx_SettingsFlag"
>
<label
class="mx_SettingsFlag_label"
for="mx_SettingsFlag_6hpi3YEetmBG"
>
<span
class="mx_SettingsFlag_labelText"
>
Enable widget screenshots on supported widgets
</span>
</label>
<div
aria-checked="false"
aria-disabled="false"
aria-label="Enable widget screenshots on supported widgets"
class="mx_AccessibleButton mx_ToggleSwitch mx_ToggleSwitch_enabled"
id="mx_SettingsFlag_6hpi3YEetmBG"
role="switch"
tabindex="0"
>
<div
class="mx_ToggleSwitch_ball"
/>
</div>
</div>
<form
class="_root_19upo_16"
class="_inline-field_19upo_32"
>
<div
class="_field_19upo_26"
class="_inline-field-control_19upo_44"
>
<label
class="_label_19upo_59"
for="radix-«r4»"
>
Element Call URL
</label>
<div
class="_controls_17lij_8"
class="_container_19o42_10"
>
<input
class="_control_sqdq4_10"
id="radix-«r4»"
name="input"
title=""
value=""
class="_input_19o42_24"
id="mx_SettingsFlag_vY7Q4uEh9K38"
role="switch"
type="checkbox"
/>
<div
class="_ui_19o42_34"
/>
</div>
</div>
</form>
</div>
<div
class="_inline-field-body_19upo_38"
>
<label
class="_label_19upo_59"
for="mx_SettingsFlag_vY7Q4uEh9K38"
>
Developer mode
</label>
</div>
</div>
<div
class="_inline-field_19upo_32"
>
<div
class="_inline-field-control_19upo_44"
>
<div
class="_container_19o42_10"
>
<input
class="_input_19o42_24"
id="mx_SettingsFlag_QgU2PomxwKpa"
role="switch"
type="checkbox"
/>
<div
class="_ui_19o42_34"
/>
</div>
</div>
<div
class="_inline-field-body_19upo_38"
>
<label
class="_label_19upo_59"
for="mx_SettingsFlag_QgU2PomxwKpa"
>
Show hidden events in timeline
</label>
</div>
</div>
<div
class="_inline-field_19upo_32"
>
<div
class="_inline-field-control_19upo_44"
>
<div
class="_container_19o42_10"
>
<input
class="_input_19o42_24"
id="mx_SettingsFlag_6hpi3YEetmBG"
role="switch"
type="checkbox"
/>
<div
class="_ui_19o42_34"
/>
</div>
</div>
<div
class="_inline-field-body_19upo_38"
>
<label
class="_label_19upo_59"
for="mx_SettingsFlag_6hpi3YEetmBG"
>
Enable widget screenshots on supported widgets
</label>
</div>
</div>
<div
class="_field_19upo_26"
>
<label
class="_label_19upo_59"
for="radix-«ra»"
>
Element Call URL
</label>
<div
class="_controls_17lij_8"
>
<input
class="_control_sqdq4_10"
id="radix-«ra»"
name="input"
title=""
value=""
/>
</div>
</div>
</form>
</div>
<div
class="mx_Dialog_buttons"

View File

@ -43,7 +43,7 @@ exports[`ReportRoomDialog displays admin message 1`] = `
/>
<span
class="_message_19upo_85 _help-message_19upo_91"
id="radix-«r8»"
id="radix-«r9»"
>
Report this room to your account provider. If the messages are encrypted, your admin will not be able to read them.
</span>
@ -65,28 +65,34 @@ exports[`ReportRoomDialog displays admin message 1`] = `
</p>
<div
class="mx_SettingsFlag"
class="_inline-field_19upo_32"
>
<span
class="mx_SettingsFlag_label"
<div
class="_inline-field-control_19upo_44"
>
<div
id="mx_LabelledToggleSwitch_«r9»"
class="_container_19o42_10"
>
<input
class="_input_19o42_24"
id="«ra»"
role="switch"
type="checkbox"
/>
<div
class="_ui_19o42_34"
/>
</div>
</div>
<div
class="_inline-field-body_19upo_38"
>
<label
class="_label_19upo_59"
for="«ra»"
>
Leave room
</div>
</span>
<div
aria-checked="false"
aria-disabled="false"
aria-labelledby="mx_LabelledToggleSwitch_«r9»"
class="mx_AccessibleButton mx_ToggleSwitch mx_ToggleSwitch_enabled"
role="switch"
tabindex="0"
>
<div
class="mx_ToggleSwitch_ball"
/>
</label>
</div>
</div>
<div

View File

@ -300,7 +300,7 @@ describe("<LocationShareMenu />", () => {
setShareType(getByText, LocationShareType.Live);
expect(getByText("OK").hasAttribute("disabled")).toBeTruthy();
expect(getByText("OK")).toHaveAttribute("aria-disabled", "true");
});
it("enables OK button when labs flag is toggled to enabled", () => {
@ -310,7 +310,7 @@ describe("<LocationShareMenu />", () => {
fireEvent.click(getByLabelText("Enable live location sharing"));
expect(getByText("OK").hasAttribute("disabled")).toBeFalsy();
expect(getByText("OK")).not.toHaveAttribute("aria-disabled", "true");
});
it("enables live share setting on ok button submit", () => {

View File

@ -18,41 +18,50 @@ exports[`<LocationShareMenu /> with live location disabled goes to labs flag scr
>
Please note: this is a labs feature using a temporary implementation. This means you will not be able to delete your location history, and advanced users will be able to see your location history even after you stop sharing your live location with this room.
</p>
<div
class="mx_SettingsFlag"
data-testid="enable-live-share-toggle"
<form
class="_root_19upo_16"
>
<span
class="mx_SettingsFlag_label"
<div
class="_inline-field_19upo_32"
>
<div
id="mx_LabelledToggleSwitch_«r0»"
class="_inline-field-control_19upo_44"
>
Enable live location sharing
<div
class="_container_19o42_10"
>
<input
class="_input_19o42_24"
id="«r0»"
role="switch"
type="checkbox"
/>
<div
class="_ui_19o42_34"
/>
</div>
</div>
</span>
<div
aria-checked="false"
aria-disabled="false"
aria-labelledby="mx_LabelledToggleSwitch_«r0»"
class="mx_AccessibleButton mx_ToggleSwitch mx_ToggleSwitch_enabled"
role="switch"
<div
class="_inline-field-body_19upo_38"
>
<label
class="_label_19upo_59"
for="«r0»"
>
Enable live location sharing
</label>
</div>
</div>
<button
aria-disabled="true"
class="_button_vczzf_8 mx_EnableLiveShare_button"
data-kind="primary"
data-size="lg"
role="button"
tabindex="0"
>
<div
class="mx_ToggleSwitch_ball"
/>
</div>
</div>
<button
aria-disabled="true"
class="mx_AccessibleButton mx_EnableLiveShare_button mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary mx_AccessibleButton_disabled"
data-testid="enable-live-share-submit"
disabled=""
role="button"
tabindex="0"
>
OK
</button>
OK
</button>
</form>
</div>
`;

View File

@ -213,6 +213,7 @@ exports[`<RoomSummaryCard /> has button to edit topic 1`] = `
aria-hidden="true"
class="_input_19o42_24"
id="«rv»"
role="switch"
type="checkbox"
/>
<div
@ -935,6 +936,7 @@ exports[`<RoomSummaryCard /> renders the room summary 1`] = `
aria-hidden="true"
class="_input_19o42_24"
id="«r5»"
role="switch"
type="checkbox"
/>
<div
@ -1695,6 +1697,7 @@ exports[`<RoomSummaryCard /> renders the room topic in the summary 1`] = `
aria-hidden="true"
class="_input_19o42_24"
id="«ri»"
role="switch"
type="checkbox"
/>
<div

View File

@ -9,6 +9,7 @@ import React from "react";
import { type MatrixClient, type Room } from "matrix-js-sdk/src/matrix";
import { render, screen } from "jest-matrix-react";
import { waitFor } from "@testing-library/dom";
import { Form } from "@vector-im/compound-web";
import { createTestClient, mkStubRoom, withClientContextRenderOptions } from "../../../../test-utils";
import { UrlPreviewSettings } from "../../../../../src/components/views/room_settings/UrlPreviewSettings.tsx";
@ -30,7 +31,12 @@ describe("UrlPreviewSettings", () => {
});
function renderComponent() {
return render(<UrlPreviewSettings room={room} />, withClientContextRenderOptions(client));
return render(
<Form.Root>
<UrlPreviewSettings room={room} />
</Form.Root>,
withClientContextRenderOptions(client),
);
}
it("should display the correct preview when the setting is in a loading state", () => {

View File

@ -2,235 +2,269 @@
exports[`UrlPreviewSettings should display the correct preview when the room is encrypted and the url preview is enabled 1`] = `
<DocumentFragment>
<fieldset
class="mx_SettingsFieldset"
<form
class="_root_19upo_16"
>
<legend
class="mx_SettingsFieldset_legend"
<fieldset
class="mx_SettingsFieldset"
>
URL Previews
</legend>
<div
class="mx_SettingsFieldset_description"
>
<div
class="mx_SettingsSubsection_text"
<legend
class="mx_SettingsFieldset_legend"
>
<p>
When someone puts a URL in their message, a URL preview can be shown to give more information about that link such as the title, description, and an image from the website.
</p>
<p>
In encrypted rooms, like this one, URL previews are disabled by default to ensure that your homeserver (where the previews are generated) cannot gather information about links you see in this room.
</p>
</div>
</div>
<div
class="mx_SettingsFieldset_content"
>
URL Previews
</legend>
<div
class="mx_SettingsFlag"
class="mx_SettingsFieldset_description"
>
<label
class="mx_SettingsFlag_label"
for="mx_SettingsFlag_vY7Q4uEh9K38"
>
<span
class="mx_SettingsFlag_labelText"
/>
</label>
<div
aria-checked="true"
aria-disabled="false"
class="mx_AccessibleButton mx_ToggleSwitch mx_ToggleSwitch_on mx_ToggleSwitch_enabled"
id="mx_SettingsFlag_vY7Q4uEh9K38"
role="switch"
tabindex="0"
class="mx_SettingsSubsection_text"
>
<div
class="mx_ToggleSwitch_ball"
/>
<p>
When someone puts a URL in their message, a URL preview can be shown to give more information about that link such as the title, description, and an image from the website.
</p>
<p>
In encrypted rooms, like this one, URL previews are disabled by default to ensure that your homeserver (where the previews are generated) cannot gather information about links you see in this room.
</p>
</div>
</div>
</div>
</fieldset>
<div
class="mx_SettingsFieldset_content"
>
<div
class="_inline-field_19upo_32"
>
<div
class="_inline-field-control_19upo_44"
>
<div
class="_container_19o42_10"
>
<input
checked=""
class="_input_19o42_24"
id="mx_SettingsFlag_vY7Q4uEh9K38"
role="switch"
type="checkbox"
/>
<div
class="_ui_19o42_34"
/>
</div>
</div>
<div
class="_inline-field-body_19upo_38"
>
<label
class="_label_19upo_59"
for="mx_SettingsFlag_vY7Q4uEh9K38"
>
urlPreviewsEnabled_e2ee
</label>
</div>
</div>
</div>
</fieldset>
</form>
</DocumentFragment>
`;
exports[`UrlPreviewSettings should display the correct preview when the room is unencrypted and the url preview is disabled 1`] = `
<DocumentFragment>
<fieldset
class="mx_SettingsFieldset"
<form
class="_root_19upo_16"
>
<legend
class="mx_SettingsFieldset_legend"
<fieldset
class="mx_SettingsFieldset"
>
URL Previews
</legend>
<div
class="mx_SettingsFieldset_description"
>
<div
class="mx_SettingsSubsection_text"
<legend
class="mx_SettingsFieldset_legend"
>
URL Previews
</legend>
<div
class="mx_SettingsFieldset_description"
>
<p>
When someone puts a URL in their message, a URL preview can be shown to give more information about that link such as the title, description, and an image from the website.
</p>
<p>
<span>
You have
</span>
</p>
<div
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
role="button"
tabindex="0"
class="mx_SettingsSubsection_text"
>
disabled
</div>
URL previews by default.
<p />
</div>
</div>
<div
class="mx_SettingsFieldset_content"
>
<div>
URL previews are disabled by default for participants in this room.
</div>
<div
class="mx_SettingsFlag"
>
<label
class="mx_SettingsFlag_label"
for="mx_SettingsFlag_vY7Q4uEh9K38"
>
<span
class="mx_SettingsFlag_labelText"
<p>
When someone puts a URL in their message, a URL preview can be shown to give more information about that link such as the title, description, and an image from the website.
</p>
<p>
<span>
You have
</span>
</p>
<div
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
role="button"
tabindex="0"
>
Enable inline URL previews by default
</span>
</label>
disabled
</div>
URL previews by default.
<p />
</div>
</div>
<div
class="mx_SettingsFieldset_content"
>
<div>
URL previews are disabled by default for participants in this room.
</div>
<div
aria-checked="false"
aria-disabled="true"
aria-label="Enable inline URL previews by default"
class="mx_AccessibleButton mx_ToggleSwitch"
id="mx_SettingsFlag_vY7Q4uEh9K38"
role="switch"
tabindex="0"
class="_inline-field_19upo_32"
>
<div
class="mx_ToggleSwitch_ball"
/>
class="_inline-field-control_19upo_44"
>
<div
class="_container_19o42_10"
>
<input
class="_input_19o42_24"
disabled=""
id="mx_SettingsFlag_vY7Q4uEh9K38"
role="switch"
type="checkbox"
/>
<div
class="_ui_19o42_34"
/>
</div>
</div>
<div
class="_inline-field-body_19upo_38"
>
<label
class="_label_19upo_59"
for="mx_SettingsFlag_vY7Q4uEh9K38"
>
Enable inline URL previews by default
</label>
</div>
</div>
</div>
</div>
</fieldset>
</fieldset>
</form>
</DocumentFragment>
`;
exports[`UrlPreviewSettings should display the correct preview when the room is unencrypted and the url preview is enabled 1`] = `
<DocumentFragment>
<fieldset
class="mx_SettingsFieldset"
<form
class="_root_19upo_16"
>
<legend
class="mx_SettingsFieldset_legend"
<fieldset
class="mx_SettingsFieldset"
>
URL Previews
</legend>
<div
class="mx_SettingsFieldset_description"
>
<div
class="mx_SettingsSubsection_text"
<legend
class="mx_SettingsFieldset_legend"
>
URL Previews
</legend>
<div
class="mx_SettingsFieldset_description"
>
<p>
When someone puts a URL in their message, a URL preview can be shown to give more information about that link such as the title, description, and an image from the website.
</p>
<p>
<span>
You have
</span>
</p>
<div
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
role="button"
tabindex="0"
class="mx_SettingsSubsection_text"
>
enabled
</div>
URL previews by default.
<p />
</div>
</div>
<div
class="mx_SettingsFieldset_content"
>
<div>
URL previews are enabled by default for participants in this room.
</div>
<div
class="mx_SettingsFlag"
>
<label
class="mx_SettingsFlag_label"
for="mx_SettingsFlag_vY7Q4uEh9K38"
>
<span
class="mx_SettingsFlag_labelText"
<p>
When someone puts a URL in their message, a URL preview can be shown to give more information about that link such as the title, description, and an image from the website.
</p>
<p>
<span>
You have
</span>
</p>
<div
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_link_inline"
role="button"
tabindex="0"
>
Enable inline URL previews by default
</span>
</label>
enabled
</div>
URL previews by default.
<p />
</div>
</div>
<div
class="mx_SettingsFieldset_content"
>
<div>
URL previews are enabled by default for participants in this room.
</div>
<div
aria-checked="true"
aria-disabled="false"
aria-label="Enable inline URL previews by default"
class="mx_AccessibleButton mx_ToggleSwitch mx_ToggleSwitch_on mx_ToggleSwitch_enabled"
id="mx_SettingsFlag_vY7Q4uEh9K38"
role="switch"
tabindex="0"
class="_inline-field_19upo_32"
>
<div
class="mx_ToggleSwitch_ball"
/>
class="_inline-field-control_19upo_44"
>
<div
class="_container_19o42_10"
>
<input
checked=""
class="_input_19o42_24"
id="mx_SettingsFlag_vY7Q4uEh9K38"
role="switch"
type="checkbox"
/>
<div
class="_ui_19o42_34"
/>
</div>
</div>
<div
class="_inline-field-body_19upo_38"
>
<label
class="_label_19upo_59"
for="mx_SettingsFlag_vY7Q4uEh9K38"
>
Enable inline URL previews by default
</label>
</div>
</div>
</div>
</div>
</fieldset>
</fieldset>
</form>
</DocumentFragment>
`;
exports[`UrlPreviewSettings should display the correct preview when the setting is in a loading state 1`] = `
<DocumentFragment>
<fieldset
class="mx_SettingsFieldset"
<form
class="_root_19upo_16"
>
<legend
class="mx_SettingsFieldset_legend"
<fieldset
class="mx_SettingsFieldset"
>
URL Previews
</legend>
<div
class="mx_SettingsFieldset_content"
>
<svg
class="_icon_11k6c_18"
fill="currentColor"
height="1em"
style="width: 20px; height: 20px;"
viewBox="0 0 24 24"
width="1em"
xmlns="http://www.w3.org/2000/svg"
<legend
class="mx_SettingsFieldset_legend"
>
<path
clip-rule="evenodd"
d="M12 4.031a8 8 0 1 0 8 8 1 1 0 0 1 2 0c0 5.523-4.477 10-10 10s-10-4.477-10-10 4.477-10 10-10a1 1 0 1 1 0 2"
fill-rule="evenodd"
/>
</svg>
</div>
</fieldset>
URL Previews
</legend>
<div
class="mx_SettingsFieldset_content"
>
<svg
class="_icon_11k6c_18"
fill="currentColor"
height="1em"
style="width: 20px; height: 20px;"
viewBox="0 0 24 24"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path
clip-rule="evenodd"
d="M12 4.031a8 8 0 1 0 8 8 1 1 0 0 1 2 0c0 5.523-4.477 10-10 10s-10-4.477-10-10 4.477-10 10-10a1 1 0 1 1 0 2"
fill-rule="evenodd"
/>
</svg>
</div>
</fieldset>
</form>
</DocumentFragment>
`;

View File

@ -70,12 +70,12 @@ describe("<LayoutSwitcher />", () => {
await SettingsStore.setValue("useCompactLayout", null, SettingLevel.DEVICE, true);
await renderLayoutSwitcher();
expect(screen.getByRole("checkbox", { name: "Show compact text and messages" })).toBeChecked();
expect(screen.getByRole("switch", { name: "Show compact text and messages" })).toBeChecked();
});
it("should change the setting when toggled", async () => {
await renderLayoutSwitcher();
act(() => screen.getByRole("checkbox", { name: "Show compact text and messages" }).click());
act(() => screen.getByRole("switch", { name: "Show compact text and messages" }).click());
await waitFor(() => expect(SettingsStore.getValue("useCompactLayout")).toBe(true));
});
@ -83,7 +83,7 @@ describe("<LayoutSwitcher />", () => {
it("should be disabled when the modern layout is not enabled", async () => {
await SettingsStore.setValue("layout", null, SettingLevel.DEVICE, Layout.Bubble);
await renderLayoutSwitcher();
expect(screen.getByRole("checkbox", { name: "Show compact text and messages" })).toBeDisabled();
expect(screen.getByRole("switch", { name: "Show compact text and messages" })).toBeDisabled();
});
});
});

View File

@ -348,10 +348,10 @@ describe("<Notifications />", () => {
await getComponentAndWait();
expect(screen.getByLabelText("Enable notifications for this account")).toBeInTheDocument();
expect(screen.getByTestId("notif-device-switch")).toBeInTheDocument();
expect(screen.getByTestId("notif-setting-notificationsEnabled")).toBeInTheDocument();
expect(screen.getByTestId("notif-setting-notificationBodyEnabled")).toBeInTheDocument();
expect(screen.getByTestId("notif-setting-audioNotificationsEnabled")).toBeInTheDocument();
expect(screen.getByLabelText("Enable notifications for this device")).toBeInTheDocument();
expect(screen.getByLabelText("Enable desktop notifications for this session")).toBeInTheDocument();
expect(screen.getByLabelText("Show message preview in desktop notification")).toBeInTheDocument();
expect(screen.getByLabelText("Enable audible notifications for this session")).toBeInTheDocument();
});
describe("email switches", () => {
@ -370,7 +370,7 @@ describe("<Notifications />", () => {
it("renders email switches correctly when email 3pids exist", async () => {
await getComponentAndWait();
expect(screen.getByTestId("notif-email-switch")).toBeInTheDocument();
expect(screen.getByLabelText(`Enable email notifications for ${testEmail}`)).toBeInTheDocument();
});
it("renders email switches correctly when notifications are on for email", async () => {
@ -379,14 +379,14 @@ describe("<Notifications />", () => {
});
await getComponentAndWait();
const emailSwitch = screen.getByTestId("notif-email-switch");
expect(emailSwitch.querySelector('[aria-checked="true"]')).toBeInTheDocument();
const emailSwitch = screen.getByLabelText(`Enable email notifications for ${testEmail}`);
expect(emailSwitch).toBeChecked();
});
it("enables email notification when toggling on", async () => {
await getComponentAndWait();
const emailToggle = screen.getByTestId("notif-email-switch").querySelector('div[role="switch"]')!;
const emailToggle = screen.getByLabelText(`Enable email notifications for ${testEmail}`);
fireEvent.click(emailToggle);
expect(mockClient.setPusher).toHaveBeenCalledWith(
@ -405,7 +405,7 @@ describe("<Notifications />", () => {
mockClient.setPusher.mockRejectedValue({});
await getComponentAndWait();
const emailToggle = screen.getByTestId("notif-email-switch").querySelector('div[role="switch"]')!;
const emailToggle = screen.getByLabelText(`Enable email notifications for ${testEmail}`);
fireEvent.click(emailToggle);
// force render
@ -431,7 +431,7 @@ describe("<Notifications />", () => {
mockClient.getPushers.mockResolvedValue({ pushers: [testPusher] });
await getComponentAndWait();
const emailToggle = screen.getByTestId("notif-email-switch").querySelector('div[role="switch"]')!;
const emailToggle = screen.getByLabelText(`Enable email notifications for ${testEmail}`);
fireEvent.click(emailToggle);
expect(mockClient.removePusher).toHaveBeenCalledWith(testPusher.pushkey, testPusher.app_id);
@ -452,22 +452,20 @@ describe("<Notifications />", () => {
it("toggles and sets settings correctly", async () => {
await getComponentAndWait();
let audioNotifsToggle!: HTMLDivElement;
let audioNotifsToggle!: HTMLInputElement;
const update = () => {
audioNotifsToggle = screen
.getByTestId("notif-setting-audioNotificationsEnabled")
.querySelector('div[role="switch"]')!;
audioNotifsToggle = screen.getByLabelText("Enable audible notifications for this session");
};
update();
expect(audioNotifsToggle.getAttribute("aria-checked")).toEqual("true");
expect(audioNotifsToggle).toBeChecked();
expect(SettingsStore.getValue("audioNotificationsEnabled")).toEqual(true);
fireEvent.click(audioNotifsToggle);
update();
expect(audioNotifsToggle.getAttribute("aria-checked")).toEqual("false");
expect(audioNotifsToggle).not.toBeChecked();
expect(SettingsStore.getValue("audioNotificationsEnabled")).toEqual(false);
});
});

View File

@ -56,24 +56,24 @@ describe("<ThemeChoicePanel />", () => {
describe("system theme", () => {
it("should disable Match system theme", async () => {
render(<ThemeChoicePanel />);
expect(screen.getByRole("checkbox", { name: "Match system theme" })).not.toBeChecked();
expect(screen.getByRole("switch", { name: "Match system theme" })).not.toBeChecked();
});
it("should enable Match system theme", async () => {
await enableSystemTheme(true);
render(<ThemeChoicePanel />);
expect(screen.getByRole("checkbox", { name: "Match system theme" })).toBeChecked();
expect(screen.getByRole("switch", { name: "Match system theme" })).toBeChecked();
});
it("should change the system theme when clicked", async () => {
jest.spyOn(SettingsStore, "setValue");
render(<ThemeChoicePanel />);
act(() => screen.getByRole("checkbox", { name: "Match system theme" }).click());
act(() => screen.getByRole("switch", { name: "Match system theme" }).click());
// The system theme should be enabled
expect(screen.getByRole("checkbox", { name: "Match system theme" })).toBeChecked();
expect(screen.getByRole("switch", { name: "Match system theme" })).toBeChecked();
expect(SettingsStore.setValue).toHaveBeenCalledWith("use_system_theme", null, "device", true);
});
});

View File

@ -418,6 +418,7 @@ exports[`<LayoutSwitcher /> should render 1`] = `
class="_input_19o42_24"
id="radix-«rr»"
name="compactLayout"
role="switch"
title=""
type="checkbox"
/>

View File

@ -2,94 +2,114 @@
exports[`<Notifications /> main notification switches renders only enable notifications switch when notifications are disabled 1`] = `
<div>
<div
class="mx_SettingsFlag"
data-testid="notif-master-switch"
<form
class="_root_19upo_16"
>
<span
class="mx_SettingsFlag_label"
>
<div
id="mx_LabelledToggleSwitch_«r0»"
>
Enable notifications for this account
</div>
<span
class="mx_Caption"
id="mx_LabelledToggleSwitch_«r0»_caption"
>
Turn off to disable notifications on all your devices and sessions
</span>
</span>
<div
aria-checked="false"
aria-describedby="mx_LabelledToggleSwitch_«r0»_caption"
aria-disabled="false"
aria-labelledby="mx_LabelledToggleSwitch_«r0»"
class="mx_AccessibleButton mx_ToggleSwitch mx_ToggleSwitch_enabled"
role="switch"
tabindex="0"
class="_inline-field_19upo_32"
>
<div
class="mx_ToggleSwitch_ball"
/>
</div>
</div>
<div>
<div
class="mx_SettingsFlag"
>
<label
class="mx_SettingsFlag_label"
for="mx_SettingsFlag_testid_0"
>
<span
class="mx_SettingsFlag_labelText"
>
Show all activity in the room list (dots or number of unread messages)
</span>
</label>
<div
aria-checked="true"
aria-disabled="false"
aria-label="Show all activity in the room list (dots or number of unread messages)"
class="mx_AccessibleButton mx_ToggleSwitch mx_ToggleSwitch_on mx_ToggleSwitch_enabled"
id="mx_SettingsFlag_testid_0"
role="switch"
tabindex="0"
class="_inline-field-control_19upo_44"
>
<div
class="mx_ToggleSwitch_ball"
/>
class="_container_19o42_10"
>
<input
class="_input_19o42_24"
id="«r0»"
role="switch"
type="checkbox"
/>
<div
class="_ui_19o42_34"
/>
</div>
</div>
<div
class="_inline-field-body_19upo_38"
>
<label
class="_label_19upo_59"
for="«r0»"
>
Enable notifications for this account
</label>
<span
class="_message_19upo_85 _help-message_19upo_91"
id="radix-«r2»"
>
Turn off to disable notifications on all your devices and sessions
</span>
</div>
</div>
<div
class="mx_SettingsFlag"
<form
class="_root_19upo_16"
>
<label
class="mx_SettingsFlag_label"
for="mx_SettingsFlag_testid_1"
>
<span
class="mx_SettingsFlag_labelText"
>
Only show notifications in the thread activity centre
</span>
</label>
<div
aria-checked="true"
aria-disabled="false"
aria-label="Only show notifications in the thread activity centre"
class="mx_AccessibleButton mx_ToggleSwitch mx_ToggleSwitch_on mx_ToggleSwitch_enabled"
id="mx_SettingsFlag_testid_1"
role="switch"
tabindex="0"
class="_inline-field_19upo_32"
>
<div
class="mx_ToggleSwitch_ball"
/>
class="_inline-field-control_19upo_44"
>
<div
class="_container_19o42_10"
>
<input
checked=""
class="_input_19o42_24"
id="mx_SettingsFlag_testid_0"
role="switch"
type="checkbox"
/>
<div
class="_ui_19o42_34"
/>
</div>
</div>
<div
class="_inline-field-body_19upo_38"
>
<label
class="_label_19upo_59"
for="mx_SettingsFlag_testid_0"
>
Show all activity in the room list (dots or number of unread messages)
</label>
</div>
</div>
</div>
</div>
<div
class="_inline-field_19upo_32"
>
<div
class="_inline-field-control_19upo_44"
>
<div
class="_container_19o42_10"
>
<input
checked=""
class="_input_19o42_24"
id="mx_SettingsFlag_testid_1"
role="switch"
type="checkbox"
/>
<div
class="_ui_19o42_34"
/>
</div>
</div>
<div
class="_inline-field-body_19upo_38"
>
<label
class="_label_19upo_59"
for="mx_SettingsFlag_testid_1"
>
Only show notifications in the thread activity centre
</label>
</div>
</div>
</form>
</form>
</div>
`;

View File

@ -1,8 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`SetIntegrationManager should render manage integrations sections 1`] = `
<div
class="mx_SetIntegrationManager"
<form
class="_root_19upo_16 mx_SetIntegrationManager"
data-testid="mx_SetIntegrationManager"
>
<div
@ -18,6 +18,7 @@ exports[`SetIntegrationManager should render manage integrations sections 1`] =
</h3>
<h4
class="mx_Heading_h4"
id="mx_SetIntegrationManager_ManagerName"
>
(scalar.vector.im)
</h4>
@ -25,6 +26,7 @@ exports[`SetIntegrationManager should render manage integrations sections 1`] =
</div>
<div
class="mx_SettingsSubsection_text"
id="mx_SetIntegrationManager_BodyText"
>
<span>
Use an integration manager
@ -39,40 +41,36 @@ exports[`SetIntegrationManager should render manage integrations sections 1`] =
>
Integration managers receive configuration data, and can modify widgets, send room invites, and set power levels on your behalf.
</div>
<form
class="_root_19upo_16"
<div
class="_inline-field_19upo_32"
>
<div
class="_inline-field_19upo_32"
class="_inline-field-control_19upo_44"
>
<div
class="_inline-field-control_19upo_44"
class="_container_19o42_10"
>
<input
class="_input_19o42_24"
id="«r0»"
role="switch"
type="checkbox"
/>
<div
class="_container_19o42_10"
>
<input
class="_input_19o42_24"
id="mx_SetIntegrationManager_Toggle"
role="switch"
type="checkbox"
/>
<div
class="_ui_19o42_34"
/>
</div>
</div>
<div
class="_inline-field-body_19upo_38"
>
<label
class="_label_19upo_59"
for="mx_SetIntegrationManager_Toggle"
>
Enable the integration manager
</label>
class="_ui_19o42_34"
/>
</div>
</div>
</form>
</div>
<div
class="_inline-field-body_19upo_38"
>
<label
class="_label_19upo_59"
for="«r0»"
>
Enable the integration manager
</label>
</div>
</div>
</form>
`;

View File

@ -34,6 +34,7 @@ exports[`<ThemeChoicePanel /> custom theme should display custom theme 1`] = `
class="_input_19o42_24"
id="radix-«r28»"
name="systemTheme"
role="switch"
title=""
type="checkbox"
/>
@ -312,6 +313,7 @@ exports[`<ThemeChoicePanel /> custom theme should render the custom theme sectio
class="_input_19o42_24"
id="radix-«r10»"
name="systemTheme"
role="switch"
title=""
type="checkbox"
/>
@ -590,6 +592,7 @@ exports[`<ThemeChoicePanel /> renders the theme choice UI 1`] = `
class="_input_19o42_24"
id="radix-«r0»"
name="systemTheme"
role="switch"
title=""
type="checkbox"
/>

View File

@ -74,7 +74,7 @@ describe("<AdvancedPanel />", () => {
await renderAdvancedPanel();
expect(screen.getByTestId("otherSettings")).toMatchSnapshot();
const checkbox = screen.getByRole("checkbox", {
const checkbox = screen.getByRole("switch", {
name: "In encrypted rooms, only send messages to verified users",
});
expect(checkbox).toBeChecked();

View File

@ -224,6 +224,7 @@ exports[`<AdvancedPanel /> <OtherSettings /> should display the blacklist of unv
class="_input_19o42_24"
id="radix-«r6»"
name="neverSendEncrypted"
role="switch"
title=""
type="checkbox"
/>

View File

@ -114,7 +114,7 @@ describe("<Notifications />", () => {
expect(screen.container).toMatchSnapshot();
const globalMute = screen.getByLabelText(labelGlobalMute);
expect(globalMute).toHaveAttribute("aria-disabled", "true");
expect(globalMute).toBeDisabled();
const levelAllMessages = screen.getByLabelText(labelLevelAllMessage);
expect(levelAllMessages).toBeDisabled();

View File

@ -169,7 +169,7 @@ describe("<SecurityRoomSettingsTab />", () => {
fireEvent.click(screen.getByText("Show advanced"));
expect(screen.getByLabelText("Enable guest access").getAttribute("aria-checked")).toBe("false");
expect(screen.getByLabelText("Enable guest access")).not.toBeChecked();
});
it("updates guest access on toggle", () => {
@ -181,7 +181,7 @@ describe("<SecurityRoomSettingsTab />", () => {
fireEvent.click(screen.getByLabelText("Enable guest access"));
// toggle set immediately
expect(screen.getByLabelText("Enable guest access").getAttribute("aria-checked")).toBe("true");
expect(screen.getByLabelText("Enable guest access")).toBeChecked();
expect(client.sendStateEvent).toHaveBeenCalledWith(
room.roomId,
@ -202,14 +202,14 @@ describe("<SecurityRoomSettingsTab />", () => {
fireEvent.click(screen.getByLabelText("Enable guest access"));
// toggle set immediately
expect(screen.getByLabelText("Enable guest access").getAttribute("aria-checked")).toBe("false");
expect(screen.getByLabelText("Enable guest access")).not.toBeChecked();
await flushPromises();
expect(client.sendStateEvent).toHaveBeenCalled();
expect(logger.error).toHaveBeenCalledWith("oups");
// toggle reset to old value
expect(screen.getByLabelText("Enable guest access").getAttribute("aria-checked")).toBe("true");
expect(screen.getByLabelText("Enable guest access")).toBeChecked();
});
});
@ -305,7 +305,7 @@ describe("<SecurityRoomSettingsTab />", () => {
await waitFor(() => expect(screen.getByLabelText("Encrypted")).toBeChecked());
// can't disable encryption once enabled
expect(screen.getByLabelText("Encrypted").getAttribute("aria-disabled")).toEqual("true");
expect(screen.getByLabelText("Encrypted")).toBeDisabled();
});
it("asks users to confirm when setting room to encrypted", async () => {
@ -412,7 +412,7 @@ describe("<SecurityRoomSettingsTab />", () => {
getComponent(room);
await waitFor(() => expect(screen.getByLabelText("Encrypted")).toBeChecked());
expect(screen.getByLabelText("Encrypted").getAttribute("aria-disabled")).toEqual("true");
expect(screen.getByLabelText("Encrypted")).toBeDisabled();
expect(screen.getByText("Once enabled, encryption cannot be disabled.")).toBeInTheDocument();
});
@ -422,7 +422,7 @@ describe("<SecurityRoomSettingsTab />", () => {
getComponent(room);
await waitFor(() => expect(screen.getByLabelText("Encrypted")).not.toBeChecked());
expect(screen.getByLabelText("Encrypted").getAttribute("aria-disabled")).toEqual("true");
expect(screen.getByLabelText("Encrypted")).toBeDisabled();
expect(screen.queryByText("Once enabled, encryption cannot be disabled.")).not.toBeInTheDocument();
expect(screen.getByText("Your server requires encryption to be disabled.")).toBeInTheDocument();
});

View File

@ -43,7 +43,7 @@ describe("VoipRoomSettingsTab", () => {
};
const getElementCallSwitch = (tab: RenderResult): HTMLElement => {
return tab.container.querySelector("[data-testid='element-call-switch']")!;
return tab.getByLabelText("Enable Element Call as an additional calling option in this room")!;
};
describe("correct state", () => {
@ -52,7 +52,7 @@ describe("VoipRoomSettingsTab", () => {
const tab = renderTab();
expect(getElementCallSwitch(tab).querySelector("[aria-checked='true']")).toBeTruthy();
expect(getElementCallSwitch(tab)).toBeChecked();
});
it.each([1, 50, 100])("shows disabled when call member power level is 0", (level: number) => {
@ -60,7 +60,7 @@ describe("VoipRoomSettingsTab", () => {
const tab = renderTab();
expect(getElementCallSwitch(tab).querySelector("[aria-checked='false']")).toBeTruthy();
expect(getElementCallSwitch(tab)).not.toBeChecked();
});
});
@ -75,7 +75,7 @@ describe("VoipRoomSettingsTab", () => {
const tab = renderTab();
fireEvent.click(getElementCallSwitch(tab).querySelector(".mx_ToggleSwitch")!);
fireEvent.click(getElementCallSwitch(tab));
await waitFor(() =>
expect(cli.sendStateEvent).toHaveBeenCalledWith(
room.roomId,
@ -95,7 +95,7 @@ describe("VoipRoomSettingsTab", () => {
const tab = renderTab();
fireEvent.click(getElementCallSwitch(tab).querySelector(".mx_ToggleSwitch")!);
fireEvent.click(getElementCallSwitch(tab));
await waitFor(() =>
expect(cli.sendStateEvent).toHaveBeenCalledWith(
room.roomId,
@ -116,7 +116,7 @@ describe("VoipRoomSettingsTab", () => {
const tab = renderTab();
fireEvent.click(getElementCallSwitch(tab).querySelector(".mx_ToggleSwitch")!);
fireEvent.click(getElementCallSwitch(tab));
await waitFor(() =>
expect(cli.sendStateEvent).toHaveBeenCalledWith(
room.roomId,

View File

@ -89,7 +89,7 @@ describe("PreferencesUserSettingsTab", () => {
renderTab();
const toggle = await screen.findByRole("switch", { name: "Allow spell check" });
expect(toggle).toHaveAttribute("aria-checked", "false");
expect(toggle).not.toBeDisabled();
await userEvent.click(toggle);
@ -149,7 +149,7 @@ describe("PreferencesUserSettingsTab", () => {
mockGetValue(false);
const toggle = getToggle();
await waitFor(() => expect(toggle).toHaveAttribute("aria-disabled", "false"));
await waitFor(() => expect(toggle).not.toBeDisabled());
fireEvent.click(toggle);
expectSetValueToHaveBeenCalled("sendReadReceipts", null, SettingLevel.ACCOUNT, true);
});
@ -158,7 +158,7 @@ describe("PreferencesUserSettingsTab", () => {
mockGetValue(true);
const toggle = getToggle();
await waitFor(() => expect(toggle).toHaveAttribute("aria-disabled", "false"));
await waitFor(() => expect(toggle).not.toBeDisabled());
fireEvent.click(toggle);
expectSetValueToHaveBeenCalled("sendReadReceipts", null, SettingLevel.ACCOUNT, false);
});
@ -172,8 +172,8 @@ describe("PreferencesUserSettingsTab", () => {
it("is forcibly enabled", async () => {
const toggle = getToggle();
await waitFor(() => {
expect(toggle).toHaveAttribute("aria-checked", "true");
expect(toggle).toHaveAttribute("aria-disabled", "true");
expect(toggle).toBeChecked();
expect(toggle).toBeDisabled();
});
});
@ -181,7 +181,8 @@ describe("PreferencesUserSettingsTab", () => {
mockGetValue(true);
const toggle = getToggle();
await waitFor(() => expect(toggle).toHaveAttribute("aria-disabled", "true"));
await waitFor(() => expect(toggle).toBeDisabled());
console.log(toggle.innerHTML);
fireEvent.click(toggle);
expect(SettingsStore.setValue).not.toHaveBeenCalled();
});

View File

@ -15,24 +15,24 @@ exports[`AppearanceUserSettingsTab should render 1`] = `
<div
class="mx_SettingsSection_subSections"
>
<div
class="mx_SettingsSubsection mx_SettingsSubsection_newUi"
data-testid="themePanel"
<form
class="_root_19upo_16"
>
<div
class="mx_SettingsSubsectionHeading"
class="mx_SettingsSubsection mx_SettingsSubsection_newUi"
data-testid="themePanel"
>
<h3
class="mx_Heading_h4 mx_SettingsSubsectionHeading_heading"
<div
class="mx_SettingsSubsectionHeading"
>
Theme
</h3>
</div>
<div
class="mx_SettingsSubsection_content mx_SettingsSubsection_content_newUi"
>
<form
class="_root_19upo_16 mx_ThemeChoicePanel_ThemeSelectors"
<h3
class="mx_Heading_h4 mx_SettingsSubsectionHeading_heading"
>
Theme
</h3>
</div>
<div
class="mx_SettingsSubsection_content mx_SettingsSubsection_content_newUi"
>
<div
class="_inline-field_19upo_32 mx_ThemeChoicePanel_themeSelector mx_ThemeChoicePanel_themeSelector_disabled cpd-theme-light"
@ -136,15 +136,15 @@ exports[`AppearanceUserSettingsTab should render 1`] = `
</label>
</div>
</div>
</form>
</div>
<div
class="_separator_7ckbw_8"
data-kind="primary"
data-orientation="horizontal"
role="separator"
/>
</div>
<div
class="_separator_7ckbw_8"
data-kind="primary"
data-orientation="horizontal"
role="separator"
/>
</div>
</form>
<div
class="mx_SettingsSubsection mx_SettingsSubsection_newUi"
data-testid="layoutPanel"
@ -561,6 +561,7 @@ exports[`AppearanceUserSettingsTab should render 1`] = `
class="_input_19o42_24"
id="radix-«ru»"
name="compactLayout"
role="switch"
title=""
type="checkbox"
/>

View File

@ -34,8 +34,8 @@ exports[`<SecurityUserSettingsTab /> renders security section 1`] = `
<div
class="mx_SettingsTab_sections"
>
<div
class="mx_SetIntegrationManager"
<form
class="_root_19upo_16 mx_SetIntegrationManager"
data-testid="mx_SetIntegrationManager"
>
<div
@ -51,6 +51,7 @@ exports[`<SecurityUserSettingsTab /> renders security section 1`] = `
</h3>
<h4
class="mx_Heading_h4"
id="mx_SetIntegrationManager_ManagerName"
>
(scalar.vector.im)
</h4>
@ -58,6 +59,7 @@ exports[`<SecurityUserSettingsTab /> renders security section 1`] = `
</div>
<div
class="mx_SettingsSubsection_text"
id="mx_SetIntegrationManager_BodyText"
>
<span>
Use an integration manager
@ -72,92 +74,92 @@ exports[`<SecurityUserSettingsTab /> renders security section 1`] = `
>
Integration managers receive configuration data, and can modify widgets, send room invites, and set power levels on your behalf.
</div>
<form
class="_root_19upo_16"
<div
class="_inline-field_19upo_32"
>
<div
class="_inline-field_19upo_32"
class="_inline-field-control_19upo_44"
>
<div
class="_inline-field-control_19upo_44"
class="_container_19o42_10"
>
<input
checked=""
class="_input_19o42_24"
id="«r0»"
role="switch"
type="checkbox"
/>
<div
class="_container_19o42_10"
>
<input
checked=""
class="_input_19o42_24"
id="mx_SetIntegrationManager_Toggle"
role="switch"
type="checkbox"
/>
<div
class="_ui_19o42_34"
/>
</div>
</div>
<div
class="_inline-field-body_19upo_38"
>
<label
class="_label_19upo_59"
for="mx_SetIntegrationManager_Toggle"
>
Enable the integration manager
</label>
class="_ui_19o42_34"
/>
</div>
</div>
</form>
</div>
<div
class="mx_SettingsSection"
>
<h2
class="mx_Heading_h3"
>
Encryption
</h2>
<div
class="mx_SettingsSection_subSections"
>
<div
class="mx_SettingsSubsection"
class="_inline-field-body_19upo_38"
>
<label
class="_label_19upo_59"
for="«r0»"
>
Enable the integration manager
</label>
</div>
</div>
</form>
<form
class="_root_19upo_16"
>
<div
class="mx_SettingsSection"
>
<h2
class="mx_Heading_h3"
>
Encryption
</h2>
<div
class="mx_SettingsSection_subSections"
>
<div
class="mx_SettingsSubsectionHeading"
>
<h3
class="mx_Heading_h4 mx_SettingsSubsectionHeading_heading"
>
Message search
</h3>
</div>
<div
class="mx_SettingsSubsection_content"
class="mx_SettingsSubsection"
>
<div
class="mx_SettingsSubsection_text"
class="mx_SettingsSubsectionHeading"
>
<span>
Element can't securely cache encrypted messages locally while running in a web browser. Use
<a
class="mx_ExternalLink"
href="https://element.io/get-started"
rel="noreferrer noopener"
target="_blank"
>
Element Desktop
<i
class="mx_ExternalLink_icon"
/>
</a>
for encrypted messages to appear in search results.
</span>
<h3
class="mx_Heading_h4 mx_SettingsSubsectionHeading_heading"
>
Message search
</h3>
</div>
<div
class="mx_SettingsSubsection_content"
>
<div
class="mx_SettingsSubsection_text"
>
<span>
Element can't securely cache encrypted messages locally while running in a web browser. Use
<a
class="mx_ExternalLink"
href="https://element.io/get-started"
rel="noreferrer noopener"
target="_blank"
>
Element Desktop
<i
class="mx_ExternalLink_icon"
/>
</a>
for encrypted messages to appear in search results.
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<div
class="mx_SettingsSection"
>
@ -213,7 +215,7 @@ exports[`<SecurityUserSettingsTab /> renders security section 1`] = `
>
<label
class="_label_19upo_59"
for="radix-«r1»"
for="radix-«r2»"
>
Enter a new identity server
</label>
@ -222,7 +224,7 @@ exports[`<SecurityUserSettingsTab /> renders security section 1`] = `
>
<input
class="_control_sqdq4_10"
id="radix-«r1»"
id="radix-«r2»"
name="input"
placeholder=""
title=""
@ -235,6 +237,9 @@ exports[`<SecurityUserSettingsTab /> renders security section 1`] = `
</fieldset>
</div>
</div>
<form
class="_root_19upo_16"
/>
</div>
</div>
<div

View File

@ -150,7 +150,7 @@ describe("<SpaceSettingsVisibilityTab />", () => {
await toggleGuestAccessSection(component);
const guestAccessInput = getGuestAccessToggle(component);
expect(guestAccessInput?.getAttribute("aria-checked")).toEqual("true");
expect(guestAccessInput).toBeChecked();
fireEvent.click(guestAccessInput!);
expect(mockMatrixClient.sendStateEvent).toHaveBeenCalledWith(
@ -162,7 +162,7 @@ describe("<SpaceSettingsVisibilityTab />", () => {
);
// toggled off
expect(guestAccessInput?.getAttribute("aria-checked")).toEqual("false");
expect(guestAccessInput).not.toBeChecked();
});
it("renders error message when update fails", async () => {
@ -184,7 +184,7 @@ describe("<SpaceSettingsVisibilityTab />", () => {
await toggleGuestAccessSection(component);
expect(getGuestAccessToggle(component)?.getAttribute("aria-disabled")).toEqual("true");
expect(getGuestAccessToggle(component)).toBeDisabled();
});
});
@ -194,7 +194,7 @@ describe("<SpaceSettingsVisibilityTab />", () => {
const component = getComponent({ space });
// toggle off because space settings is != WorldReadable
expect(getHistoryVisibilityToggle(component)?.getAttribute("aria-checked")).toEqual("false");
expect(getHistoryVisibilityToggle(component)).not.toBeChecked();
});
it("updates history visibility on toggle", () => {
@ -202,7 +202,7 @@ describe("<SpaceSettingsVisibilityTab />", () => {
const component = getComponent({ space });
// toggle off because space settings is != WorldReadable
expect(getHistoryVisibilityToggle(component)?.getAttribute("aria-checked")).toEqual("false");
expect(getHistoryVisibilityToggle(component)).not.toBeChecked();
fireEvent.click(getHistoryVisibilityToggle(component)!);
expect(mockMatrixClient.sendStateEvent).toHaveBeenCalledWith(
@ -212,7 +212,7 @@ describe("<SpaceSettingsVisibilityTab />", () => {
"",
);
expect(getHistoryVisibilityToggle(component)?.getAttribute("aria-checked")).toEqual("true");
expect(getHistoryVisibilityToggle(component)).toBeChecked();
});
it("renders error message when history update fails", async () => {
@ -231,7 +231,7 @@ describe("<SpaceSettingsVisibilityTab />", () => {
const space = makeMockSpace(mockMatrixClient, joinRule, guestRule, historyRule);
(space.currentState.maySendStateEvent as jest.Mock).mockReturnValue(false);
const component = getComponent({ space });
expect(getHistoryVisibilityToggle(component)?.getAttribute("aria-disabled")).toEqual("true");
expect(getHistoryVisibilityToggle(component)).toBeDisabled();
});
});

View File

@ -1,18 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<SpaceSettingsVisibilityTab /> for a public space Access renders guest access section toggle 1`] = `
<div
aria-checked="true"
aria-disabled="false"
aria-labelledby="mx_LabelledToggleSwitch_«rb»"
class="mx_AccessibleButton mx_ToggleSwitch mx_ToggleSwitch_on mx_ToggleSwitch_enabled"
<input
checked=""
class="_input_19o42_24"
id="«rh»"
role="switch"
tabindex="0"
>
<div
class="mx_ToggleSwitch_ball"
/>
</div>
type="checkbox"
/>
`;
exports[`<SpaceSettingsVisibilityTab /> renders container 1`] = `
@ -112,42 +107,53 @@ exports[`<SpaceSettingsVisibilityTab /> renders container 1`] = `
>
Anyone can find and join.
</span>
<div
class="mx_SettingsTab_toggleWithDescription"
<form
class="_root_19upo_16"
>
<div
class="mx_SettingsFlag"
class="_inline-field_19upo_32"
>
<span
class="mx_SettingsFlag_label"
<div
class="_inline-field-control_19upo_44"
>
<div
id="mx_LabelledToggleSwitch_«r0»"
class="_container_19o42_10"
>
<input
checked=""
class="_input_19o42_24"
id="«r0»"
role="switch"
type="checkbox"
/>
<div
class="_ui_19o42_34"
/>
</div>
</div>
<div
class="_inline-field-body_19upo_38"
>
<label
class="_label_19upo_59"
for="«r0»"
>
Preview Space
</div>
</span>
<div
aria-checked="true"
aria-disabled="false"
aria-labelledby="mx_LabelledToggleSwitch_«r0»"
class="mx_AccessibleButton mx_ToggleSwitch mx_ToggleSwitch_on mx_ToggleSwitch_enabled"
role="switch"
tabindex="0"
>
<div
class="mx_ToggleSwitch_ball"
/>
</label>
<span
class="_message_19upo_85 _help-message_19upo_91"
id="radix-«r2»"
>
Allow people to preview your space before they join.
</span>
</div>
</div>
<p>
Allow people to preview your space before they join.
<br />
<strong>
Recommended for public spaces.
</strong>
</p>
</div>
</form>
</div>
</fieldset>
</div>