Room list: add collapse/expand all sections (#33318)

* chore: update compound design tokens

* feat(sc): add collapse/expand button to room list header

* feat: add new events to broadcast section state

* feat(vm): add expand/collpase event to room list events

* test: add e2e tests

* chore: fix company name in copyright

* chore: use two differant actions for collapse/expand

* Update apps/web/src/viewmodels/room-list/RoomListHeaderViewModel.ts

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>

* test: fix existing tests

---------

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Florian Duros
2026-04-30 16:32:43 +02:00
committed by GitHub
parent a7ab72af11
commit c2e5aa7adc
16 changed files with 392 additions and 14 deletions
@@ -258,6 +258,47 @@ test.describe("Room list custom sections", () => {
});
});
test.describe("Collapse and expand all sections", () => {
test("should collapse all sections when 'Collapse all sections' button is clicked", async ({ page, app }) => {
await app.client.createRoom({ name: "my room" });
await createCustomSection(page, "Work");
const roomList = getRoomList(page);
const header = getRoomListHeader(page);
await expect(getSectionHeader(page, "Chats")).toBeVisible();
await expect(getSectionHeader(page, "Work")).toBeVisible();
const collapseButton = header.getByRole("button", { name: "Collapse all sections" });
await expect(collapseButton).toBeVisible();
await expect(roomList.getByRole("row", { name: "Open room my room" })).toBeVisible();
await collapseButton.click();
await expect(getSectionHeader(page, "Chats")).toHaveAttribute("aria-expanded", "false");
await expect(getSectionHeader(page, "Work")).toHaveAttribute("aria-expanded", "false");
});
test("should expand all sections when 'Expand all sections' button is clicked", async ({ page, app }) => {
await app.client.createRoom({ name: "my room" });
await createCustomSection(page, "Work");
const roomList = getRoomList(page);
const header = getRoomListHeader(page);
await expect(getSectionHeader(page, "Chats")).toBeVisible();
await header.getByRole("button", { name: "Collapse all sections" }).click();
await expect(roomList.getByRole("row", { name: "Open room my room" })).not.toBeVisible();
await header.getByRole("button", { name: "Expand all sections" }).click();
await expect(getSectionHeader(page, "Chats")).toHaveAttribute("aria-expanded", "true");
await expect(getSectionHeader(page, "Work")).toHaveAttribute("aria-expanded", "true");
});
});
test.describe("Adding a room to a custom section", () => {
test("should add a room to a custom section via the More Options menu", async ({ page, app }) => {
await app.client.createRoom({ name: "my room" });