Skip to content

Commit c925e40

Browse files
committed
test: add test to RoomListItemView
1 parent 54cb8c7 commit c925e40

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/unit-tests/components/views/rooms/RoomListPanel/RoomListItemView-test.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,17 @@ describe("<RoomListItemView />", () => {
9191
await waitFor(() => expect(screen.getByRole("button", { name: "More Options" })).toBeInTheDocument());
9292
});
9393

94+
test("should hover decoration if focused", async () => {
95+
const user = userEvent.setup();
96+
render(<RoomListItemView room={room} isSelected={false} />, withClientContextRenderOptions(matrixClient));
97+
const listItem = screen.getByRole("button", { name: `Open room ${room.name}` });
98+
await user.click(listItem);
99+
expect(listItem).toHaveClass("mx_RoomListItemView_hover");
100+
101+
await user.tab();
102+
await waitFor(() => expect(listItem).not.toHaveClass("mx_RoomListItemView_hover"));
103+
});
104+
94105
test("should be selected if isSelected=true", async () => {
95106
const { asFragment } = render(<RoomListItemView room={room} isSelected={true} />);
96107
expect(screen.queryByRole("button", { name: `Open room ${room.name}` })).toHaveAttribute(

0 commit comments

Comments
 (0)