forked from element-hq/element-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoomListSectionHeaderView.test.tsx
More file actions
32 lines (26 loc) · 1.07 KB
/
RoomListSectionHeaderView.test.tsx
File metadata and controls
32 lines (26 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
* Copyright 2026 Element Creations Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
* Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { render } from "@test-utils";
import { composeStories } from "@storybook/react-vite";
import { describe, it, expect } from "vitest";
import userEvent from "@testing-library/user-event";
import * as stories from "./RoomListSectionHeaderView.stories";
const { Default } = composeStories(stories);
describe("<RoomListSectionHeaderView /> stories", () => {
it("renders Default story", () => {
const { container } = render(<Default />);
expect(container).toMatchSnapshot();
});
it("should call onClick when the header is clicked", async () => {
const user = userEvent.setup();
const { getByRole } = render(<Default />);
const button = getByRole("gridcell", { name: "Toggle Favourites section" });
await user.click(button);
expect(Default.args.onClick).toHaveBeenCalled();
});
});