From 7df3b45ee3e9debd58b6813eba5395c0fbb1edcd Mon Sep 17 00:00:00 2001
From: Half-Shot
Date: Tue, 8 Jul 2025 17:03:56 +0100
Subject: [PATCH] Fixup unit tests to check correct attributes.
---
.../views/dialogs/CreateRoomDialog-test.tsx | 19 +-
.../ConfirmRejectInviteDialog-test.tsx.snap | 90 +-
.../DevtoolsDialog-test.tsx.snap | 206 +-
.../ReportRoomDialog-test.tsx.snap | 42 +-
.../views/location/LocationShareMenu-test.tsx | 4 +-
.../LocationShareMenu-test.tsx.snap | 67 +-
.../RoomSummaryCardView-test.tsx.snap | 3 +
.../room_settings/UrlPreviewSettings-test.tsx | 8 +-
.../UrlPreviewSettings-test.tsx.snap | 396 +-
.../views/settings/LayoutSwitcher-test.tsx | 6 +-
.../views/settings/Notifications-test.tsx | 30 +-
.../views/settings/ThemeChoicePanel-test.tsx | 8 +-
.../LayoutSwitcher-test.tsx.snap | 1 +
.../__snapshots__/Notifications-test.tsx.snap | 172 +-
.../SetIntegrationManager-test.tsx.snap | 58 +-
.../ThemeChoicePanel-test.tsx.snap | 3 +
.../encryption/AdvancedPanel-test.tsx | 2 +-
.../__snapshots__/AdvancedPanel-test.tsx.snap | 1 +
.../notifications/Notifications2-test.tsx | 2 +-
.../Notifications2-test.tsx.snap | 4271 +++++++++--------
.../room/SecurityRoomSettingsTab-test.tsx | 14 +-
.../tabs/room/VoipRoomSettingsTab-test.tsx | 12 +-
.../user/PreferencesUserSettingsTab-test.tsx | 13 +-
.../AppearanceUserSettingsTab-test.tsx.snap | 45 +-
.../PreferencesUserSettingsTab-test.tsx.snap | 2727 ++++++-----
.../SecurityUserSettingsTab-test.tsx.snap | 149 +-
.../SpaceSettingsVisibilityTab-test.tsx | 14 +-
.../SpaceSettingsVisibilityTab-test.tsx.snap | 72 +-
28 files changed, 4447 insertions(+), 3988 deletions(-)
diff --git a/test/unit-tests/components/views/dialogs/CreateRoomDialog-test.tsx b/test/unit-tests/components/views/dialogs/CreateRoomDialog-test.tsx
index ad3dcd58e9..3e4749b314 100644
--- a/test/unit-tests/components/views/dialogs/CreateRoomDialog-test.tsx
+++ b/test/unit-tests/components/views/dialogs/CreateRoomDialog-test.tsx
@@ -26,9 +26,6 @@ describe("", () => {
});
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("", () => {
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("", () => {
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("", () => {
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("", () => {
// 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("", () => {
// 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("", () => {
// 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("", () => {
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("", () => {
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();
diff --git a/test/unit-tests/components/views/dialogs/__snapshots__/ConfirmRejectInviteDialog-test.tsx.snap b/test/unit-tests/components/views/dialogs/__snapshots__/ConfirmRejectInviteDialog-test.tsx.snap
index c2ca9a5680..64dd8208f6 100644
--- a/test/unit-tests/components/views/dialogs/__snapshots__/ConfirmRejectInviteDialog-test.tsx.snap
+++ b/test/unit-tests/components/views/dialogs/__snapshots__/ConfirmRejectInviteDialog-test.tsx.snap
@@ -31,67 +31,77 @@ exports[`ConfirmRejectInviteDialog can reject with options selected 1`] = `
Are you sure you want to decline the invitation to join "foo"?
-
+
+
+
+
+
+
+
You will not see any messages or room invites from this user.
-
-
-
-
+
+
+
+
+
+
+
Report this room to your account provider.
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Report this room to your account provider. If the messages are encrypted, your admin will not be able to read them.
@@ -65,28 +65,34 @@ exports[`ReportRoomDialog displays admin message 1`] = `
-
+
+
+
+
+
+
-
-
-
+
", () => {
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("", () => {
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", () => {
diff --git a/test/unit-tests/components/views/location/__snapshots__/LocationShareMenu-test.tsx.snap b/test/unit-tests/components/views/location/__snapshots__/LocationShareMenu-test.tsx.snap
index 3ab56061be..5a7bc0a18d 100644
--- a/test/unit-tests/components/views/location/__snapshots__/LocationShareMenu-test.tsx.snap
+++ b/test/unit-tests/components/views/location/__snapshots__/LocationShareMenu-test.tsx.snap
@@ -18,41 +18,50 @@ exports[` 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.
-
-
- Enable live location sharing
+
+
+
+
-
-
+
+
+
+
+
`;
diff --git a/test/unit-tests/components/views/right_panel/__snapshots__/RoomSummaryCardView-test.tsx.snap b/test/unit-tests/components/views/right_panel/__snapshots__/RoomSummaryCardView-test.tsx.snap
index be6fdd5fcf..fea2a68e38 100644
--- a/test/unit-tests/components/views/right_panel/__snapshots__/RoomSummaryCardView-test.tsx.snap
+++ b/test/unit-tests/components/views/right_panel/__snapshots__/RoomSummaryCardView-test.tsx.snap
@@ -213,6 +213,7 @@ exports[` has button to edit topic 1`] = `
aria-hidden="true"
class="_input_19o42_24"
id="«rv»"
+ role="switch"
type="checkbox"
/>
renders the room summary 1`] = `
aria-hidden="true"
class="_input_19o42_24"
id="«r5»"
+ role="switch"
type="checkbox"
/>
renders the room topic in the summary 1`] = `
aria-hidden="true"
class="_input_19o42_24"
id="«ri»"
+ role="switch"
type="checkbox"
/>
{
});
function renderComponent() {
- return render(, withClientContextRenderOptions(client));
+ return render(
+
+
+ ,
+ withClientContextRenderOptions(client),
+ );
}
it("should display the correct preview when the setting is in a loading state", () => {
diff --git a/test/unit-tests/components/views/room_settings/__snapshots__/UrlPreviewSettings-test.tsx.snap b/test/unit-tests/components/views/room_settings/__snapshots__/UrlPreviewSettings-test.tsx.snap
index 017f4bc2bb..3afe325a98 100644
--- a/test/unit-tests/components/views/room_settings/__snapshots__/UrlPreviewSettings-test.tsx.snap
+++ b/test/unit-tests/components/views/room_settings/__snapshots__/UrlPreviewSettings-test.tsx.snap
@@ -2,235 +2,269 @@
exports[`UrlPreviewSettings should display the correct preview when the room is encrypted and the url preview is enabled 1`] = `
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
`;
exports[`UrlPreviewSettings should display the correct preview when the room is unencrypted and the url preview is disabled 1`] = `
-
-
+
+
`;
exports[`UrlPreviewSettings should display the correct preview when the room is unencrypted and the url preview is enabled 1`] = `
-
+
+
`;
exports[`UrlPreviewSettings should display the correct preview when the setting is in a loading state 1`] = `
-
+ URL Previews
+
+
+
+
+
+
`;
diff --git a/test/unit-tests/components/views/settings/LayoutSwitcher-test.tsx b/test/unit-tests/components/views/settings/LayoutSwitcher-test.tsx
index 5d3f1709e2..5ff5f888c7 100644
--- a/test/unit-tests/components/views/settings/LayoutSwitcher-test.tsx
+++ b/test/unit-tests/components/views/settings/LayoutSwitcher-test.tsx
@@ -70,12 +70,12 @@ describe("", () => {
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("", () => {
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();
});
});
});
diff --git a/test/unit-tests/components/views/settings/Notifications-test.tsx b/test/unit-tests/components/views/settings/Notifications-test.tsx
index 6341a105fd..25a4ba880d 100644
--- a/test/unit-tests/components/views/settings/Notifications-test.tsx
+++ b/test/unit-tests/components/views/settings/Notifications-test.tsx
@@ -348,10 +348,10 @@ describe("", () => {
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("", () => {
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("", () => {
});
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("", () => {
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("", () => {
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("", () => {
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);
});
});
diff --git a/test/unit-tests/components/views/settings/ThemeChoicePanel-test.tsx b/test/unit-tests/components/views/settings/ThemeChoicePanel-test.tsx
index f1dbc9a2e0..5332845d1b 100644
--- a/test/unit-tests/components/views/settings/ThemeChoicePanel-test.tsx
+++ b/test/unit-tests/components/views/settings/ThemeChoicePanel-test.tsx
@@ -56,24 +56,24 @@ describe("", () => {
describe("system theme", () => {
it("should disable Match system theme", async () => {
render();
- 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();
- 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();
- 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);
});
});
diff --git a/test/unit-tests/components/views/settings/__snapshots__/LayoutSwitcher-test.tsx.snap b/test/unit-tests/components/views/settings/__snapshots__/LayoutSwitcher-test.tsx.snap
index 6c99c3fbeb..714703c0d0 100644
--- a/test/unit-tests/components/views/settings/__snapshots__/LayoutSwitcher-test.tsx.snap
+++ b/test/unit-tests/components/views/settings/__snapshots__/LayoutSwitcher-test.tsx.snap
@@ -418,6 +418,7 @@ exports[` should render 1`] = `
class="_input_19o42_24"
id="radix-«rr»"
name="compactLayout"
+ role="switch"
title=""
type="checkbox"
/>
diff --git a/test/unit-tests/components/views/settings/__snapshots__/Notifications-test.tsx.snap b/test/unit-tests/components/views/settings/__snapshots__/Notifications-test.tsx.snap
index ae8a4aa46e..67091f7f02 100644
--- a/test/unit-tests/components/views/settings/__snapshots__/Notifications-test.tsx.snap
+++ b/test/unit-tests/components/views/settings/__snapshots__/Notifications-test.tsx.snap
@@ -2,94 +2,114 @@
exports[` main notification switches renders only enable notifications switch when notifications are disabled 1`] = `
-
-
-
- Enable notifications for this account
-
-
- Turn off to disable notifications on all your devices and sessions
-
-
-
-
-
-
-
-
+ class="_container_19o42_10"
+ >
+
+
+
+
+
+
+
+ Turn off to disable notifications on all your devices and sessions
+
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.
+
+ Enable Markdown
+
+
+
+ Start messages with
+
+ /plain
+
+ to send without markdown.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Enable Emoji suggestions while typing
+
+
+
+
+
+
+
+
+
+
+
+
+ Use Ctrl + Enter to send a message
+
+
+
+
+
+
+
+
+
+
+
+
+ Surround selected text when typing special characters
+
+
+
+
+
+
+
+
+
+
+
+
+ Show stickers button
+
+
+
+
+
+
+
+
+
+
+
+
+ Insert a trailing colon after user mentions at the start of a message
+
+
+
+
+
+
+
+
+
+
+ Code blocks
+
+
+
+
+
+
+
+
+
+
+
+
+ Enable automatic language detection for syntax highlighting
+
+
+
+
+
+
+
+
+
+
+
+
+ Expand code blocks by default
+
+
+
+
+
+
+
+
+
+
+
+
+ Show line numbers in code blocks
+
+
+
+
+
+
+
+
+
+
+ Images, GIFs and videos
+
+
+
+
+
+
+
+
+
+
+
+
+ Enable inline URL previews by default
+
+
+
+
+
+
+
+
+
+
+
+
+ Autoplay GIFs
+
+
+
+
+
+
+
+
+
+
+
+
+ Autoplay videos
+
+
+
+
+
+
+
+
+
+
+ Timeline
+
+
+
+
+
+
+
+
+
+
+
+
+ Show typing notifications
+
+
+
+
+
+
+
+
+
+
+
+
+ Show a placeholder for removed messages
+
+
+
+
+
+
+
+
+
+
+
+
+ Show read receipts sent by other users
+
+
+
+
+
+
+
+
+
+
+
+
+ Show join/leave messages (invites/removes/bans unaffected)
+
+
+
+
+
+
+
+
+
+
+
+
+ Show display name changes
+
+
+
+
+
+
+
+
+
+
+
+
+ Show chat effects (animations when receiving e.g. confetti)
+
+
+
+
+
+
+
+
+
+
+
+
+ Show profile picture changes
+
+
+
+
+
+
+
+
+
+
+
+
+ Show avatars in user, room and event mentions
+
+
+
+
+
+
+
+
+
+
+
+
+ Enable big emoji in chat
+
+
+
+
+
+
+
+
+
+
+
+
+ Jump to the bottom of the timeline when you send a message
+
+
+
+
+
+
+
+
+
+
+
+
+ Show current profile picture and name for users in message history
+
+
+
+
+
+
+
+
+
+
+ Moderation and safety
+
+
+
+
+
+
+
+
+
+
+
+
Hide avatars of room and inviter
-
-
-
-
+
Show media in timeline
A hidden media can always be shown by tapping on it
@@ -1296,181 +1531,213 @@ exports[`PreferencesUserSettingsTab should render 1`] = `
-
-
+
+
+
+
+
+
+
+
+
+ Allow users to invite you to rooms
+
+
+ Your server does not implement this feature.
+
+
+
+
+
+
+
+
+
+
+
+
+ Room directory
+
+
+
-
-
- Allow users to invite you to rooms
-
-
+ class="_container_19o42_10"
+ >
+
+
+
+
+
+
+ Show NSFW content
+
-
+
-
-
-
+
-
- Room directory
-
-
-
-
-
- Show NSFW content
-
-
+ General
+
+
+
+
+
+
+
+
+
+
+ Prompt before sending invites to potentially invalid matrix IDs
+
+
+
+
+
+
+ Autocomplete delay (ms)
+
+
+
+
+
+ Read Marker lifetime (ms)
+
+
+
+
+
+ Read Marker off-screen lifetime (ms)
+
-
-
-
-
- General
-
-
-
-
-
-
- Prompt before sending invites to potentially invalid matrix IDs
-
-
-
Use an integration manager
@@ -72,92 +74,92 @@ exports[` renders security section 1`] = `
>
Integration managers receive configuration data, and can modify widgets, send room invites, and set power levels on your behalf.
-
- Element can't securely cache encrypted messages locally while running in a web browser. Use
-
- Element Desktop
-
-
- for encrypted messages to appear in search results.
-
+
+ Message search
+
+
+
+
+
+ Element can't securely cache encrypted messages locally while running in a web browser. Use
+
+ Element Desktop
+
+
+ for encrypted messages to appear in search results.
+
+
-
+
@@ -213,7 +215,7 @@ exports[` renders security section 1`] = `
>
Enter a new identity server
@@ -222,7 +224,7 @@ exports[` renders security section 1`] = `
>
renders security section 1`] = `
+
", () => {
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("", () => {
);
// 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("", () => {
await toggleGuestAccessSection(component);
- expect(getGuestAccessToggle(component)?.getAttribute("aria-disabled")).toEqual("true");
+ expect(getGuestAccessToggle(component)).toBeDisabled();
});
});
@@ -194,7 +194,7 @@ describe("", () => {
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("", () => {
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("", () => {
"",
);
- 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("", () => {
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();
});
});
diff --git a/test/unit-tests/components/views/spaces/__snapshots__/SpaceSettingsVisibilityTab-test.tsx.snap b/test/unit-tests/components/views/spaces/__snapshots__/SpaceSettingsVisibilityTab-test.tsx.snap
index 9e9ab218bc..c66b7399be 100644
--- a/test/unit-tests/components/views/spaces/__snapshots__/SpaceSettingsVisibilityTab-test.tsx.snap
+++ b/test/unit-tests/components/views/spaces/__snapshots__/SpaceSettingsVisibilityTab-test.tsx.snap
@@ -1,18 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[` for a public space Access renders guest access section toggle 1`] = `
-