Skip to content

Commit 18b9c36

Browse files
committed
Add a unit test for BaseDialog
1 parent f712fcd commit 18b9c36

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
Copyright 2025 New Vector Ltd.
3+
4+
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
5+
Please see LICENSE files in the repository root for full details.
6+
*/
7+
8+
import React from "react";
9+
import { render } from "jest-matrix-react";
10+
import userEvent from "@testing-library/user-event";
11+
12+
import BaseDialog from "../../../../../src/components/views/dialogs/BaseDialog.tsx";
13+
14+
describe("BaseDialog", () => {
15+
it("calls onFinished when Escape is pressed", async () => {
16+
const onFinished = jest.fn();
17+
render(<BaseDialog onFinished={onFinished} />);
18+
await userEvent.keyboard("{Escape}");
19+
expect(onFinished).toHaveBeenCalled();
20+
});
21+
});

0 commit comments

Comments
 (0)