Repository navigation
Expand file tree
/
Copy pathPromptService.test.tsx
More file actions
75 lines (62 loc) · 2.11 KB
/
Copy pathPromptService.test.tsx
File metadata and controls
75 lines (62 loc) · 2.11 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// TODO refactor into e2e Playwright tests
// import React from "react";
// import { PromptDialog } from "@/components/PromptService";
// class ResizeObserver {
// observe() {
// // do nothing
// }
// unobserve() {
// // do nothing
// }
// disconnect() {
// // do nothing
// }
// }
// window.ResizeObserver = ResizeObserver;
// jest.mock("next/navigation", () => ({
// useRouter: jest.fn(),
// }));
// jest.mock("./PromptContext", () => ({
// usePrompt: jest.fn(),
// }));
// describe("PromptDialog Component", () => {
// const mockConfirm = jest.fn();
// const mockCancel = jest.fn();
// jest.mock("next/navigation", () => ({
// useRouter: jest.fn(),
// }));
// const PromptDialogTestComponent = (
// <PromptDialog
// title="Test Title"
// subTitle="Test Subtitle"
// content="Test Content"
// confirm={mockConfirm}
// cancel={mockCancel}
// confirmText="Continue without saving"
// cancelText="Keep editing"
// />
// );
// it("renders with provided title, subtitle and content", () => {
// render(PromptDialogTestComponent);
// expect(screen.getByText("Test Title")).toBeInTheDocument();
// expect(screen.getByText("Test Subtitle")).toBeInTheDocument();
// expect(screen.getByText("Test Content")).toBeInTheDocument();
// });
// it("calls confirm callback when continue button is clicked", async () => {
// render(PromptDialogTestComponent);
// await userEvent.click(
// screen.getByRole("button", { name: "Continue without saving" }),
// );
// expect(mockConfirm).toHaveBeenCalled();
// });
// it("calls cancel callback when cancel button is clicked", async () => {
// render(PromptDialogTestComponent);
// await userEvent.click(screen.getByRole("button", { name: "Keep editing" }));
// expect(mockCancel).toHaveBeenCalled();
// });
// it("calls cancel callback when close icon is clicked", async () => {
// render(PromptDialogTestComponent);
// await userEvent.click(screen.getByRole("button", { name: "Close" }));
// expect(mockCancel).toHaveBeenCalled();
// });
// });