@scrippsproduct/networks-ui-library 1.1.9 → 1.1.10-alpha.0
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/{Form.module-Cd8qH2rj.mjs → Form.module-CarfWK5T.mjs} +1 -1
- package/dist/ResultsTable.module-wcNUQEKe.mjs +14 -0
- package/dist/_commonjsHelpers-DaMA6jEr.mjs +8 -0
- package/dist/assets/ResultsTable.css +1 -1
- package/dist/{chevron-left-DRvpaLmK.mjs → chevron-left-D0UjbrKw.mjs} +1 -1
- package/dist/{chevron-right-C8yCnmfx.mjs → chevron-right-0ZF3LruR.mjs} +1 -1
- package/dist/components/ActionButton/ActionButton.test.js +209 -0
- package/dist/components/AdBlock/AdBlock.test.js +286 -0
- package/dist/components/AdjustableTwoColumnGrid/AdjustableTwoColumnGrid.test.js +295 -0
- package/dist/components/AirDateFormatter/AirDateFormatter.test.js +192 -0
- package/dist/components/AnchorTag/AnchorTag.test.js +463 -0
- package/dist/components/BCVideoPlayer/BCVideoPlayer.test.js +295 -0
- package/dist/components/BasicGridModule/BasicGridModule.js +41 -37
- package/dist/components/BasicGridModule/BasicGridModule.test.js +227 -0
- package/dist/components/Button/Button.test.js +434 -0
- package/dist/components/Carousel/Carousel.js +2 -2
- package/dist/components/Carousel/Carousel.test.js +705 -0
- package/dist/components/CarouselSlide/CarouselSlide.test.js +378 -0
- package/dist/components/CarouselSlide/slide-layouts/TwoColumn/TwoColumnSlide.js +1 -1
- package/dist/components/CastInfoLayout/CastInfoLayout.test.js +294 -0
- package/dist/components/ChannelSearch/ChannelSearch.test.js +565 -0
- package/dist/components/ChoicesItem/ChoicesItem.test.js +428 -0
- package/dist/components/Concat/Concat.js +1 -1
- package/dist/components/Concat/Concat.test.js +115 -0
- package/dist/components/CtaBlock/CtaBlock.js +1 -1
- package/dist/components/CtaBlock/CtaBlock.test.js +226 -0
- package/dist/components/CustomDataList/CustomDataList.js +4 -4
- package/dist/components/CustomSelect/CustomSelect.js +86 -86
- package/dist/components/CustomSelect/CustomSelect.test.js +313 -0
- package/dist/components/DateNavigation/DateNavigation.js +10 -10
- package/dist/components/DateNavigation/DateNavigation.test.js +370 -0
- package/dist/components/DatePicker/DatePicker.js +1 -1
- package/dist/components/DeviceAndPlatformLists/DeviceAndPlatformLists.test.js +288 -0
- package/dist/components/DrawerNavigation/DrawerNavigation.test.js +316 -0
- package/dist/components/EqualSizeFlexRow/EqualSizeFlexRow.test.js +337 -0
- package/dist/components/EqualSizeGrid/EqualSizeGrid.test.js +358 -0
- package/dist/components/ErrorHandler/ErrorHandler.js +2 -2
- package/dist/components/ErrorHandler/ErrorHandler.test.js +158 -0
- package/dist/components/FeaturedList/FeaturedList.test.js +353 -0
- package/dist/components/Figure/Figure.js +1 -1
- package/dist/components/Figure/Figure.test.js +198 -0
- package/dist/components/FindUs/FindUs.test.js +499 -0
- package/dist/components/FooterNavigation/FooterNavigation.test.js +310 -0
- package/dist/components/GenericList/GenericList.js +1 -1
- package/dist/components/GenericList/GenericList.test.js +288 -0
- package/dist/components/GetAirdateWrapper/GetAirdateWrapper.test.js +689 -0
- package/dist/components/GradientButton/GradientButton.d.ts +1 -1
- package/dist/components/GradientButton/GradientButton.js +33 -31
- package/dist/components/GradientButton/GradientButton.test.js +457 -0
- package/dist/components/GridList/GridList.test.js +371 -0
- package/dist/components/ImageCard/ImageCard.test.js +668 -0
- package/dist/components/ImageCard/ImageCardCore.js +28 -28
- package/dist/components/ImageCard/ImageCardCore.test.js +577 -0
- package/dist/components/ImageReplacementAnchor/ImageReplacementAnchor.test.js +379 -0
- package/dist/components/InfoPanel/InfoPanel.js +1 -1
- package/dist/components/InlineNavigation/InlineNavigation.test.js +149 -0
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/Input/Input.test.js +263 -0
- package/dist/components/InstructionsList/InstructionsList.js +11 -11
- package/dist/components/InstructionsList/InstructionsList.test.js +181 -0
- package/dist/components/LogoListItem/LogoListItem.test.js +303 -0
- package/dist/components/LogoNavigation/LogoNavigation.test.js +352 -0
- package/dist/components/ModalContainer/ModalContainer.js +2 -2
- package/dist/components/NavList/NavList.test.js +332 -0
- package/dist/components/Overlay/Overlay.js +24 -23
- package/dist/components/Overlay/Overlay.test.js +198 -0
- package/dist/components/PageHero/PageHero.test.js +241 -0
- package/dist/components/PageHero/page-hero-layouts/IONShow/IONShowHero.js +1 -1
- package/dist/components/ProgramAirdate/ProgramAirdate.js +1 -1
- package/dist/components/ProgramAirdate/ProgramAirdate.test.js +414 -0
- package/dist/components/PromotionBlock/PromotionBlock.test.js +208 -0
- package/dist/components/PromotionsRowBlock/PromotionsRowBlock.test.js +221 -0
- package/dist/components/PromotionsRowModule/PromotionsRowModule.test.js +349 -0
- package/dist/components/RescanInstructions/RescanInstructions.test.js +218 -0
- package/dist/components/ResponsiveImage/ResponsiveImage.test.js +264 -0
- package/dist/components/ResultsTable/ResultsTable.js +9 -2
- package/dist/components/ResultsTable/ResultsTable.test.js +402 -0
- package/dist/components/ResultsTableBody/ResultsTableBody.js +1 -1
- package/dist/components/ResultsTableBody/ResultsTableBody.test.js +445 -0
- package/dist/components/ResultsTableHeader/ResultsTableHeader.js +37 -15
- package/dist/components/ResultsTableHeader/ResultsTableHeader.test.js +275 -0
- package/dist/components/ScheduleLayout/ScheduleContext.js +654 -626
- package/dist/components/ScheduleLayout/ScheduleLayout.js +1 -1
- package/dist/components/ScheduleLayout/useScheduleContext.js +5 -10
- package/dist/components/ScheduleList/ScheduleList.js +1 -1
- package/dist/components/SectionedContent/SectionedContent.js +1 -1
- package/dist/components/SectionedContent/SectionedContent.test.js +341 -0
- package/dist/components/Select/Select.js +24 -24
- package/dist/components/Select/Select.test.js +367 -0
- package/dist/components/ShowAboutContent/ShowAboutContent.js +1 -1
- package/dist/components/ShowAboutContent/ShowAboutContent.test.js +535 -0
- package/dist/components/ShowAboutLayout/ShowAboutLayout.test.js +570 -0
- package/dist/components/SocialLinks/SocialLinks.js +1 -1
- package/dist/components/StringList/StringList.js +1 -1
- package/dist/components/StringList/StringList.test.js +311 -0
- package/dist/components/TabContent/TabContent.js +1 -1
- package/dist/components/TabContent/TabContent.test.js +274 -0
- package/dist/components/TabNavigation/TabNavigation.js +21 -21
- package/dist/components/TabNavigation/TabNavigation.test.js +535 -0
- package/dist/components/TabbedContent/TabbedContent.test.js +654 -0
- package/dist/components/TextArea/TextArea.js +1 -1
- package/dist/components/UpcomingList/UpcomingList.test.js +471 -0
- package/dist/{index-VjANCDXC.mjs → index-06PEPfBQ.mjs} +1 -1
- package/dist/index-BUN4jQ3m.mjs +3098 -0
- package/dist/index-BVxBrkZB.mjs +3 -0
- package/dist/{index-DC2JJV3a.mjs → index-D3kkcgee.mjs} +1 -1
- package/dist/{index-C-kn9Zhn.mjs → index-DzfYkULW.mjs} +2 -1
- package/dist/magic-string.es-uPKorP4O.mjs +663 -0
- package/dist/matchers-35e4d3bd-BBPNTlen.mjs +2404 -0
- package/dist/react.esm-DLSrfVwM.mjs +23410 -0
- package/dist/test/setupTests.d.ts +1 -0
- package/dist/test/setupTests.js +55 -0
- package/dist/{triangle-PcCcGXjr.mjs → triangle-C4z906Wf.mjs} +1 -1
- package/dist/useScheduleContext-D7FdzNxe.mjs +17 -0
- package/dist/utils/analytics.js +1 -1
- package/dist/utils/getOnNowProgram.js +10 -10
- package/dist/{x-C-QzJ-qD.mjs → x-Ck9Vk5Fo.mjs} +1 -1
- package/package.json +4 -1
- package/dist/ResultsTable.module-1zxhXaem.mjs +0 -14
- package/dist/_commonjsHelpers-C6fGbg64.mjs +0 -6
|
@@ -0,0 +1,654 @@
|
|
|
1
|
+
import { jsxs as v, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { v as f, d, b as m, i, r as s, g as t, w as r } from "../../react.esm-DLSrfVwM.mjs";
|
|
3
|
+
import { act as b } from "react";
|
|
4
|
+
import { TabbedContent as c } from "./TabbedContent.js";
|
|
5
|
+
import { TabNavigation as h } from "../TabNavigation/TabNavigation.js";
|
|
6
|
+
import { TabContent as g } from "../TabContent/TabContent.js";
|
|
7
|
+
f.mock("../TabNavigation", () => ({
|
|
8
|
+
default: f.fn(
|
|
9
|
+
({ tabs: o, onTabChanged: n, rightSideContent: e }) => /* @__PURE__ */ v("div", { "data-testid": "tab-navigation", children: [
|
|
10
|
+
/* @__PURE__ */ a("div", { "data-testid": "right-side-content", children: e }),
|
|
11
|
+
o.map(
|
|
12
|
+
(l, C) => /* @__PURE__ */ a(
|
|
13
|
+
"button",
|
|
14
|
+
{
|
|
15
|
+
"data-testid": `nav-tab-${C}`,
|
|
16
|
+
onClick: () => n(l),
|
|
17
|
+
children: l.title
|
|
18
|
+
},
|
|
19
|
+
C
|
|
20
|
+
)
|
|
21
|
+
)
|
|
22
|
+
] })
|
|
23
|
+
)
|
|
24
|
+
}));
|
|
25
|
+
f.mock("../TabContent", () => ({
|
|
26
|
+
default: f.fn(
|
|
27
|
+
({ content: o, classname: n }) => /* @__PURE__ */ a(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
className: n,
|
|
31
|
+
"data-testid": "tab-content",
|
|
32
|
+
children: o
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
)
|
|
36
|
+
}));
|
|
37
|
+
d("TabbedContent Component", () => {
|
|
38
|
+
m(() => {
|
|
39
|
+
f.clearAllMocks();
|
|
40
|
+
});
|
|
41
|
+
const o = (n) => ({
|
|
42
|
+
title: "Test Tab",
|
|
43
|
+
content: "Test Content",
|
|
44
|
+
classname: "test-class",
|
|
45
|
+
button: {
|
|
46
|
+
label: "Test",
|
|
47
|
+
gradientStartColor: "#ff0000",
|
|
48
|
+
gradientEndColor: "#00ff00",
|
|
49
|
+
buttonBgColor: "#ffffff",
|
|
50
|
+
buttonHoverBgColor: "#000000",
|
|
51
|
+
buttonTextColor: "#000000",
|
|
52
|
+
buttonHoverTextColor: "#ffffff",
|
|
53
|
+
borderHoverColor: "#cccccc"
|
|
54
|
+
},
|
|
55
|
+
...n
|
|
56
|
+
});
|
|
57
|
+
d("Basic Rendering", () => {
|
|
58
|
+
i("renders tabbed-content custom element", () => {
|
|
59
|
+
const n = [o()], { container: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
60
|
+
t(e.querySelector("tabbed-content")).toBeInTheDocument();
|
|
61
|
+
}), i("renders TabNavigation component", () => {
|
|
62
|
+
const n = [o()], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
63
|
+
t(e("tab-navigation")).toBeInTheDocument();
|
|
64
|
+
}), i("renders TabContent component", () => {
|
|
65
|
+
const n = [o()], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
66
|
+
t(e("tab-content")).toBeInTheDocument();
|
|
67
|
+
}), i("returns JSX.Element", () => {
|
|
68
|
+
const n = [o()], e = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
69
|
+
t(e.container.firstChild).toBeInstanceOf(HTMLElement);
|
|
70
|
+
});
|
|
71
|
+
}), d("State Initialization", () => {
|
|
72
|
+
i("initializes with first tab as current tab", () => {
|
|
73
|
+
const n = [
|
|
74
|
+
o({ title: "First", content: "First Content" }),
|
|
75
|
+
o({ title: "Second", content: "Second Content" })
|
|
76
|
+
], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n })), l = e("tab-content");
|
|
77
|
+
t(l.textContent).toBe("First Content");
|
|
78
|
+
}), i("initializes with tabs[0] content", () => {
|
|
79
|
+
const n = [
|
|
80
|
+
o({ content: "Expected Content" }),
|
|
81
|
+
o({ content: "Other Content" })
|
|
82
|
+
], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
83
|
+
t(e("tab-content").textContent).toBe("Expected Content");
|
|
84
|
+
}), i("initializes with tabs[0] classname", () => {
|
|
85
|
+
const n = [
|
|
86
|
+
o({ classname: "first-tab" }),
|
|
87
|
+
o({ classname: "second-tab" })
|
|
88
|
+
], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
89
|
+
t(e("tab-content")).toHaveClass("first-tab");
|
|
90
|
+
}), i("handles single tab array", () => {
|
|
91
|
+
const n = [o({ title: "Only Tab" })], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
92
|
+
t(e("tab-content")).toBeInTheDocument();
|
|
93
|
+
});
|
|
94
|
+
}), d("TabNavigation Props", () => {
|
|
95
|
+
i("passes tabs array to TabNavigation", () => {
|
|
96
|
+
const n = [o(), o()];
|
|
97
|
+
s(/* @__PURE__ */ a(c, { tabs: n })), t(h).toHaveBeenCalledWith(
|
|
98
|
+
t.objectContaining({ tabs: n }),
|
|
99
|
+
t.anything()
|
|
100
|
+
);
|
|
101
|
+
}), i("passes onTabChanged callback to TabNavigation", () => {
|
|
102
|
+
const n = [o()];
|
|
103
|
+
s(/* @__PURE__ */ a(c, { tabs: n })), t(h).toHaveBeenCalledWith(
|
|
104
|
+
t.objectContaining({
|
|
105
|
+
onTabChanged: t.any(Function)
|
|
106
|
+
}),
|
|
107
|
+
t.anything()
|
|
108
|
+
);
|
|
109
|
+
}), i("passes rightSideContent to TabNavigation when provided", () => {
|
|
110
|
+
const n = [o()], e = /* @__PURE__ */ a("div", { children: "Right Side" });
|
|
111
|
+
s(/* @__PURE__ */ a(c, { navRightSideContent: e, tabs: n })), t(h).toHaveBeenCalledWith(
|
|
112
|
+
t.objectContaining({ rightSideContent: e }),
|
|
113
|
+
t.anything()
|
|
114
|
+
);
|
|
115
|
+
}), i("passes undefined rightSideContent when not provided", () => {
|
|
116
|
+
const n = [o()];
|
|
117
|
+
s(/* @__PURE__ */ a(c, { tabs: n })), t(h).toHaveBeenCalledWith(
|
|
118
|
+
t.objectContaining({ rightSideContent: void 0 }),
|
|
119
|
+
t.anything()
|
|
120
|
+
);
|
|
121
|
+
});
|
|
122
|
+
}), d("TabContent Props", () => {
|
|
123
|
+
i("passes current tab content to TabContent", () => {
|
|
124
|
+
const n = [o({ content: "Current Tab Content" })];
|
|
125
|
+
s(/* @__PURE__ */ a(c, { tabs: n })), t(g).toHaveBeenCalledWith(
|
|
126
|
+
t.objectContaining({ content: "Current Tab Content" }),
|
|
127
|
+
t.anything()
|
|
128
|
+
);
|
|
129
|
+
}), i("passes current tab classname to TabContent when provided", () => {
|
|
130
|
+
const n = [o({ classname: "custom-class" })];
|
|
131
|
+
s(/* @__PURE__ */ a(c, { tabs: n })), t(g).toHaveBeenCalledWith(
|
|
132
|
+
t.objectContaining({ classname: "custom-class" }),
|
|
133
|
+
t.anything()
|
|
134
|
+
);
|
|
135
|
+
}), i("passes empty string classname when currentTab.classname is undefined", () => {
|
|
136
|
+
const n = [o({ classname: void 0 })];
|
|
137
|
+
s(/* @__PURE__ */ a(c, { tabs: n })), t(g).toHaveBeenCalledWith(
|
|
138
|
+
t.objectContaining({ classname: "" }),
|
|
139
|
+
t.anything()
|
|
140
|
+
);
|
|
141
|
+
}), i("passes empty string classname when currentTab.classname is empty string", () => {
|
|
142
|
+
const n = [o({ classname: "" })];
|
|
143
|
+
s(/* @__PURE__ */ a(c, { tabs: n })), t(g).toHaveBeenCalledWith(
|
|
144
|
+
t.objectContaining({ classname: "" }),
|
|
145
|
+
t.anything()
|
|
146
|
+
);
|
|
147
|
+
});
|
|
148
|
+
}), d("Tab Switching", () => {
|
|
149
|
+
i("updates current tab when onTabChanged is called", async () => {
|
|
150
|
+
const n = [
|
|
151
|
+
o({ title: "Tab 1", content: "Content 1" }),
|
|
152
|
+
o({ title: "Tab 2", content: "Content 2" })
|
|
153
|
+
], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
154
|
+
t(e("tab-content").textContent).toBe("Content 1");
|
|
155
|
+
const l = e("nav-tab-1");
|
|
156
|
+
await b(async () => {
|
|
157
|
+
l.click();
|
|
158
|
+
}), await r(() => {
|
|
159
|
+
t(e("tab-content").textContent).toBe("Content 2");
|
|
160
|
+
});
|
|
161
|
+
}), i("updates TabContent classname when tab switches", async () => {
|
|
162
|
+
const n = [
|
|
163
|
+
o({ classname: "tab-1-class" }),
|
|
164
|
+
o({ classname: "tab-2-class" })
|
|
165
|
+
], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
166
|
+
t(e("tab-content")).toHaveClass("tab-1-class"), await b(async () => {
|
|
167
|
+
e("nav-tab-1").click();
|
|
168
|
+
}), await r(() => {
|
|
169
|
+
t(e("tab-content")).toHaveClass("tab-2-class");
|
|
170
|
+
});
|
|
171
|
+
}), i("switches between multiple tabs", async () => {
|
|
172
|
+
const n = [
|
|
173
|
+
o({ title: "Tab 1", content: "Content 1" }),
|
|
174
|
+
o({ title: "Tab 2", content: "Content 2" }),
|
|
175
|
+
o({ title: "Tab 3", content: "Content 3" })
|
|
176
|
+
], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
177
|
+
t(e("tab-content").textContent).toBe("Content 1"), await b(async () => {
|
|
178
|
+
e("nav-tab-2").click();
|
|
179
|
+
}), await r(() => t(e("tab-content").textContent).toBe("Content 3")), await b(async () => {
|
|
180
|
+
e("nav-tab-1").click();
|
|
181
|
+
}), await r(() => t(e("tab-content").textContent).toBe("Content 2")), await b(async () => {
|
|
182
|
+
e("nav-tab-0").click();
|
|
183
|
+
}), await r(() => t(e("tab-content").textContent).toBe("Content 1"));
|
|
184
|
+
}), i("can switch back to first tab after changing", async () => {
|
|
185
|
+
const n = [
|
|
186
|
+
o({ content: "First" }),
|
|
187
|
+
o({ content: "Second" })
|
|
188
|
+
], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
189
|
+
await b(async () => {
|
|
190
|
+
e("nav-tab-1").click();
|
|
191
|
+
}), await r(() => t(e("tab-content").textContent).toBe("Second")), await b(async () => {
|
|
192
|
+
e("nav-tab-0").click();
|
|
193
|
+
}), await r(() => t(e("tab-content").textContent).toBe("First"));
|
|
194
|
+
});
|
|
195
|
+
}), d("Tab Type - Required Fields", () => {
|
|
196
|
+
i("handles tab with title and content only", () => {
|
|
197
|
+
const n = [{
|
|
198
|
+
title: "Simple Tab",
|
|
199
|
+
content: "Simple Content"
|
|
200
|
+
}], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
201
|
+
t(e("tab-content").textContent).toBe("Simple Content");
|
|
202
|
+
}), i("handles string content", () => {
|
|
203
|
+
const n = [o({ content: "String content" })], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
204
|
+
t(e("tab-content").textContent).toBe("String content");
|
|
205
|
+
}), i("handles JSX.Element content", () => {
|
|
206
|
+
const e = [o({ content: /* @__PURE__ */ a("div", { "data-testid": "jsx-content", children: "JSX Content" }) })], { getByTestId: l } = s(/* @__PURE__ */ a(c, { tabs: e }));
|
|
207
|
+
t(l("jsx-content")).toBeInTheDocument();
|
|
208
|
+
}), i("handles number content", () => {
|
|
209
|
+
const n = [o({ content: 42 })], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
210
|
+
t(e("tab-content").textContent).toBe("42");
|
|
211
|
+
}), i("handles null content", () => {
|
|
212
|
+
const n = [o({ content: null })], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
213
|
+
t(e("tab-content").textContent).toBe("");
|
|
214
|
+
}), i("handles undefined content", () => {
|
|
215
|
+
const n = [o({ content: void 0 })], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
216
|
+
t(e("tab-content").textContent).toBe("");
|
|
217
|
+
});
|
|
218
|
+
}), d("Tab Type - Optional Fields", () => {
|
|
219
|
+
i("handles tab without classname", () => {
|
|
220
|
+
s(/* @__PURE__ */ a(c, { tabs: [{
|
|
221
|
+
title: "Tab",
|
|
222
|
+
content: "Content"
|
|
223
|
+
}] })), t(g).toHaveBeenCalledWith(
|
|
224
|
+
t.objectContaining({ classname: "" }),
|
|
225
|
+
t.anything()
|
|
226
|
+
);
|
|
227
|
+
}), i("handles tab without button config", () => {
|
|
228
|
+
const n = [{
|
|
229
|
+
title: "Tab",
|
|
230
|
+
content: "Content"
|
|
231
|
+
}], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
232
|
+
t(e("tab-navigation")).toBeInTheDocument();
|
|
233
|
+
}), i("handles tab with partial button config", () => {
|
|
234
|
+
const n = [{
|
|
235
|
+
title: "Tab",
|
|
236
|
+
content: "Content",
|
|
237
|
+
button: {
|
|
238
|
+
label: "Label",
|
|
239
|
+
gradientStartColor: "#ff0000",
|
|
240
|
+
gradientEndColor: "#00ff00",
|
|
241
|
+
buttonBgColor: "#ffffff",
|
|
242
|
+
buttonHoverBgColor: "#000000",
|
|
243
|
+
buttonTextColor: "#000000",
|
|
244
|
+
buttonHoverTextColor: "#ffffff"
|
|
245
|
+
// borderHoverColor omitted (optional)
|
|
246
|
+
}
|
|
247
|
+
}];
|
|
248
|
+
t(() => s(/* @__PURE__ */ a(c, { tabs: n }))).not.toThrow();
|
|
249
|
+
}), i("handles tab with full button config including borderHoverColor", () => {
|
|
250
|
+
const n = [o()];
|
|
251
|
+
t(() => s(/* @__PURE__ */ a(c, { tabs: n }))).not.toThrow();
|
|
252
|
+
});
|
|
253
|
+
}), d("Multiple Tabs", () => {
|
|
254
|
+
i("handles two tabs", () => {
|
|
255
|
+
const n = [
|
|
256
|
+
o({ title: "Tab 1" }),
|
|
257
|
+
o({ title: "Tab 2" })
|
|
258
|
+
], { getAllByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n })), l = e(/nav-tab-/);
|
|
259
|
+
t(l).toHaveLength(2);
|
|
260
|
+
}), i("handles many tabs", () => {
|
|
261
|
+
const n = Array.from(
|
|
262
|
+
{ length: 10 },
|
|
263
|
+
(C, T) => o({ title: `Tab ${T}`, content: `Content ${T}` })
|
|
264
|
+
), { getAllByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n })), l = e(/nav-tab-/);
|
|
265
|
+
t(l).toHaveLength(10);
|
|
266
|
+
}), i("handles tabs with different classnames", async () => {
|
|
267
|
+
const n = [
|
|
268
|
+
o({ classname: "class-a" }),
|
|
269
|
+
o({ classname: "class-b" }),
|
|
270
|
+
o({ classname: "class-c" })
|
|
271
|
+
], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
272
|
+
t(e("tab-content")).toHaveClass("class-a"), await b(async () => {
|
|
273
|
+
e("nav-tab-1").click();
|
|
274
|
+
}), await r(() => t(e("tab-content")).toHaveClass("class-b")), await b(async () => {
|
|
275
|
+
e("nav-tab-2").click();
|
|
276
|
+
}), await r(() => t(e("tab-content")).toHaveClass("class-c"));
|
|
277
|
+
}), i("handles tabs with mixed classname presence", async () => {
|
|
278
|
+
const n = [
|
|
279
|
+
o({ classname: "has-class" }),
|
|
280
|
+
o({ classname: void 0 }),
|
|
281
|
+
o({ classname: "" })
|
|
282
|
+
], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
283
|
+
t(e("tab-content")).toHaveClass("has-class"), await b(async () => {
|
|
284
|
+
e("nav-tab-1").click();
|
|
285
|
+
}), await r(() => t(e("tab-content").className).toBe("")), await b(async () => {
|
|
286
|
+
e("nav-tab-2").click();
|
|
287
|
+
}), await r(() => t(e("tab-content").className).toBe(""));
|
|
288
|
+
});
|
|
289
|
+
}), d("navRightSideContent Prop", () => {
|
|
290
|
+
i("renders navRightSideContent when provided", () => {
|
|
291
|
+
const n = [o()], e = /* @__PURE__ */ a("div", { "data-testid": "right-content", children: "Right" }), { getByTestId: l } = s(
|
|
292
|
+
/* @__PURE__ */ a(c, { navRightSideContent: e, tabs: n })
|
|
293
|
+
);
|
|
294
|
+
t(l("right-side-content").textContent).toBe("Right");
|
|
295
|
+
}), i("handles string navRightSideContent", () => {
|
|
296
|
+
const n = [o()], { getByTestId: e } = s(
|
|
297
|
+
/* @__PURE__ */ a(c, { navRightSideContent: "Right Side Text", tabs: n })
|
|
298
|
+
);
|
|
299
|
+
t(e("right-side-content").textContent).toBe("Right Side Text");
|
|
300
|
+
}), i("handles JSX navRightSideContent", () => {
|
|
301
|
+
const n = [o()], e = /* @__PURE__ */ a("button", { "data-testid": "right-button", children: "Click" }), { getByTestId: l } = s(
|
|
302
|
+
/* @__PURE__ */ a(c, { navRightSideContent: e, tabs: n })
|
|
303
|
+
);
|
|
304
|
+
t(l("right-button")).toBeInTheDocument();
|
|
305
|
+
}), i("handles complex navRightSideContent", () => {
|
|
306
|
+
const n = [o()], e = /* @__PURE__ */ v("div", { children: [
|
|
307
|
+
/* @__PURE__ */ a("span", { children: "Label" }),
|
|
308
|
+
/* @__PURE__ */ a("input", { "aria-label": "test input", "data-testid": "input", type: "text" })
|
|
309
|
+
] }), { getByTestId: l } = s(
|
|
310
|
+
/* @__PURE__ */ a(c, { navRightSideContent: e, tabs: n })
|
|
311
|
+
);
|
|
312
|
+
t(l("input")).toBeInTheDocument();
|
|
313
|
+
}), i("renders without navRightSideContent when not provided", () => {
|
|
314
|
+
const n = [o()], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
315
|
+
t(e("right-side-content").textContent).toBe("");
|
|
316
|
+
});
|
|
317
|
+
}), d("Classname Logic", () => {
|
|
318
|
+
i("uses ternary operator for classname (truthy classname)", () => {
|
|
319
|
+
const n = [o({ classname: "my-class" })];
|
|
320
|
+
s(/* @__PURE__ */ a(c, { tabs: n })), t(g).toHaveBeenCalledWith(
|
|
321
|
+
t.objectContaining({ classname: "my-class" }),
|
|
322
|
+
t.anything()
|
|
323
|
+
);
|
|
324
|
+
}), i("uses ternary operator for classname (falsy classname)", () => {
|
|
325
|
+
const n = [o({ classname: void 0 })];
|
|
326
|
+
s(/* @__PURE__ */ a(c, { tabs: n })), t(g).toHaveBeenCalledWith(
|
|
327
|
+
t.objectContaining({ classname: "" }),
|
|
328
|
+
t.anything()
|
|
329
|
+
);
|
|
330
|
+
}), i("treats empty string classname as falsy in ternary", () => {
|
|
331
|
+
const n = [o({ classname: "" })];
|
|
332
|
+
s(/* @__PURE__ */ a(c, { tabs: n })), t(g).toHaveBeenCalledWith(
|
|
333
|
+
t.objectContaining({ classname: "" }),
|
|
334
|
+
t.anything()
|
|
335
|
+
);
|
|
336
|
+
}), i("preserves non-empty classname strings", () => {
|
|
337
|
+
const n = [o({ classname: "a b c" })];
|
|
338
|
+
s(/* @__PURE__ */ a(c, { tabs: n })), t(g).toHaveBeenCalledWith(
|
|
339
|
+
t.objectContaining({ classname: "a b c" }),
|
|
340
|
+
t.anything()
|
|
341
|
+
);
|
|
342
|
+
});
|
|
343
|
+
}), d("onTabChanged Callback", () => {
|
|
344
|
+
i("calls setCurrentTab with new tab", async () => {
|
|
345
|
+
const n = [
|
|
346
|
+
o({ title: "First" }),
|
|
347
|
+
o({ title: "Second" })
|
|
348
|
+
], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
349
|
+
t(g).toHaveBeenLastCalledWith(
|
|
350
|
+
t.objectContaining({ content: n[0].content }),
|
|
351
|
+
t.anything()
|
|
352
|
+
), await b(async () => {
|
|
353
|
+
e("nav-tab-1").click();
|
|
354
|
+
}), await r(() => {
|
|
355
|
+
t(g).toHaveBeenLastCalledWith(
|
|
356
|
+
t.objectContaining({ content: n[1].content }),
|
|
357
|
+
t.anything()
|
|
358
|
+
);
|
|
359
|
+
});
|
|
360
|
+
}), i("accepts Tab type parameter", () => {
|
|
361
|
+
const n = [o(), o()];
|
|
362
|
+
s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
363
|
+
const C = f.mocked(h).mock.calls[0][0].onTabChanged;
|
|
364
|
+
t(C).toBeDefined(), C && t(() => b(() => C(n[1]))).not.toThrow();
|
|
365
|
+
}), i("returns void", () => {
|
|
366
|
+
const n = [o(), o()];
|
|
367
|
+
s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
368
|
+
const C = f.mocked(h).mock.calls[0][0].onTabChanged;
|
|
369
|
+
if (t(C).toBeDefined(), C) {
|
|
370
|
+
let T;
|
|
371
|
+
b(() => {
|
|
372
|
+
T = C(n[1]);
|
|
373
|
+
}), t(T).toBeUndefined();
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
}), d("Type Safety", () => {
|
|
377
|
+
i("accepts Tab array with required fields only", () => {
|
|
378
|
+
const n = [
|
|
379
|
+
{ title: "Tab 1", content: "Content 1" },
|
|
380
|
+
{ title: "Tab 2", content: "Content 2" }
|
|
381
|
+
];
|
|
382
|
+
t(() => s(/* @__PURE__ */ a(c, { tabs: n }))).not.toThrow();
|
|
383
|
+
}), i("accepts Tab array with all optional fields", () => {
|
|
384
|
+
const n = [o()];
|
|
385
|
+
t(() => s(/* @__PURE__ */ a(c, { tabs: n }))).not.toThrow();
|
|
386
|
+
}), i("accepts string as React.ReactNode content", () => {
|
|
387
|
+
const n = [{ title: "Tab", content: "string" }];
|
|
388
|
+
t(() => s(/* @__PURE__ */ a(c, { tabs: n }))).not.toThrow();
|
|
389
|
+
}), i("accepts JSX.Element as React.ReactNode content", () => {
|
|
390
|
+
const n = [{ title: "Tab", content: /* @__PURE__ */ a("div", { children: "JSX" }) }];
|
|
391
|
+
t(() => s(/* @__PURE__ */ a(c, { tabs: n }))).not.toThrow();
|
|
392
|
+
}), i("accepts number as React.ReactNode content", () => {
|
|
393
|
+
const n = [{ title: "Tab", content: 42 }];
|
|
394
|
+
t(() => s(/* @__PURE__ */ a(c, { tabs: n }))).not.toThrow();
|
|
395
|
+
}), i("accepts null as React.ReactNode content", () => {
|
|
396
|
+
const n = [{ title: "Tab", content: null }];
|
|
397
|
+
t(() => s(/* @__PURE__ */ a(c, { tabs: n }))).not.toThrow();
|
|
398
|
+
}), i("accepts undefined as React.ReactNode content", () => {
|
|
399
|
+
const n = [{ title: "Tab", content: void 0 }];
|
|
400
|
+
t(() => s(/* @__PURE__ */ a(c, { tabs: n }))).not.toThrow();
|
|
401
|
+
}), i("accepts optional navRightSideContent", () => {
|
|
402
|
+
const n = [o()];
|
|
403
|
+
t(() => s(/* @__PURE__ */ a(c, { tabs: n }))).not.toThrow(), t(() => s(/* @__PURE__ */ a(c, { navRightSideContent: "text", tabs: n }))).not.toThrow();
|
|
404
|
+
}), i("throws error with empty tabs array", () => {
|
|
405
|
+
const n = [], e = f.spyOn(console, "error").mockImplementation(() => {
|
|
406
|
+
});
|
|
407
|
+
t(() => s(/* @__PURE__ */ a(c, { tabs: n }))).toThrow(), e.mockRestore();
|
|
408
|
+
});
|
|
409
|
+
}), d("Button Configuration", () => {
|
|
410
|
+
i("passes tab with gradient colors", () => {
|
|
411
|
+
const n = [o({
|
|
412
|
+
button: {
|
|
413
|
+
label: "Gradient Button",
|
|
414
|
+
gradientStartColor: "#ff0000",
|
|
415
|
+
gradientEndColor: "#0000ff",
|
|
416
|
+
buttonBgColor: "#ffffff",
|
|
417
|
+
buttonHoverBgColor: "#000000",
|
|
418
|
+
buttonTextColor: "#333333",
|
|
419
|
+
buttonHoverTextColor: "#ffffff"
|
|
420
|
+
}
|
|
421
|
+
})];
|
|
422
|
+
s(/* @__PURE__ */ a(c, { tabs: n })), t(h).toHaveBeenCalledWith(
|
|
423
|
+
t.objectContaining({
|
|
424
|
+
tabs: t.arrayContaining([
|
|
425
|
+
t.objectContaining({
|
|
426
|
+
button: t.objectContaining({
|
|
427
|
+
gradientStartColor: "#ff0000",
|
|
428
|
+
gradientEndColor: "#0000ff"
|
|
429
|
+
})
|
|
430
|
+
})
|
|
431
|
+
])
|
|
432
|
+
}),
|
|
433
|
+
t.anything()
|
|
434
|
+
);
|
|
435
|
+
}), i("passes tab with button background colors", () => {
|
|
436
|
+
const n = [o({
|
|
437
|
+
button: {
|
|
438
|
+
label: "Button",
|
|
439
|
+
gradientStartColor: "#ff0000",
|
|
440
|
+
gradientEndColor: "#00ff00",
|
|
441
|
+
buttonBgColor: "#eeeeee",
|
|
442
|
+
buttonHoverBgColor: "#dddddd",
|
|
443
|
+
buttonTextColor: "#000000",
|
|
444
|
+
buttonHoverTextColor: "#ffffff"
|
|
445
|
+
}
|
|
446
|
+
})];
|
|
447
|
+
s(/* @__PURE__ */ a(c, { tabs: n })), t(h).toHaveBeenCalledWith(
|
|
448
|
+
t.objectContaining({
|
|
449
|
+
tabs: t.arrayContaining([
|
|
450
|
+
t.objectContaining({
|
|
451
|
+
button: t.objectContaining({
|
|
452
|
+
buttonBgColor: "#eeeeee",
|
|
453
|
+
buttonHoverBgColor: "#dddddd"
|
|
454
|
+
})
|
|
455
|
+
})
|
|
456
|
+
])
|
|
457
|
+
}),
|
|
458
|
+
t.anything()
|
|
459
|
+
);
|
|
460
|
+
}), i("passes tab with text colors", () => {
|
|
461
|
+
const n = [o({
|
|
462
|
+
button: {
|
|
463
|
+
label: "Button",
|
|
464
|
+
gradientStartColor: "#ff0000",
|
|
465
|
+
gradientEndColor: "#00ff00",
|
|
466
|
+
buttonBgColor: "#ffffff",
|
|
467
|
+
buttonHoverBgColor: "#000000",
|
|
468
|
+
buttonTextColor: "#ff0000",
|
|
469
|
+
buttonHoverTextColor: "#00ff00"
|
|
470
|
+
}
|
|
471
|
+
})];
|
|
472
|
+
s(/* @__PURE__ */ a(c, { tabs: n })), t(h).toHaveBeenCalledWith(
|
|
473
|
+
t.objectContaining({
|
|
474
|
+
tabs: t.arrayContaining([
|
|
475
|
+
t.objectContaining({
|
|
476
|
+
button: t.objectContaining({
|
|
477
|
+
buttonTextColor: "#ff0000",
|
|
478
|
+
buttonHoverTextColor: "#00ff00"
|
|
479
|
+
})
|
|
480
|
+
})
|
|
481
|
+
])
|
|
482
|
+
}),
|
|
483
|
+
t.anything()
|
|
484
|
+
);
|
|
485
|
+
}), i("passes tab with optional borderHoverColor", () => {
|
|
486
|
+
const n = [o({
|
|
487
|
+
button: {
|
|
488
|
+
label: "Button",
|
|
489
|
+
gradientStartColor: "#ff0000",
|
|
490
|
+
gradientEndColor: "#00ff00",
|
|
491
|
+
buttonBgColor: "#ffffff",
|
|
492
|
+
buttonHoverBgColor: "#000000",
|
|
493
|
+
buttonTextColor: "#000000",
|
|
494
|
+
buttonHoverTextColor: "#ffffff",
|
|
495
|
+
borderHoverColor: "#ff00ff"
|
|
496
|
+
}
|
|
497
|
+
})];
|
|
498
|
+
s(/* @__PURE__ */ a(c, { tabs: n })), t(h).toHaveBeenCalledWith(
|
|
499
|
+
t.objectContaining({
|
|
500
|
+
tabs: t.arrayContaining([
|
|
501
|
+
t.objectContaining({
|
|
502
|
+
button: t.objectContaining({
|
|
503
|
+
borderHoverColor: "#ff00ff"
|
|
504
|
+
})
|
|
505
|
+
})
|
|
506
|
+
])
|
|
507
|
+
}),
|
|
508
|
+
t.anything()
|
|
509
|
+
);
|
|
510
|
+
});
|
|
511
|
+
}), d("Integration Tests", () => {
|
|
512
|
+
i("orchestrates TabNavigation and TabContent correctly", async () => {
|
|
513
|
+
const n = [
|
|
514
|
+
o({
|
|
515
|
+
title: "Videos",
|
|
516
|
+
content: /* @__PURE__ */ a("div", { children: "Video List" }),
|
|
517
|
+
classname: "videos-panel"
|
|
518
|
+
}),
|
|
519
|
+
o({
|
|
520
|
+
title: "Photos",
|
|
521
|
+
content: /* @__PURE__ */ a("div", { children: "Photo Gallery" }),
|
|
522
|
+
classname: "photos-panel"
|
|
523
|
+
})
|
|
524
|
+
], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
525
|
+
t(h).toHaveBeenCalledWith(
|
|
526
|
+
t.objectContaining({ tabs: n }),
|
|
527
|
+
t.anything()
|
|
528
|
+
), t(e("tab-content")).toHaveClass("videos-panel"), await b(async () => {
|
|
529
|
+
e("nav-tab-1").click();
|
|
530
|
+
}), await r(() => {
|
|
531
|
+
t(e("tab-content")).toHaveClass("photos-panel");
|
|
532
|
+
});
|
|
533
|
+
}), i("handles complete tabbed interface workflow", async () => {
|
|
534
|
+
const n = [
|
|
535
|
+
{
|
|
536
|
+
title: "Tab 1",
|
|
537
|
+
content: "Content 1",
|
|
538
|
+
classname: "tab-1",
|
|
539
|
+
button: {
|
|
540
|
+
label: "Button 1",
|
|
541
|
+
gradientStartColor: "#ff0000",
|
|
542
|
+
gradientEndColor: "#00ff00",
|
|
543
|
+
buttonBgColor: "#ffffff",
|
|
544
|
+
buttonHoverBgColor: "#000000",
|
|
545
|
+
buttonTextColor: "#000000",
|
|
546
|
+
buttonHoverTextColor: "#ffffff"
|
|
547
|
+
}
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
title: "Tab 2",
|
|
551
|
+
content: "Content 2",
|
|
552
|
+
classname: "tab-2"
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
title: "Tab 3",
|
|
556
|
+
content: "Content 3"
|
|
557
|
+
}
|
|
558
|
+
], e = /* @__PURE__ */ a("button", { children: "Action" }), { getByTestId: l } = s(
|
|
559
|
+
/* @__PURE__ */ a(
|
|
560
|
+
c,
|
|
561
|
+
{
|
|
562
|
+
navRightSideContent: e,
|
|
563
|
+
tabs: n
|
|
564
|
+
}
|
|
565
|
+
)
|
|
566
|
+
);
|
|
567
|
+
t(l("tab-navigation")).toBeInTheDocument(), t(l("tab-content")).toBeInTheDocument(), t(l("right-side-content").textContent).toBe("Action"), t(l("tab-content").textContent).toBe("Content 1"), t(l("tab-content")).toHaveClass("tab-1"), await b(async () => {
|
|
568
|
+
l("nav-tab-2").click();
|
|
569
|
+
}), await r(() => {
|
|
570
|
+
t(l("tab-content").textContent).toBe("Content 3"), t(l("tab-content").className).toBe("");
|
|
571
|
+
});
|
|
572
|
+
}), i("maintains state across tab switches", async () => {
|
|
573
|
+
const n = [
|
|
574
|
+
o({ title: "A", content: "Content A" }),
|
|
575
|
+
o({ title: "B", content: "Content B" }),
|
|
576
|
+
o({ title: "C", content: "Content C" })
|
|
577
|
+
], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
578
|
+
t(e("tab-content").textContent).toBe("Content A"), await b(async () => {
|
|
579
|
+
e("nav-tab-1").click();
|
|
580
|
+
}), await r(() => t(e("tab-content").textContent).toBe("Content B")), await b(async () => {
|
|
581
|
+
e("nav-tab-2").click();
|
|
582
|
+
}), await r(() => t(e("tab-content").textContent).toBe("Content C")), await b(async () => {
|
|
583
|
+
e("nav-tab-0").click();
|
|
584
|
+
}), await r(() => t(e("tab-content").textContent).toBe("Content A")), await b(async () => {
|
|
585
|
+
e("nav-tab-1").click();
|
|
586
|
+
}), await r(() => t(e("tab-content").textContent).toBe("Content B"));
|
|
587
|
+
}), i("works with dynamic content types", async () => {
|
|
588
|
+
const n = [
|
|
589
|
+
o({ content: "String content" }),
|
|
590
|
+
o({ content: /* @__PURE__ */ a("div", { children: "JSX content" }) }),
|
|
591
|
+
o({ content: 123 }),
|
|
592
|
+
o({ content: null })
|
|
593
|
+
], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
594
|
+
t(e("tab-content").textContent).toBe("String content"), await b(async () => {
|
|
595
|
+
e("nav-tab-1").click();
|
|
596
|
+
}), await r(() => t(e("tab-content").textContent).toBe("JSX content")), await b(async () => {
|
|
597
|
+
e("nav-tab-2").click();
|
|
598
|
+
}), await r(() => t(e("tab-content").textContent).toBe("123")), await b(async () => {
|
|
599
|
+
e("nav-tab-3").click();
|
|
600
|
+
}), await r(() => t(e("tab-content").textContent).toBe(""));
|
|
601
|
+
});
|
|
602
|
+
}), d("Edge Cases", () => {
|
|
603
|
+
i("throws error with empty tabs array", () => {
|
|
604
|
+
const n = [], e = f.spyOn(console, "error").mockImplementation(() => {
|
|
605
|
+
});
|
|
606
|
+
t(() => s(/* @__PURE__ */ a(c, { tabs: n }))).toThrow(), e.mockRestore();
|
|
607
|
+
}), i("handles tab with very long title", () => {
|
|
608
|
+
const n = "A".repeat(1e3), e = [o({ title: n })];
|
|
609
|
+
t(() => s(/* @__PURE__ */ a(c, { tabs: e }))).not.toThrow();
|
|
610
|
+
}), i("handles tab with complex nested JSX content", () => {
|
|
611
|
+
const e = [o({ content: /* @__PURE__ */ v("div", { children: [
|
|
612
|
+
/* @__PURE__ */ v("header", { children: [
|
|
613
|
+
/* @__PURE__ */ a("h1", { children: "Title" }),
|
|
614
|
+
/* @__PURE__ */ a("nav", { children: /* @__PURE__ */ v("ul", { children: [
|
|
615
|
+
/* @__PURE__ */ a("li", { children: "Item 1" }),
|
|
616
|
+
/* @__PURE__ */ a("li", { children: "Item 2" })
|
|
617
|
+
] }) })
|
|
618
|
+
] }),
|
|
619
|
+
/* @__PURE__ */ a("main", { children: /* @__PURE__ */ a("article", { children: "Content" }) })
|
|
620
|
+
] }) })];
|
|
621
|
+
t(() => s(/* @__PURE__ */ a(c, { tabs: e }))).not.toThrow();
|
|
622
|
+
}), i("handles rapid tab switching", async () => {
|
|
623
|
+
const n = [
|
|
624
|
+
o({ content: "A" }),
|
|
625
|
+
o({ content: "B" }),
|
|
626
|
+
o({ content: "C" })
|
|
627
|
+
], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
628
|
+
await b(async () => {
|
|
629
|
+
e("nav-tab-1").click(), e("nav-tab-2").click(), e("nav-tab-0").click(), e("nav-tab-1").click();
|
|
630
|
+
}), await r(() => {
|
|
631
|
+
t(e("tab-content").textContent).toBe("B");
|
|
632
|
+
});
|
|
633
|
+
}), i("handles clicking same tab multiple times", () => {
|
|
634
|
+
const n = [
|
|
635
|
+
o({ content: "First" }),
|
|
636
|
+
o({ content: "Second" })
|
|
637
|
+
], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
638
|
+
e("nav-tab-0").click(), e("nav-tab-0").click(), e("nav-tab-0").click(), t(e("tab-content").textContent).toBe("First");
|
|
639
|
+
}), i("handles tab with all optional fields as undefined", () => {
|
|
640
|
+
const n = [{
|
|
641
|
+
title: "Tab",
|
|
642
|
+
content: "Content",
|
|
643
|
+
classname: void 0,
|
|
644
|
+
button: void 0
|
|
645
|
+
}];
|
|
646
|
+
t(() => s(/* @__PURE__ */ a(c, { tabs: n }))).not.toThrow();
|
|
647
|
+
}), i("handles special characters in classnames", () => {
|
|
648
|
+
const n = [
|
|
649
|
+
o({ classname: "tab-1_active--selected" })
|
|
650
|
+
], { getByTestId: e } = s(/* @__PURE__ */ a(c, { tabs: n }));
|
|
651
|
+
t(e("tab-content")).toHaveClass("tab-1_active--selected");
|
|
652
|
+
});
|
|
653
|
+
});
|
|
654
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as s, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { useState as l, useRef as V } from "react";
|
|
3
3
|
import { classes as f } from "../../utils/helpers.js";
|
|
4
|
-
import { s as e, C as k, A as w } from "../../Form.module-
|
|
4
|
+
import { s as e, C as k, A as w } from "../../Form.module-CarfWK5T.mjs";
|
|
5
5
|
function T(m) {
|
|
6
6
|
var o, d, u;
|
|
7
7
|
const { name: i, label: h, rows: p, width: _, helpText: v, ...x } = m, [C, N] = l(`${e["form-field__input"]}`), t = V(null), [r, n] = l(""), [c, b] = l("clean"), g = `input-width--${_}`, y = () => {
|