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

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
florianduros committed Apr 29, 2024
1 parent 0d349ca commit 9d7e7ee
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ exports[`DateSeparator when feature_jump_to_date is enabled renders the date sep
aria-haspopup="true"
aria-label="Jump to date"
class="mx_AccessibleButton mx_DateSeparator_jumpToDateMenu mx_DateSeparator_dateContent"
data-state="closed"
data-testid="jump-to-date-separator-button"
role="button"
tabindex="0"
Expand Down
16 changes: 8 additions & 8 deletions test/components/views/rooms/RoomList-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ describe("RoomList", () => {
const { rerender } = render(getComponent());

const roomsList = screen.getByRole("group", { name: "Rooms" });
const addRoomButton = within(roomsList).getByRole("button", { name: "Add room" });
const getAddRoomButton = () => within(roomsList).getByRole("button", { name: "Add room" });
expect(screen.queryByRole("menu")).not.toBeInTheDocument();

await userEvent.click(addRoomButton);
await userEvent.click(getAddRoomButton());

const menu = screen.getByRole("menu");

Expand All @@ -102,15 +102,15 @@ describe("RoomList", () => {
disabled = [UIComponent.CreateRooms];
rerender(getComponent());

expect(addRoomButton).toBeInTheDocument();
expect(getAddRoomButton()).toBeInTheDocument();
expect(menu).toBeInTheDocument();
expect(within(menu).queryByRole("menuitem", { name: "New room" })).not.toBeInTheDocument();
expect(within(menu).getByRole("menuitem", { name: "Explore public rooms" })).toBeInTheDocument();

disabled = [UIComponent.ExploreRooms];
rerender(getComponent());

expect(addRoomButton).toBeInTheDocument();
expect(getAddRoomButton()).toBeInTheDocument();
expect(menu).toBeInTheDocument();
expect(within(menu).getByRole("menuitem", { name: "New room" })).toBeInTheDocument();
expect(within(menu).queryByRole("menuitem", { name: "Explore public rooms" })).not.toBeInTheDocument();
Expand Down Expand Up @@ -163,10 +163,10 @@ describe("RoomList", () => {
const { rerender } = render(getComponent());

const roomsList = screen.getByRole("group", { name: "Rooms" });
const addRoomButton = within(roomsList).getByRole("button", { name: "Add room" });
const getAddRoomButton = () => within(roomsList).getByRole("button", { name: "Add room" });
expect(screen.queryByRole("menu")).not.toBeInTheDocument();

await userEvent.click(addRoomButton);
await userEvent.click(getAddRoomButton());

const menu = screen.getByRole("menu");

Expand All @@ -177,7 +177,7 @@ describe("RoomList", () => {
disabled = [UIComponent.CreateRooms];
rerender(getComponent());

expect(addRoomButton).toBeInTheDocument();
expect(getAddRoomButton()).toBeInTheDocument();
expect(menu).toBeInTheDocument();
expect(within(menu).getByRole("menuitem", { name: "Explore rooms" })).toBeInTheDocument();
expect(within(menu).queryByRole("menuitem", { name: "New room" })).not.toBeInTheDocument();
Expand All @@ -186,7 +186,7 @@ describe("RoomList", () => {
disabled = [UIComponent.ExploreRooms];
rerender(getComponent());

expect(addRoomButton).toBeInTheDocument();
expect(getAddRoomButton()).toBeInTheDocument();
expect(menu).toBeInTheDocument();
expect(within(menu).queryByRole("menuitem", { name: "Explore rooms" })).toBeInTheDocument();
expect(within(menu).getByRole("menuitem", { name: "New room" })).toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ exports[`RoomTile when message previews are enabled and there is a message in a
aria-haspopup="true"
aria-label="Room options"
class="mx_AccessibleButton mx_RoomTile_menuButton"
data-state="closed"
role="button"
tabindex="0"
/>
Expand All @@ -67,6 +68,7 @@ exports[`RoomTile when message previews are enabled and there is a message in a
aria-haspopup="true"
aria-label="Notification options"
class="mx_AccessibleButton mx_RoomTile_notificationsButton"
data-state="closed"
role="button"
tabindex="-1"
/>
Expand Down Expand Up @@ -141,6 +143,7 @@ exports[`RoomTile when message previews are enabled and there is a message in th
aria-haspopup="true"
aria-label="Room options"
class="mx_AccessibleButton mx_RoomTile_menuButton"
data-state="closed"
role="button"
tabindex="0"
/>
Expand All @@ -149,6 +152,7 @@ exports[`RoomTile when message previews are enabled and there is a message in th
aria-haspopup="true"
aria-label="Notification options"
class="mx_AccessibleButton mx_RoomTile_notificationsButton"
data-state="closed"
role="button"
tabindex="-1"
/>
Expand Down Expand Up @@ -204,6 +208,7 @@ exports[`RoomTile when message previews are enabled should render a room without
aria-haspopup="true"
aria-label="Room options"
class="mx_AccessibleButton mx_RoomTile_menuButton"
data-state="closed"
role="button"
tabindex="0"
/>
Expand All @@ -212,6 +217,7 @@ exports[`RoomTile when message previews are enabled should render a room without
aria-haspopup="true"
aria-label="Notification options"
class="mx_AccessibleButton mx_RoomTile_notificationsButton"
data-state="closed"
role="button"
tabindex="-1"
/>
Expand Down Expand Up @@ -266,6 +272,7 @@ exports[`RoomTile when message previews are not enabled should render the room 1
aria-haspopup="true"
aria-label="Room options"
class="mx_AccessibleButton mx_RoomTile_menuButton"
data-state="closed"
role="button"
tabindex="0"
/>
Expand All @@ -274,6 +281,7 @@ exports[`RoomTile when message previews are not enabled should render the room 1
aria-haspopup="true"
aria-label="Notification options"
class="mx_AccessibleButton mx_RoomTile_notificationsButton"
data-state="closed"
role="button"
tabindex="-1"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ exports[`<SpacePanel /> should show all activated MetaSpaces in the correct orde
aria-haspopup="true"
aria-label="Options"
class="mx_AccessibleButton mx_SpaceButton_menuButton"
data-state="closed"
role="button"
tabindex="0"
/>
Expand Down

0 comments on commit 9d7e7ee

Please sign in to comment.