From 1d249a2bf8ccdcf0603fa65ff4027ca4b8bc3af7 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Thu, 18 Apr 2024 17:38:32 +0200 Subject: [PATCH] Fix tests --- src/components/views/elements/AccessibleButton.tsx | 1 - test/components/views/right_panel/UserInfo-test.tsx | 10 +++++----- .../spaces/__snapshots__/SpacePanel-test.tsx.snap | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/components/views/elements/AccessibleButton.tsx b/src/components/views/elements/AccessibleButton.tsx index 6a5e0ac10fb6..93245ed73d19 100644 --- a/src/components/views/elements/AccessibleButton.tsx +++ b/src/components/views/elements/AccessibleButton.tsx @@ -191,7 +191,6 @@ const AccessibleButton = forwardRef(function ", () => { }); // there should now be a button with the non-dehydrated device ID - expect(screen.getByRole("button", { description: "d1" })).toBeInTheDocument(); + expect(screen.getByRole("button", { name: "my device" })).toBeInTheDocument(); // but not for the dehydrated device ID - expect(screen.queryByRole("button", { description: "d2" })).not.toBeInTheDocument(); + expect(screen.queryByRole("button", { name: "dehydrated device" })).not.toBeInTheDocument(); // there should be a line saying that the user has "Offline device" enabled expect(screen.getByText("Offline device enabled")).toBeInTheDocument(); @@ -528,7 +528,7 @@ describe("", () => { // the dehydrated device should be shown as an unverified device, which means // there should now be a button with the device id ... - const deviceButton = screen.getByRole("button", { description: "d2" }); + const deviceButton = screen.getByRole("button", { name: "dehydrated device" }); // ... which should contain the device name expect(within(deviceButton).getByText("dehydrated device")).toBeInTheDocument(); @@ -571,12 +571,12 @@ describe("", () => { // the dehydrated devices should be shown as an unverified device, which means // there should now be a button with the first dehydrated device id ... - const device1Button = screen.getByRole("button", { description: "d1" }); + const device1Button = screen.getByRole("button", { name: "dehydrated device 1" }); // ... which should contain the device name expect(within(device1Button).getByText("dehydrated device 1")).toBeInTheDocument(); // and a button with the second dehydrated device id ... - const device2Button = screen.getByRole("button", { description: "d2" }); + const device2Button = screen.getByRole("button", { name: "dehydrated device 2" }); // ... which should contain the device name expect(within(device2Button).getByText("dehydrated device 2")).toBeInTheDocument(); diff --git a/test/components/views/spaces/__snapshots__/SpacePanel-test.tsx.snap b/test/components/views/spaces/__snapshots__/SpacePanel-test.tsx.snap index 04c3cbf31fa2..c0265abfc156 100644 --- a/test/components/views/spaces/__snapshots__/SpacePanel-test.tsx.snap +++ b/test/components/views/spaces/__snapshots__/SpacePanel-test.tsx.snap @@ -14,9 +14,9 @@ exports[` should show all activated MetaSpaces in the correct orde aria-haspopup="true" aria-label="User menu" class="mx_AccessibleButton mx_UserMenu_contextMenuButton" + data-state="closed" role="button" tabindex="0" - title="User menu" >
should show all activated MetaSpaces in the correct orde