@alixpartners/ui-components 2.6.0 → 2.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{RichTextEditor-JH6YBGiw.js → RichTextEditor-xCakhho7.js} +1 -1
- package/dist/{ToastProvider-DVycF0zU.js → ToastProvider-D5LImZ-Q.js} +26 -26
- package/dist/assets/Dialog.css +1 -1
- package/dist/components/Banner/Banner.d.ts +1 -1
- package/dist/components/Banner/Banner.test.js +1 -1
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.test.js +2 -2
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.js +3 -3
- package/dist/components/Checkbox/Checkbox.test.js +1 -1
- package/dist/components/CorusHeader/CorusHeader.d.ts +1 -1
- package/dist/components/CorusHeader/CorusHeader.js +1 -1
- package/dist/components/CorusHeader/DropdownItemContent.d.ts +1 -1
- package/dist/components/CorusHeader/DropdownItemContent.js +5 -5
- package/dist/components/CorusHeader/DropdownMenu.d.ts +1 -1
- package/dist/components/CorusHeader/DropdownMenu.js +1 -1
- package/dist/components/CorusHeader/MegaMenuContent.d.ts +1 -1
- package/dist/components/CorusHeader/MegaMenuContent.js +14 -14
- package/dist/components/CorusHeader/UserProfileIcon.d.ts +1 -1
- package/dist/components/Creatable/Creatable.d.ts +1 -1
- package/dist/components/Creatable/Creatable.js +1 -1
- package/dist/components/Datepicker/Datepicker.d.ts +1 -1
- package/dist/components/Datepicker/Datepicker.js +1 -1
- package/dist/components/Datepicker/Datepicker.test.js +1 -1
- package/dist/components/Dialog/Dialog.d.ts +8 -2
- package/dist/components/Dialog/Dialog.js +227 -195
- package/dist/components/Dialog/Dialog.test.js +227 -202
- package/dist/components/DragAndDrop/DragAndDrop.d.ts +1 -1
- package/dist/components/DragAndDrop/DragAndDrop.test.js +2 -2
- package/dist/components/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/Dropdown/Dropdown.js +1 -1
- package/dist/components/FilePicker/FilePicker.d.ts +9 -9
- package/dist/components/FilePicker/FilePicker.test.js +2 -2
- package/dist/components/Ghost/Ghost.d.ts +1 -1
- package/dist/components/Ghost/Ghost.test.js +1 -1
- package/dist/components/Icon/Icon.d.ts +1 -1
- package/dist/components/Icons/IconsGallery.d.ts +1 -1
- package/dist/components/Illustration/Illustration.d.ts +1 -1
- package/dist/components/Illustration/Illustration.test.js +1 -1
- package/dist/components/Input/Input.test.js +1 -1
- package/dist/components/Logo/Logo.d.ts +1 -1
- package/dist/components/Logos/LogosGallery.d.ts +1 -1
- package/dist/components/NavBar/NavBar.d.ts +1 -1
- package/dist/components/NavBar/NavBar.js +1 -1
- package/dist/components/Radio/Radio.d.ts +1 -1
- package/dist/components/Radio/Radio.js +9 -9
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/RadioGroup/RadioGroup.js +11 -11
- package/dist/components/RadioGroup/RadioGroup.test.js +1 -1
- package/dist/components/RichTextEditor/RichTextEditor.d.ts +1 -1
- package/dist/components/RichTextEditor/RichTextEditor.js +2 -2
- package/dist/components/RichTextEditor/RichTextEditor.test.js +2 -2
- package/dist/components/Search/Search.d.ts +1 -1
- package/dist/components/Search/Search.test.js +1 -1
- package/dist/components/Spinner/Spinner.d.ts +1 -1
- package/dist/components/SplitButton/SplitButton.d.ts +1 -1
- package/dist/components/SplitButton/SplitButton.js +3 -3
- package/dist/components/SplitButton/SplitButton.test.js +1 -1
- package/dist/components/Tab/Tab.d.ts +1 -1
- package/dist/components/TabNavigation/TabNavigation.d.ts +1 -1
- package/dist/components/Tag/Tag.d.ts +1 -1
- package/dist/components/Tag/Tag.test.js +1 -1
- package/dist/components/TagsFields/TagsFields.d.ts +1 -1
- package/dist/components/TagsFields/TagsFields.js +1 -1
- package/dist/components/Textarea/Textarea.d.ts +1 -1
- package/dist/components/Textarea/Textarea.test.js +1 -1
- package/dist/components/Toast/Toast.test.js +1 -1
- package/dist/components/ToastProvider/ToastProvider.d.ts +1 -2
- package/dist/components/ToastProvider/ToastProvider.js +1 -1
- package/dist/components/ToastProvider/ToastProvider.test.js +4 -4
- package/dist/components/Toggle/Toggle.d.ts +1 -1
- package/dist/components/Toggle/Toggle.js +126 -211
- package/dist/components/Toggle/Toggle.test.js +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.js +61 -60
- package/dist/{index-6DGSlWJb.js → index-C2s_VtSb.js} +3 -3
- package/dist/index-C8H9A55g.js +222 -0
- package/dist/{index-CcsZYEYy.js → index-CCFDXH-J.js} +28 -29
- package/dist/index-CCnm5-ML.js +230 -0
- package/dist/{index-BVZdJVFB.js → index-CFqDEbIR.js} +191 -192
- package/dist/index-CfIcUHKK.js +70 -0
- package/dist/index-ChQc_Cm6.js +1544 -0
- package/dist/index-CmGGeUr0.js +142 -0
- package/dist/{index-IR8HlW5P.js → index-D_L0ncPJ.js} +4 -4
- package/dist/{index-banDzeKa.js → index-DkTDHhag.js} +1 -1
- package/dist/index-Ii4UOx3H.js +599 -0
- package/dist/{index-6j3vTf--.js → index-Nyh2Wa71.js} +5 -5
- package/dist/index-z_kiwVc3.js +237 -0
- package/dist/main.js +3 -3
- package/dist/storybook-docs-page.d.ts +1 -1
- package/dist/{useToast-CpwrYPvx.js → useToast-Cz5MGKnw.js} +1 -1
- package/dist/{vi.bdSIJ99Y-DWCVXj6K.js → vi.bdSIJ99Y-017e_Pkz.js} +3 -3
- package/package.json +1 -1
- package/dist/index-B4szHVNJ.js +0 -248
- package/dist/index-Bq1FiX6B.js +0 -93
- package/dist/index-CE9NpYQR.js +0 -604
- package/dist/index-CHy8gqvu.js +0 -353
- package/dist/index-CarlZuEo.js +0 -1610
- package/dist/index-DH9SO8qV.js +0 -221
- package/dist/index-kgC_DL6e.js +0 -216
|
@@ -1,368 +1,393 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { d as T, i as
|
|
3
|
-
import s from "./Dialog.js";
|
|
1
|
+
import { jsx as n, jsxs as B } from "react/jsx-runtime";
|
|
2
|
+
import { d as T, i as l, r as c, s as o, g as t, v as d, f as r } from "../../vi.bdSIJ99Y-017e_Pkz.js";
|
|
4
3
|
import p from "../Button/Button.js";
|
|
4
|
+
import s from "./Dialog.js";
|
|
5
5
|
T("Dialog", () => {
|
|
6
6
|
T("Rendering", () => {
|
|
7
7
|
T("Basic rendering", () => {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
l("should render dialog with required props when open", () => {
|
|
9
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", isOpen: !0 }));
|
|
10
10
|
const e = o.getByTestId("dialog");
|
|
11
11
|
t(e).toBeInTheDocument(), t(o.getByTestId("dialog-title")).toHaveTextContent("Test Title"), t(o.getByTestId("dialog-description")).toHaveTextContent("Test Description");
|
|
12
|
-
}),
|
|
13
|
-
|
|
14
|
-
}),
|
|
15
|
-
|
|
12
|
+
}), l("should render dialog with children trigger", () => {
|
|
13
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", children: /* @__PURE__ */ n(p, { type: "primary", variant: "default", size: "md", children: "Open Dialog" }) })), t(o.getByText("Open Dialog")).toBeInTheDocument(), t(o.queryByTestId("dialog")).not.toBeInTheDocument();
|
|
14
|
+
}), l("should render dialog element with correct structure", () => {
|
|
15
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", isOpen: !0 }));
|
|
16
16
|
const e = o.getByTestId("dialog");
|
|
17
17
|
t(e).toBeInTheDocument(), t(o.getByTestId("dialog-content")).toBeInTheDocument(), t(o.getByTestId("dialog-title")).toBeInTheDocument(), t(o.getByTestId("dialog-description")).toBeInTheDocument(), t(o.getByTestId("dialog-overlay")).toBeInTheDocument();
|
|
18
18
|
});
|
|
19
19
|
}), T("Conditional rendering", () => {
|
|
20
|
-
|
|
20
|
+
l("should render close button when onClose is provided", () => {
|
|
21
21
|
const e = d.fn();
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
t(
|
|
25
|
-
}),
|
|
26
|
-
|
|
22
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", onClose: e, isOpen: !0 }));
|
|
23
|
+
const i = o.getByTestId("dialog-close-button");
|
|
24
|
+
t(i).toBeInTheDocument();
|
|
25
|
+
}), l("should not render close button when onClose is not provided", () => {
|
|
26
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description" }));
|
|
27
27
|
const e = o.queryByTestId("dialog-close-button");
|
|
28
28
|
t(e).not.toBeInTheDocument();
|
|
29
|
-
}),
|
|
30
|
-
|
|
29
|
+
}), l("should render illustration when illustrationSrc is provided", () => {
|
|
30
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", illustrationSrc: "https://example.com/image.png", isOpen: !0 }));
|
|
31
31
|
const e = o.getByTestId("dialog-illustration");
|
|
32
32
|
t(e).toBeInTheDocument();
|
|
33
|
-
const
|
|
34
|
-
t(
|
|
35
|
-
}),
|
|
36
|
-
|
|
33
|
+
const i = e.querySelector("img");
|
|
34
|
+
t(i).toBeInTheDocument(), t(i).toHaveAttribute("src", "https://example.com/image.png"), t(i).toHaveAttribute("alt", "Dialog illustration");
|
|
35
|
+
}), l("should not render illustration when illustrationSrc is not provided", () => {
|
|
36
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description" }));
|
|
37
37
|
const e = o.queryByTestId("dialog-illustration");
|
|
38
38
|
t(e).not.toBeInTheDocument();
|
|
39
|
-
}),
|
|
40
|
-
|
|
39
|
+
}), l("should render confirm button when confirmButtonText is provided", () => {
|
|
40
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", confirmButtonText: "Confirm", isOpen: !0 }));
|
|
41
41
|
const e = o.getByTestId("dialog-buttons");
|
|
42
42
|
t(e).toBeInTheDocument(), t(o.getByText("Confirm")).toBeInTheDocument();
|
|
43
|
-
}),
|
|
44
|
-
|
|
45
|
-
}),
|
|
46
|
-
|
|
47
|
-
}),
|
|
48
|
-
|
|
43
|
+
}), l("should render cancel button when cancelButtonText is provided", () => {
|
|
44
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", cancelButtonText: "Cancel", isOpen: !0 })), t(o.getByText("Cancel")).toBeInTheDocument();
|
|
45
|
+
}), l("should render both buttons when both are provided", () => {
|
|
46
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", confirmButtonText: "Confirm", cancelButtonText: "Cancel", isOpen: !0 })), t(o.getByText("Confirm")).toBeInTheDocument(), t(o.getByText("Cancel")).toBeInTheDocument();
|
|
47
|
+
}), l("should render empty buttons container when no buttons are provided", () => {
|
|
48
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", isOpen: !0 }));
|
|
49
49
|
const e = o.getByTestId("dialog-buttons");
|
|
50
50
|
t(e).toBeInTheDocument(), t(e.children.length).toBe(0);
|
|
51
51
|
});
|
|
52
52
|
}), T("Content rendering", () => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}),
|
|
56
|
-
|
|
57
|
-
}),
|
|
58
|
-
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
/* @__PURE__ */
|
|
53
|
+
l("should render title text correctly", () => {
|
|
54
|
+
c(/* @__PURE__ */ n(s, { title: "My Dialog Title", description: "Test Description", isOpen: !0 })), t(o.getByTestId("dialog-title")).toHaveTextContent("My Dialog Title");
|
|
55
|
+
}), l("should render description as string correctly", () => {
|
|
56
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "My description text", isOpen: !0 })), t(o.getByTestId("dialog-description")).toHaveTextContent("My description text");
|
|
57
|
+
}), l("should render description as ReactNode correctly", () => {
|
|
58
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: /* @__PURE__ */ B("div", { children: [
|
|
59
|
+
/* @__PURE__ */ n("p", { children: "Custom HTML content" }),
|
|
60
|
+
/* @__PURE__ */ n("span", { children: "More content" })
|
|
61
61
|
] }), isOpen: !0 })), t(o.getByTestId("dialog-description")).toContainHTML("<div><p>Custom HTML content</p><span>More content</span></div>");
|
|
62
|
-
}),
|
|
63
|
-
|
|
64
|
-
}),
|
|
65
|
-
|
|
66
|
-
const e = o.getByText("Confirm").closest('[data-testid="button"]'),
|
|
67
|
-
t(e).toBeInTheDocument(), t(
|
|
68
|
-
const a = e == null ? void 0 : e.querySelector('[data-testid="button-icon"]'), u =
|
|
62
|
+
}), l("should render button text correctly", () => {
|
|
63
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", confirmButtonText: "Save Changes", cancelButtonText: "Discard", isOpen: !0 })), t(o.getByText("Save Changes")).toBeInTheDocument(), t(o.getByText("Discard")).toBeInTheDocument();
|
|
64
|
+
}), l("should render button icons when provided", () => {
|
|
65
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", confirmButtonText: "Confirm", confirmButtonIcon: "ap-icon-check", cancelButtonText: "Cancel", cancelButtonIcon: "ap-icon-close", isOpen: !0 }));
|
|
66
|
+
const e = o.getByText("Confirm").closest('[data-testid="button"]'), i = o.getByText("Cancel").closest('[data-testid="button"]');
|
|
67
|
+
t(e).toBeInTheDocument(), t(i).toBeInTheDocument();
|
|
68
|
+
const a = e == null ? void 0 : e.querySelector('[data-testid="button-icon"]'), u = i == null ? void 0 : i.querySelector('[data-testid="button-icon"]');
|
|
69
69
|
t(a).toBeInTheDocument(), t(u).toBeInTheDocument();
|
|
70
70
|
});
|
|
71
71
|
}), T("CSS Classes", () => {
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
l("should apply dialog base class", () => {
|
|
73
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", isOpen: !0 }));
|
|
74
74
|
const e = o.getByTestId("dialog");
|
|
75
75
|
t(e.className).toContain("dialog");
|
|
76
|
-
}),
|
|
76
|
+
}), l("should apply custom className to wrapper when children are provided", () => {
|
|
77
77
|
const {
|
|
78
78
|
container: e
|
|
79
|
-
} =
|
|
80
|
-
t(
|
|
81
|
-
}),
|
|
79
|
+
} = c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", className: "custom-wrapper-class", children: /* @__PURE__ */ n(p, { type: "primary", variant: "default", size: "md", children: "Open" }) })), i = e.firstChild;
|
|
80
|
+
t(i.className).toContain("custom-wrapper-class");
|
|
81
|
+
}), l("should always render wrapper div for consistent className support", () => {
|
|
82
82
|
const {
|
|
83
83
|
container: e
|
|
84
|
-
} =
|
|
85
|
-
t(
|
|
84
|
+
} = c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", className: "custom-class", isOpen: !0 })), i = e.firstChild;
|
|
85
|
+
t(i).toBeInTheDocument(), t(i.tagName).toBe("DIV"), t(i.className).toContain("custom-class");
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
88
|
}), T("User Interactions", () => {
|
|
89
89
|
T("Trigger interactions", () => {
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
l("should open dialog when trigger is clicked", () => {
|
|
91
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", children: /* @__PURE__ */ n(p, { type: "primary", variant: "default", size: "md", children: "Open" }) }));
|
|
92
92
|
const e = o.getByText("Open");
|
|
93
93
|
t(o.queryByTestId("dialog")).not.toBeInTheDocument(), r.click(e);
|
|
94
|
-
const
|
|
95
|
-
t(
|
|
96
|
-
}),
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
t(
|
|
94
|
+
const i = o.getByTestId("dialog");
|
|
95
|
+
t(i).toBeInTheDocument(), t(o.getByTestId("dialog-overlay")).toBeInTheDocument();
|
|
96
|
+
}), l("should not render trigger when children are not provided", () => {
|
|
97
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description" }));
|
|
98
|
+
const i = o.queryAllByTestId("button").filter((a) => a.textContent !== "Confirm" && a.textContent !== "Cancel");
|
|
99
|
+
t(i.length).toBe(0);
|
|
100
100
|
});
|
|
101
101
|
}), T("Close button interactions", () => {
|
|
102
|
-
|
|
102
|
+
l("should call onClose when close button is clicked", () => {
|
|
103
103
|
const e = d.fn();
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
r.click(
|
|
107
|
-
}),
|
|
104
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", onClose: e, isOpen: !0 }));
|
|
105
|
+
const i = o.getByTestId("dialog-close-button");
|
|
106
|
+
r.click(i), t(e).toHaveBeenCalledTimes(1);
|
|
107
|
+
}), l("should close dialog when close button is clicked in uncontrolled mode", () => {
|
|
108
108
|
const e = d.fn();
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
r.click(
|
|
109
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", onClose: e, children: /* @__PURE__ */ n(p, { type: "primary", variant: "default", size: "md", children: "Open" }) }));
|
|
110
|
+
const i = o.getByText("Open");
|
|
111
|
+
r.click(i);
|
|
112
112
|
const a = o.getByTestId("dialog");
|
|
113
113
|
t(a).toBeInTheDocument();
|
|
114
114
|
const u = o.getByTestId("dialog-close-button");
|
|
115
115
|
r.click(u), t(e).toHaveBeenCalledTimes(1);
|
|
116
116
|
});
|
|
117
117
|
}), T("Confirm button interactions", () => {
|
|
118
|
-
|
|
118
|
+
l("should call onConfirm when confirm button is clicked", () => {
|
|
119
119
|
const e = d.fn();
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
r.click(
|
|
123
|
-
}),
|
|
124
|
-
const e = d.fn(),
|
|
125
|
-
|
|
120
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", confirmButtonText: "Confirm", onConfirm: e, isOpen: !0 }));
|
|
121
|
+
const i = o.getByText("Confirm");
|
|
122
|
+
r.click(i), t(e).toHaveBeenCalledTimes(1);
|
|
123
|
+
}), l("should close dialog when confirm button is clicked in uncontrolled mode", () => {
|
|
124
|
+
const e = d.fn(), i = d.fn();
|
|
125
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", confirmButtonText: "Confirm", onConfirm: e, onClose: i, children: /* @__PURE__ */ n(p, { type: "primary", variant: "default", size: "md", children: "Open" }) }));
|
|
126
126
|
const a = o.getByText("Open");
|
|
127
127
|
r.click(a);
|
|
128
128
|
const u = o.getByTestId("dialog");
|
|
129
129
|
t(u).toBeInTheDocument();
|
|
130
130
|
const m = o.getByText("Confirm");
|
|
131
|
-
r.click(m), t(e).toHaveBeenCalledTimes(1), t(
|
|
132
|
-
}),
|
|
133
|
-
const e = d.fn(),
|
|
134
|
-
|
|
131
|
+
r.click(m), t(e).toHaveBeenCalledTimes(1), t(i).toHaveBeenCalledTimes(1);
|
|
132
|
+
}), l("should call onClose after onConfirm in uncontrolled mode", () => {
|
|
133
|
+
const e = d.fn(), i = d.fn();
|
|
134
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", confirmButtonText: "Confirm", onConfirm: e, onClose: i, children: /* @__PURE__ */ n(p, { type: "primary", variant: "default", size: "md", children: "Open" }) }));
|
|
135
135
|
const a = o.getByText("Open");
|
|
136
136
|
r.click(a);
|
|
137
137
|
const u = o.getByText("Confirm");
|
|
138
|
-
r.click(u), t(e).toHaveBeenCalledTimes(1), t(
|
|
138
|
+
r.click(u), t(e).toHaveBeenCalledTimes(1), t(i).toHaveBeenCalledTimes(1);
|
|
139
139
|
});
|
|
140
140
|
}), T("Cancel button interactions", () => {
|
|
141
|
-
|
|
141
|
+
l("should call onCancel when cancel button is clicked", () => {
|
|
142
142
|
const e = d.fn();
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
r.click(
|
|
146
|
-
}),
|
|
147
|
-
const e = d.fn(),
|
|
148
|
-
|
|
143
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", cancelButtonText: "Cancel", onCancel: e, isOpen: !0 }));
|
|
144
|
+
const i = o.getByText("Cancel");
|
|
145
|
+
r.click(i), t(e).toHaveBeenCalledTimes(1);
|
|
146
|
+
}), l("should close dialog when cancel button is clicked in uncontrolled mode", () => {
|
|
147
|
+
const e = d.fn(), i = d.fn();
|
|
148
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", cancelButtonText: "Cancel", onCancel: e, onClose: i, children: /* @__PURE__ */ n(p, { type: "primary", variant: "default", size: "md", children: "Open" }) }));
|
|
149
149
|
const a = o.getByText("Open");
|
|
150
150
|
r.click(a);
|
|
151
151
|
const u = o.getByTestId("dialog");
|
|
152
152
|
t(u).toBeInTheDocument();
|
|
153
153
|
const m = o.getByText("Cancel");
|
|
154
|
-
r.click(m), t(e).toHaveBeenCalledTimes(1), t(
|
|
155
|
-
}),
|
|
156
|
-
const e = d.fn(),
|
|
157
|
-
|
|
154
|
+
r.click(m), t(e).toHaveBeenCalledTimes(1), t(i).toHaveBeenCalledTimes(1);
|
|
155
|
+
}), l("should call onClose after onCancel in uncontrolled mode", () => {
|
|
156
|
+
const e = d.fn(), i = d.fn();
|
|
157
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", cancelButtonText: "Cancel", onCancel: e, onClose: i, children: /* @__PURE__ */ n(p, { type: "primary", variant: "default", size: "md", children: "Open" }) }));
|
|
158
158
|
const a = o.getByText("Open");
|
|
159
159
|
r.click(a);
|
|
160
160
|
const u = o.getByText("Cancel");
|
|
161
|
-
r.click(u), t(e).toHaveBeenCalledTimes(1), t(
|
|
161
|
+
r.click(u), t(e).toHaveBeenCalledTimes(1), t(i).toHaveBeenCalledTimes(1);
|
|
162
162
|
});
|
|
163
163
|
}), T("Escape key handling", () => {
|
|
164
|
-
|
|
164
|
+
l("should handle Escape key press on dialog", () => {
|
|
165
165
|
const e = d.fn();
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
t(
|
|
166
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", onClose: e, isOpen: !0 }));
|
|
167
|
+
const i = o.getByTestId("dialog");
|
|
168
|
+
t(i).toBeInTheDocument(), r.keyDown(i, {
|
|
169
169
|
key: "Escape",
|
|
170
170
|
code: "Escape"
|
|
171
|
-
}), t(
|
|
171
|
+
}), t(i).toBeInTheDocument();
|
|
172
172
|
});
|
|
173
173
|
});
|
|
174
174
|
}), T("Controlled Mode", () => {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const e = o.getByTestId("dialog"),
|
|
178
|
-
t(e).toBeInTheDocument(), t(
|
|
179
|
-
}),
|
|
180
|
-
|
|
181
|
-
}),
|
|
175
|
+
l("should open dialog when isOpen is true", () => {
|
|
176
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", isOpen: !0 }));
|
|
177
|
+
const e = o.getByTestId("dialog"), i = o.getByTestId("dialog-overlay");
|
|
178
|
+
t(e).toBeInTheDocument(), t(i).toBeInTheDocument();
|
|
179
|
+
}), l("should close dialog when isOpen is false", () => {
|
|
180
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", isOpen: !1 })), t(o.queryByTestId("dialog")).not.toBeInTheDocument(), t(o.queryByTestId("dialog-overlay")).not.toBeInTheDocument();
|
|
181
|
+
}), l("should update dialog state when isOpen changes", async () => {
|
|
182
182
|
const {
|
|
183
183
|
rerender: e
|
|
184
|
-
} =
|
|
185
|
-
t(o.queryByTestId("dialog")).not.toBeInTheDocument(), e(/* @__PURE__ */
|
|
186
|
-
const
|
|
187
|
-
t(
|
|
188
|
-
}),
|
|
189
|
-
const e = d.fn(),
|
|
190
|
-
|
|
184
|
+
} = c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", isOpen: !1 }));
|
|
185
|
+
t(o.queryByTestId("dialog")).not.toBeInTheDocument(), e(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", isOpen: !0 }));
|
|
186
|
+
const i = o.getByTestId("dialog");
|
|
187
|
+
t(i).toBeInTheDocument(), t(o.getByTestId("dialog-overlay")).toBeInTheDocument();
|
|
188
|
+
}), l("should call onClose when confirm is clicked in controlled mode", () => {
|
|
189
|
+
const e = d.fn(), i = d.fn();
|
|
190
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", isOpen: !0, confirmButtonText: "Confirm", onConfirm: e, onClose: i }));
|
|
191
191
|
const a = o.getByText("Confirm");
|
|
192
|
-
r.click(a), t(e).toHaveBeenCalledTimes(1), t(
|
|
193
|
-
}),
|
|
194
|
-
const e = d.fn(),
|
|
195
|
-
|
|
192
|
+
r.click(a), t(e).toHaveBeenCalledTimes(1), t(i).toHaveBeenCalledTimes(1);
|
|
193
|
+
}), l("should call onClose when cancel is clicked in controlled mode", () => {
|
|
194
|
+
const e = d.fn(), i = d.fn();
|
|
195
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", isOpen: !0, cancelButtonText: "Cancel", onCancel: e, onClose: i }));
|
|
196
196
|
const a = o.getByText("Cancel");
|
|
197
|
-
r.click(a), t(e).toHaveBeenCalledTimes(1), t(
|
|
198
|
-
}),
|
|
199
|
-
|
|
197
|
+
r.click(a), t(e).toHaveBeenCalledTimes(1), t(i).toHaveBeenCalledTimes(1);
|
|
198
|
+
}), l("should work without children in controlled mode", () => {
|
|
199
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", isOpen: !0 }));
|
|
200
200
|
const e = o.getByTestId("dialog");
|
|
201
201
|
t(e).toBeInTheDocument();
|
|
202
202
|
});
|
|
203
203
|
}), T("Uncontrolled Mode", () => {
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
l("should open dialog when trigger is clicked", () => {
|
|
205
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", children: /* @__PURE__ */ n(p, { type: "primary", variant: "default", size: "md", children: "Open" }) }));
|
|
206
206
|
const e = o.getByText("Open");
|
|
207
207
|
t(o.queryByTestId("dialog")).not.toBeInTheDocument(), r.click(e);
|
|
208
|
-
const
|
|
209
|
-
t(
|
|
210
|
-
}),
|
|
211
|
-
const e = d.fn(),
|
|
212
|
-
|
|
208
|
+
const i = o.getByTestId("dialog");
|
|
209
|
+
t(i).toBeInTheDocument(), t(o.getByTestId("dialog-overlay")).toBeInTheDocument();
|
|
210
|
+
}), l("should close dialog automatically when confirm is clicked", () => {
|
|
211
|
+
const e = d.fn(), i = d.fn();
|
|
212
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", confirmButtonText: "Confirm", onConfirm: e, onClose: i, children: /* @__PURE__ */ n(p, { type: "primary", variant: "default", size: "md", children: "Open" }) }));
|
|
213
213
|
const a = o.getByText("Open");
|
|
214
214
|
r.click(a);
|
|
215
215
|
const u = o.getByTestId("dialog");
|
|
216
216
|
t(u).toBeInTheDocument();
|
|
217
217
|
const m = o.getByText("Confirm");
|
|
218
|
-
r.click(m), t(e).toHaveBeenCalledTimes(1), t(
|
|
219
|
-
}),
|
|
220
|
-
const e = d.fn(),
|
|
221
|
-
|
|
218
|
+
r.click(m), t(e).toHaveBeenCalledTimes(1), t(i).toHaveBeenCalledTimes(1);
|
|
219
|
+
}), l("should close dialog automatically when cancel is clicked", () => {
|
|
220
|
+
const e = d.fn(), i = d.fn();
|
|
221
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", cancelButtonText: "Cancel", onCancel: e, onClose: i, children: /* @__PURE__ */ n(p, { type: "primary", variant: "default", size: "md", children: "Open" }) }));
|
|
222
222
|
const a = o.getByText("Open");
|
|
223
223
|
r.click(a);
|
|
224
224
|
const u = o.getByTestId("dialog");
|
|
225
225
|
t(u).toBeInTheDocument();
|
|
226
226
|
const m = o.getByText("Cancel");
|
|
227
|
-
r.click(m), t(e).toHaveBeenCalledTimes(1), t(
|
|
227
|
+
r.click(m), t(e).toHaveBeenCalledTimes(1), t(i).toHaveBeenCalledTimes(1);
|
|
228
228
|
});
|
|
229
229
|
}), T("Button Configuration", () => {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
const e = o.getByText("Confirm").closest('[data-testid="button"]'),
|
|
233
|
-
t(e).toBeInTheDocument(), t(
|
|
234
|
-
}),
|
|
235
|
-
|
|
236
|
-
const e = o.getByText("Confirm").closest('[data-testid="button"]'),
|
|
237
|
-
t(e).toBeInTheDocument(), t(
|
|
238
|
-
}),
|
|
239
|
-
|
|
240
|
-
const e = o.getByText("Confirm").closest('[data-testid="button"]'),
|
|
241
|
-
t(e).toBeInTheDocument(), t(
|
|
242
|
-
}),
|
|
243
|
-
|
|
244
|
-
const e = o.getByText("Confirm").closest('[data-testid="button"]'),
|
|
245
|
-
t(e).toBeInTheDocument(), t(
|
|
230
|
+
l("should pass button type props correctly", () => {
|
|
231
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", confirmButtonText: "Confirm", confirmButtonType: "secondary", cancelButtonText: "Cancel", cancelButtonType: "tertiary", isOpen: !0 }));
|
|
232
|
+
const e = o.getByText("Confirm").closest('[data-testid="button"]'), i = o.getByText("Cancel").closest('[data-testid="button"]');
|
|
233
|
+
t(e).toBeInTheDocument(), t(i).toBeInTheDocument();
|
|
234
|
+
}), l("should pass button variant props correctly", () => {
|
|
235
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", confirmButtonText: "Confirm", confirmButtonVariant: "danger", cancelButtonText: "Cancel", cancelButtonVariant: "cancel", isOpen: !0 }));
|
|
236
|
+
const e = o.getByText("Confirm").closest('[data-testid="button"]'), i = o.getByText("Cancel").closest('[data-testid="button"]');
|
|
237
|
+
t(e).toBeInTheDocument(), t(i).toBeInTheDocument();
|
|
238
|
+
}), l("should pass button size props correctly", () => {
|
|
239
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", confirmButtonText: "Confirm", confirmButtonSize: "sm", cancelButtonText: "Cancel", cancelButtonSize: "sm", isOpen: !0 }));
|
|
240
|
+
const e = o.getByText("Confirm").closest('[data-testid="button"]'), i = o.getByText("Cancel").closest('[data-testid="button"]');
|
|
241
|
+
t(e).toBeInTheDocument(), t(i).toBeInTheDocument();
|
|
242
|
+
}), l("should use default button props when not provided", () => {
|
|
243
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", confirmButtonText: "Confirm", cancelButtonText: "Cancel", isOpen: !0 }));
|
|
244
|
+
const e = o.getByText("Confirm").closest('[data-testid="button"]'), i = o.getByText("Cancel").closest('[data-testid="button"]');
|
|
245
|
+
t(e).toBeInTheDocument(), t(i).toBeInTheDocument();
|
|
246
|
+
}), l("should disable confirm button when confirmButtonDisabled is true", () => {
|
|
247
|
+
const e = d.fn();
|
|
248
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", confirmButtonText: "Confirm", confirmButtonDisabled: !0, onConfirm: e, isOpen: !0 }));
|
|
249
|
+
const i = o.getByText("Confirm").closest('[data-testid="button"]');
|
|
250
|
+
t(i).toBeDisabled(), r.click(i), t(e).not.toHaveBeenCalled();
|
|
246
251
|
});
|
|
247
252
|
}), T("Edge Cases", () => {
|
|
248
|
-
|
|
249
|
-
|
|
253
|
+
l("should handle empty string for button text", () => {
|
|
254
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", confirmButtonText: "", isOpen: !0 }));
|
|
250
255
|
const e = o.queryByTestId("dialog-buttons");
|
|
251
256
|
t(e).toBeInTheDocument(), t(e == null ? void 0 : e.children.length).toBe(0);
|
|
252
|
-
}),
|
|
253
|
-
|
|
254
|
-
/* @__PURE__ */
|
|
255
|
-
/* @__PURE__ */
|
|
257
|
+
}), l("should handle custom HTML content in description", () => {
|
|
258
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: /* @__PURE__ */ B("div", { children: [
|
|
259
|
+
/* @__PURE__ */ n("h3", { children: "Custom Title" }),
|
|
260
|
+
/* @__PURE__ */ n("p", { children: "Custom paragraph" }),
|
|
256
261
|
/* @__PURE__ */ B("ul", { children: [
|
|
257
|
-
/* @__PURE__ */
|
|
258
|
-
/* @__PURE__ */
|
|
262
|
+
/* @__PURE__ */ n("li", { children: "Item 1" }),
|
|
263
|
+
/* @__PURE__ */ n("li", { children: "Item 2" })
|
|
259
264
|
] })
|
|
260
265
|
] }), isOpen: !0 })), t(o.getByText("Custom Title")).toBeInTheDocument(), t(o.getByText("Custom paragraph")).toBeInTheDocument(), t(o.getByText("Item 1")).toBeInTheDocument(), t(o.getByText("Item 2")).toBeInTheDocument();
|
|
261
|
-
}),
|
|
266
|
+
}), l("should handle multiple rapid open/close actions", () => {
|
|
262
267
|
const e = d.fn();
|
|
263
|
-
|
|
264
|
-
const
|
|
265
|
-
t(o.queryByTestId("dialog")).not.toBeInTheDocument(), r.click(
|
|
268
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", onClose: e, children: /* @__PURE__ */ n(p, { type: "primary", variant: "default", size: "md", children: "Open" }) }));
|
|
269
|
+
const i = o.getByText("Open");
|
|
270
|
+
t(o.queryByTestId("dialog")).not.toBeInTheDocument(), r.click(i), t(o.getByTestId("dialog")).toBeInTheDocument();
|
|
266
271
|
const a = o.getByTestId("dialog-close-button");
|
|
267
|
-
r.click(a), t(e).toHaveBeenCalledTimes(1), r.click(
|
|
272
|
+
r.click(a), t(e).toHaveBeenCalledTimes(1), r.click(i), t(o.getByTestId("dialog")).toBeInTheDocument();
|
|
268
273
|
const u = o.getByTestId("dialog-close-button");
|
|
269
274
|
r.click(u), t(e).toHaveBeenCalledTimes(2);
|
|
270
|
-
}),
|
|
271
|
-
|
|
275
|
+
}), l("should handle undefined callbacks gracefully", () => {
|
|
276
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", confirmButtonText: "Confirm", cancelButtonText: "Cancel", children: /* @__PURE__ */ n(p, { type: "primary", variant: "default", size: "md", children: "Open" }) }));
|
|
272
277
|
const e = o.getByText("Open");
|
|
273
278
|
t(o.queryByTestId("dialog")).not.toBeInTheDocument(), r.click(e), t(o.getByTestId("dialog")).toBeInTheDocument();
|
|
274
|
-
const
|
|
275
|
-
r.click(
|
|
279
|
+
const i = o.getByText("Confirm");
|
|
280
|
+
r.click(i), r.click(e), t(o.getByTestId("dialog")).toBeInTheDocument();
|
|
276
281
|
const a = o.getByText("Cancel");
|
|
277
282
|
r.click(a);
|
|
278
283
|
});
|
|
279
284
|
}), T("Accessibility", () => {
|
|
280
|
-
|
|
281
|
-
|
|
285
|
+
l("should render dialog element with proper semantic structure", () => {
|
|
286
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", isOpen: !0 }));
|
|
282
287
|
const e = o.getByTestId("dialog");
|
|
283
288
|
t(e).toBeInTheDocument();
|
|
284
|
-
const
|
|
285
|
-
t(
|
|
286
|
-
}),
|
|
287
|
-
|
|
289
|
+
const i = o.getByTestId("dialog-title");
|
|
290
|
+
t(i).toBeInTheDocument();
|
|
291
|
+
}), l("should have accessible close button", () => {
|
|
292
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", onClose: d.fn(), isOpen: !0 }));
|
|
288
293
|
const e = o.getByTestId("dialog-close-button");
|
|
289
294
|
t(e).toBeInTheDocument();
|
|
290
|
-
}),
|
|
291
|
-
|
|
295
|
+
}), l("should render overlay for accessibility", () => {
|
|
296
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", isOpen: !0 }));
|
|
292
297
|
const e = o.getByTestId("dialog-overlay");
|
|
293
298
|
t(e).toBeInTheDocument();
|
|
294
299
|
});
|
|
295
300
|
}), T("Portal Rendering", () => {
|
|
296
|
-
|
|
297
|
-
|
|
301
|
+
l("should render dialog content via Portal", () => {
|
|
302
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", isOpen: !0 }));
|
|
298
303
|
const e = o.getByTestId("dialog");
|
|
299
304
|
t(e).toBeInTheDocument(), t(document.body.contains(e)).toBe(!0);
|
|
300
|
-
}),
|
|
301
|
-
|
|
305
|
+
}), l("should render overlay via Portal", () => {
|
|
306
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", isOpen: !0 }));
|
|
302
307
|
const e = o.getByTestId("dialog-overlay");
|
|
303
308
|
t(e).toBeInTheDocument(), t(document.body.contains(e)).toBe(!0);
|
|
304
309
|
});
|
|
305
310
|
}), T("New Props", () => {
|
|
306
311
|
T("defaultOpen", () => {
|
|
307
|
-
|
|
308
|
-
|
|
312
|
+
l("should open dialog initially when defaultOpen is true", () => {
|
|
313
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", defaultOpen: !0 }));
|
|
309
314
|
const e = o.getByTestId("dialog");
|
|
310
315
|
t(e).toBeInTheDocument();
|
|
311
|
-
}),
|
|
312
|
-
|
|
316
|
+
}), l("should keep dialog closed initially when defaultOpen is false", () => {
|
|
317
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", defaultOpen: !1, children: /* @__PURE__ */ n(p, { type: "primary", variant: "default", size: "md", children: "Open" }) })), t(o.queryByTestId("dialog")).not.toBeInTheDocument();
|
|
313
318
|
});
|
|
314
319
|
}), T("showCloseButton", () => {
|
|
315
|
-
|
|
316
|
-
|
|
320
|
+
l("should show close button when showCloseButton is true even without onClose", () => {
|
|
321
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", showCloseButton: !0, isOpen: !0 }));
|
|
317
322
|
const e = o.getByTestId("dialog-close-button");
|
|
318
323
|
t(e).toBeInTheDocument();
|
|
319
|
-
}),
|
|
320
|
-
|
|
324
|
+
}), l("should hide close button when showCloseButton is false even with onClose", () => {
|
|
325
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", showCloseButton: !1, onClose: d.fn(), isOpen: !0 }));
|
|
321
326
|
const e = o.queryByTestId("dialog-close-button");
|
|
322
327
|
t(e).not.toBeInTheDocument();
|
|
323
|
-
}),
|
|
324
|
-
|
|
328
|
+
}), l("should show close button by default when onClose is provided (backward compatible)", () => {
|
|
329
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", onClose: d.fn(), isOpen: !0 }));
|
|
325
330
|
const e = o.getByTestId("dialog-close-button");
|
|
326
331
|
t(e).toBeInTheDocument();
|
|
327
332
|
});
|
|
328
333
|
}), T("onOpenChange", () => {
|
|
329
|
-
|
|
334
|
+
l("should call onOpenChange when dialog opens", () => {
|
|
330
335
|
const e = d.fn();
|
|
331
|
-
|
|
332
|
-
const
|
|
333
|
-
r.click(
|
|
334
|
-
}),
|
|
335
|
-
const e = d.fn(),
|
|
336
|
-
|
|
336
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", onOpenChange: e, children: /* @__PURE__ */ n(p, { type: "primary", variant: "default", size: "md", children: "Open" }) }));
|
|
337
|
+
const i = o.getByText("Open");
|
|
338
|
+
r.click(i), t(e).toHaveBeenCalledWith(!0);
|
|
339
|
+
}), l("should call onOpenChange when dialog closes", () => {
|
|
340
|
+
const e = d.fn(), i = d.fn();
|
|
341
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", onOpenChange: e, onClose: i, children: /* @__PURE__ */ n(p, { type: "primary", variant: "default", size: "md", children: "Open" }) }));
|
|
337
342
|
const a = o.getByText("Open");
|
|
338
343
|
r.click(a);
|
|
339
344
|
const u = o.getByTestId("dialog-close-button");
|
|
340
345
|
r.click(u), t(e).toHaveBeenCalledWith(!1);
|
|
341
346
|
});
|
|
342
347
|
}), T("closeOnEscape", () => {
|
|
343
|
-
|
|
348
|
+
l("should close dialog on Escape key by default", () => {
|
|
344
349
|
const e = d.fn();
|
|
345
|
-
|
|
346
|
-
const
|
|
347
|
-
r.keyDown(
|
|
350
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", onClose: e, isOpen: !0 }));
|
|
351
|
+
const i = o.getByTestId("dialog");
|
|
352
|
+
r.keyDown(i, {
|
|
348
353
|
key: "Escape",
|
|
349
354
|
code: "Escape"
|
|
350
355
|
}), t(e).toHaveBeenCalled();
|
|
351
|
-
}),
|
|
356
|
+
}), l("should not close dialog on Escape key when closeOnEscape is false", () => {
|
|
352
357
|
const e = d.fn();
|
|
353
|
-
|
|
354
|
-
const
|
|
355
|
-
r.keyDown(
|
|
358
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", onClose: e, closeOnEscape: !1, isOpen: !0 }));
|
|
359
|
+
const i = o.getByTestId("dialog");
|
|
360
|
+
r.keyDown(i, {
|
|
356
361
|
key: "Escape",
|
|
357
362
|
code: "Escape"
|
|
358
363
|
}), t(e).not.toHaveBeenCalled();
|
|
359
364
|
});
|
|
360
365
|
}), T("aria-label on close button", () => {
|
|
361
|
-
|
|
362
|
-
|
|
366
|
+
l("should have aria-label on close button for accessibility", () => {
|
|
367
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", onClose: d.fn(), isOpen: !0 }));
|
|
363
368
|
const e = o.getByTestId("dialog-close-button");
|
|
364
369
|
t(e).toHaveAttribute("aria-label", "Close dialog");
|
|
365
370
|
});
|
|
366
371
|
});
|
|
372
|
+
}), T("widthAuto property", () => {
|
|
373
|
+
l("should apply auto width class when widthAuto is true", () => {
|
|
374
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", widthAuto: !0, isOpen: !0 }));
|
|
375
|
+
const e = o.getByTestId("dialog");
|
|
376
|
+
t(e.className).toContain("dialog-width-auto");
|
|
377
|
+
}), l("should not apply auto width class by default", () => {
|
|
378
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", isOpen: !0 }));
|
|
379
|
+
const e = o.getByTestId("dialog");
|
|
380
|
+
t(e.className).not.toContain("dialog-width-auto");
|
|
381
|
+
});
|
|
382
|
+
}), T("descriptionScrollable property", () => {
|
|
383
|
+
l("should apply scrollable description class when descriptionScrollable is true", () => {
|
|
384
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", descriptionScrollable: !0, isOpen: !0 }));
|
|
385
|
+
const e = o.getByTestId("dialog");
|
|
386
|
+
t(e.className).toContain("dialog-scrollable");
|
|
387
|
+
}), l("should not apply scrollable description class by default", () => {
|
|
388
|
+
c(/* @__PURE__ */ n(s, { title: "Test Title", description: "Test Description", isOpen: !0 }));
|
|
389
|
+
const e = o.getByTestId("dialog");
|
|
390
|
+
t(e.className).not.toContain("dialog-scrollable");
|
|
391
|
+
});
|
|
367
392
|
});
|
|
368
393
|
});
|