@scrippsproduct/networks-ui-library 1.1.9 → 1.1.10
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,705 @@
|
|
|
1
|
+
import { jsx as s, jsxs as g, Fragment as m } from "react/jsx-runtime";
|
|
2
|
+
import { v as h, d as u, b as B, a as w, i as r, r as a, g as o, s as i, w as c, f as p } from "../../react.esm-DLSrfVwM.mjs";
|
|
3
|
+
import "../../index-BVxBrkZB.mjs";
|
|
4
|
+
import { Carousel as n } from "./Carousel.js";
|
|
5
|
+
h.mock("./CarouselUtils.class", () => ({
|
|
6
|
+
default: h.fn().mockImplementation(() => ({
|
|
7
|
+
determineScrollAction: h.fn(),
|
|
8
|
+
navigateToIndex: h.fn(),
|
|
9
|
+
clearTimer: h.fn(),
|
|
10
|
+
startTimer: h.fn(),
|
|
11
|
+
handleScrollEnd: h.fn()
|
|
12
|
+
}))
|
|
13
|
+
}));
|
|
14
|
+
h.mock("../CarouselSlide", () => ({
|
|
15
|
+
CarouselSlide: ({ slide: l, index: e }) => /* @__PURE__ */ s("li", { "data-testid": `carousel-slide-${e}`, "data-index": e, children: l.ariaLabel }),
|
|
16
|
+
default: ({ slide: l, index: e }) => /* @__PURE__ */ s("li", { "data-testid": `carousel-slide-${e}`, "data-index": e, children: l.ariaLabel })
|
|
17
|
+
}));
|
|
18
|
+
h.mock("react-feather", () => ({
|
|
19
|
+
ChevronLeft: () => /* @__PURE__ */ s("span", { "data-testid": "chevron-left", children: "Left" }),
|
|
20
|
+
ChevronRight: () => /* @__PURE__ */ s("span", { "data-testid": "chevron-right", children: "Right" })
|
|
21
|
+
}));
|
|
22
|
+
h.mock("../../utils/helpers", () => ({
|
|
23
|
+
classes: (l) => l.filter(Boolean).join(" "),
|
|
24
|
+
chunkArray: (l, e) => {
|
|
25
|
+
let t = [];
|
|
26
|
+
for (let d = 0; d <= Math.floor(e.length / l); d++)
|
|
27
|
+
e.slice(d * l, l * (d + 1)).length && t.push(e.slice(d * l, l * (d + 1)));
|
|
28
|
+
return t;
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
u("Carousel", () => {
|
|
32
|
+
const l = [
|
|
33
|
+
{ id: 1, props: { title: "Cell 1" }, title: "Cell 1", layout: "default" },
|
|
34
|
+
{ id: 2, props: { title: "Cell 2" }, title: "Cell 2", layout: "default" },
|
|
35
|
+
{ id: 3, props: { title: "Cell 3" }, title: "Cell 3", layout: "default" },
|
|
36
|
+
{ id: 4, props: { title: "Cell 4" }, title: "Cell 4", layout: "default" }
|
|
37
|
+
];
|
|
38
|
+
B(() => {
|
|
39
|
+
h.clearAllMocks();
|
|
40
|
+
}), w(() => {
|
|
41
|
+
h.clearAllTimers();
|
|
42
|
+
}), u("Basic Rendering", () => {
|
|
43
|
+
r("should render carousel with basic props", () => {
|
|
44
|
+
const { container: e } = a(/* @__PURE__ */ s(n, { id: "test-carousel", cells: l })), t = e.querySelector('[role="region"]');
|
|
45
|
+
o(t).toBeInTheDocument();
|
|
46
|
+
}), r("should render carousel with correct id", () => {
|
|
47
|
+
const { container: e } = a(/* @__PURE__ */ s(n, { id: "my-carousel", cells: l })), t = e.querySelector("#carousel-my-carousel");
|
|
48
|
+
o(t).toBeInTheDocument();
|
|
49
|
+
}), r("should render carousel with numeric id", () => {
|
|
50
|
+
const { container: e } = a(/* @__PURE__ */ s(n, { id: 123, cells: l })), t = e.querySelector("#carousel-123");
|
|
51
|
+
o(t).toBeInTheDocument();
|
|
52
|
+
}), r("should render with aria-roledescription", () => {
|
|
53
|
+
const { container: e } = a(/* @__PURE__ */ s(n, { id: "test", cells: l })), t = e.querySelector('[aria-roledescription="carousel"]');
|
|
54
|
+
o(t).toBeInTheDocument();
|
|
55
|
+
}), r("should render scroller element", () => {
|
|
56
|
+
a(/* @__PURE__ */ s(n, { id: "test", cells: l }));
|
|
57
|
+
const e = i.getByRole("group", { name: "Items Scroller" });
|
|
58
|
+
o(e).toBeInTheDocument();
|
|
59
|
+
}), r("should render slides", async () => {
|
|
60
|
+
a(/* @__PURE__ */ s(n, { id: "test", cells: l })), await c(() => {
|
|
61
|
+
const e = i.getAllByTestId(/carousel-slide-/);
|
|
62
|
+
o(e.length).toBeGreaterThan(0);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}), u("Options - Title", () => {
|
|
66
|
+
r("should render with aria-label when title is provided", () => {
|
|
67
|
+
const { container: e } = a(
|
|
68
|
+
/* @__PURE__ */ s(n, { id: "test", cells: l, options: { title: "My Carousel" } })
|
|
69
|
+
), t = e.querySelector('[aria-label="My Carousel"]');
|
|
70
|
+
o(t).toBeInTheDocument();
|
|
71
|
+
}), r("should handle empty title", () => {
|
|
72
|
+
const { container: e } = a(
|
|
73
|
+
/* @__PURE__ */ s(n, { id: "test", cells: l, options: { title: "" } })
|
|
74
|
+
), t = e.querySelector('[role="region"]');
|
|
75
|
+
o(t).toBeInTheDocument();
|
|
76
|
+
});
|
|
77
|
+
}), u("Options - Controls", () => {
|
|
78
|
+
r("should render navigation controls when showControls is true", async () => {
|
|
79
|
+
a(
|
|
80
|
+
/* @__PURE__ */ s(
|
|
81
|
+
n,
|
|
82
|
+
{
|
|
83
|
+
id: "test",
|
|
84
|
+
cells: l,
|
|
85
|
+
options: { showControls: !0 }
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
), await c(() => {
|
|
89
|
+
const e = i.getByLabelText("Previous Item"), t = i.getByLabelText("Next Item");
|
|
90
|
+
o(e).toBeInTheDocument(), o(t).toBeInTheDocument();
|
|
91
|
+
});
|
|
92
|
+
}), r("should not render navigation controls when showControls is false", () => {
|
|
93
|
+
a(
|
|
94
|
+
/* @__PURE__ */ s(
|
|
95
|
+
n,
|
|
96
|
+
{
|
|
97
|
+
id: "test",
|
|
98
|
+
cells: l,
|
|
99
|
+
options: { showControls: !1 }
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
);
|
|
103
|
+
const e = i.queryByLabelText("Previous Item"), t = i.queryByLabelText("Next Item");
|
|
104
|
+
o(e).not.toBeInTheDocument(), o(t).not.toBeInTheDocument();
|
|
105
|
+
}), r("should not render controls when cells length equals cellsPerSlide", () => {
|
|
106
|
+
a(
|
|
107
|
+
/* @__PURE__ */ s(
|
|
108
|
+
n,
|
|
109
|
+
{
|
|
110
|
+
id: "test",
|
|
111
|
+
cells: [l[0]],
|
|
112
|
+
options: { showControls: !0, cellsPerSlide: 1 }
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
);
|
|
116
|
+
const e = i.queryByLabelText("Previous Item");
|
|
117
|
+
o(e).not.toBeInTheDocument();
|
|
118
|
+
}), r("should render controls with custom arrow size", async () => {
|
|
119
|
+
a(
|
|
120
|
+
/* @__PURE__ */ s(
|
|
121
|
+
n,
|
|
122
|
+
{
|
|
123
|
+
id: "test",
|
|
124
|
+
cells: l,
|
|
125
|
+
options: { showControls: !0, controlArrowSize: 64 }
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
), await c(() => {
|
|
129
|
+
const e = i.getByTestId("chevron-left");
|
|
130
|
+
o(e).toBeInTheDocument();
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
}), u("Options - Pagination", () => {
|
|
134
|
+
r("should render pagination when showPagination is true", async () => {
|
|
135
|
+
const { container: e } = a(
|
|
136
|
+
/* @__PURE__ */ s(
|
|
137
|
+
n,
|
|
138
|
+
{
|
|
139
|
+
id: "test",
|
|
140
|
+
cells: l,
|
|
141
|
+
options: { showPagination: !0 }
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
);
|
|
145
|
+
await c(() => {
|
|
146
|
+
const t = e.querySelector(".carousel-nav");
|
|
147
|
+
o(t).toBeInTheDocument();
|
|
148
|
+
});
|
|
149
|
+
}), r("should not render pagination when showPagination is false", () => {
|
|
150
|
+
const { container: e } = a(
|
|
151
|
+
/* @__PURE__ */ s(
|
|
152
|
+
n,
|
|
153
|
+
{
|
|
154
|
+
id: "test",
|
|
155
|
+
cells: l,
|
|
156
|
+
options: { showPagination: !1 }
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
), t = e.querySelector(".carousel-nav");
|
|
160
|
+
o(t).not.toBeInTheDocument();
|
|
161
|
+
}), r("should not render pagination when there is only one slide", () => {
|
|
162
|
+
const { container: e } = a(
|
|
163
|
+
/* @__PURE__ */ s(
|
|
164
|
+
n,
|
|
165
|
+
{
|
|
166
|
+
id: "test",
|
|
167
|
+
cells: [l[0]],
|
|
168
|
+
options: { showPagination: !0, cellsPerSlide: 1 }
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
), t = e.querySelector(".carousel-nav");
|
|
172
|
+
o(t).not.toBeInTheDocument();
|
|
173
|
+
}), r("should render correct number of pagination items", async () => {
|
|
174
|
+
const { container: e } = a(
|
|
175
|
+
/* @__PURE__ */ s(
|
|
176
|
+
n,
|
|
177
|
+
{
|
|
178
|
+
id: "test",
|
|
179
|
+
cells: l,
|
|
180
|
+
options: { showPagination: !0, cellsPerSlide: 1 }
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
);
|
|
184
|
+
await c(() => {
|
|
185
|
+
const t = e.querySelectorAll(".carousel-nav__item");
|
|
186
|
+
o(t.length).toBe(4);
|
|
187
|
+
});
|
|
188
|
+
}), r("should set first pagination item as current", async () => {
|
|
189
|
+
const { container: e } = a(
|
|
190
|
+
/* @__PURE__ */ s(
|
|
191
|
+
n,
|
|
192
|
+
{
|
|
193
|
+
id: "test",
|
|
194
|
+
cells: l,
|
|
195
|
+
options: { showPagination: !0 }
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
);
|
|
199
|
+
await c(() => {
|
|
200
|
+
const t = e.querySelector('.carousel-nav__item[data-current="true"]');
|
|
201
|
+
o(t).toBeInTheDocument();
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
}), u("Options - Scrollbar", () => {
|
|
205
|
+
r("should set scrollbar data attribute when showScrollbar is true", () => {
|
|
206
|
+
a(
|
|
207
|
+
/* @__PURE__ */ s(
|
|
208
|
+
n,
|
|
209
|
+
{
|
|
210
|
+
id: "test",
|
|
211
|
+
cells: l,
|
|
212
|
+
options: { showScrollbar: !0 }
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
);
|
|
216
|
+
const e = i.getByRole("group");
|
|
217
|
+
o(e).toHaveAttribute("data-scrollbar", "true");
|
|
218
|
+
}), r("should set scrollbar data attribute to false by default", () => {
|
|
219
|
+
a(/* @__PURE__ */ s(n, { id: "test", cells: l }));
|
|
220
|
+
const e = i.getByRole("group");
|
|
221
|
+
o(e).toHaveAttribute("data-scrollbar", "false");
|
|
222
|
+
});
|
|
223
|
+
}), u("Options - cellsPerSlide", () => {
|
|
224
|
+
r("should chunk cells based on cellsPerSlide", async () => {
|
|
225
|
+
a(
|
|
226
|
+
/* @__PURE__ */ s(
|
|
227
|
+
n,
|
|
228
|
+
{
|
|
229
|
+
id: "test",
|
|
230
|
+
cells: l,
|
|
231
|
+
options: { cellsPerSlide: 2 }
|
|
232
|
+
}
|
|
233
|
+
)
|
|
234
|
+
), await c(() => {
|
|
235
|
+
const e = i.getAllByTestId(/carousel-slide-/);
|
|
236
|
+
o(e.length).toBe(2);
|
|
237
|
+
});
|
|
238
|
+
}), r("should handle cellsPerSlide of 1", async () => {
|
|
239
|
+
a(
|
|
240
|
+
/* @__PURE__ */ s(
|
|
241
|
+
n,
|
|
242
|
+
{
|
|
243
|
+
id: "test",
|
|
244
|
+
cells: l,
|
|
245
|
+
options: { cellsPerSlide: 1 }
|
|
246
|
+
}
|
|
247
|
+
)
|
|
248
|
+
), await c(() => {
|
|
249
|
+
const e = i.getAllByTestId(/carousel-slide-/);
|
|
250
|
+
o(e.length).toBeGreaterThanOrEqual(4);
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
}), u("Options - wrapAround", () => {
|
|
254
|
+
r("should add duplicate slides when wrapAround is true", async () => {
|
|
255
|
+
a(
|
|
256
|
+
/* @__PURE__ */ s(
|
|
257
|
+
n,
|
|
258
|
+
{
|
|
259
|
+
id: "test",
|
|
260
|
+
cells: l,
|
|
261
|
+
options: { wrapAround: !0, cellsPerSlide: 1 }
|
|
262
|
+
}
|
|
263
|
+
)
|
|
264
|
+
), await c(() => {
|
|
265
|
+
const e = i.getAllByTestId(/carousel-slide-/);
|
|
266
|
+
o(e.length).toBe(6);
|
|
267
|
+
});
|
|
268
|
+
}), r("should not add duplicate slides when wrapAround is false", async () => {
|
|
269
|
+
a(
|
|
270
|
+
/* @__PURE__ */ s(
|
|
271
|
+
n,
|
|
272
|
+
{
|
|
273
|
+
id: "test",
|
|
274
|
+
cells: l,
|
|
275
|
+
options: { wrapAround: !1, cellsPerSlide: 1 }
|
|
276
|
+
}
|
|
277
|
+
)
|
|
278
|
+
), await c(() => {
|
|
279
|
+
const e = i.getAllByTestId(/carousel-slide-/);
|
|
280
|
+
o(e.length).toBe(4);
|
|
281
|
+
});
|
|
282
|
+
}), r("should not wrap around when cells length equals cellsPerSlide", async () => {
|
|
283
|
+
a(
|
|
284
|
+
/* @__PURE__ */ s(
|
|
285
|
+
n,
|
|
286
|
+
{
|
|
287
|
+
id: "test",
|
|
288
|
+
cells: [l[0]],
|
|
289
|
+
options: { wrapAround: !0, cellsPerSlide: 1 }
|
|
290
|
+
}
|
|
291
|
+
)
|
|
292
|
+
), await c(() => {
|
|
293
|
+
const e = i.getAllByTestId(/carousel-slide-/);
|
|
294
|
+
o(e.length).toBe(1);
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
}), u("Options - CSS Variables", () => {
|
|
298
|
+
r("should apply custom slideAspectRatio", () => {
|
|
299
|
+
const { container: e } = a(
|
|
300
|
+
/* @__PURE__ */ s(
|
|
301
|
+
n,
|
|
302
|
+
{
|
|
303
|
+
id: "test",
|
|
304
|
+
cells: l,
|
|
305
|
+
options: { slideAspectRatio: "16/9" }
|
|
306
|
+
}
|
|
307
|
+
)
|
|
308
|
+
), t = e.querySelector('[role="region"]');
|
|
309
|
+
o(t == null ? void 0 : t.style.getPropertyValue("--_slide-aspect-ratio")).toBe("16/9");
|
|
310
|
+
}), r("should apply custom cellAspectRatio", () => {
|
|
311
|
+
const { container: e } = a(
|
|
312
|
+
/* @__PURE__ */ s(
|
|
313
|
+
n,
|
|
314
|
+
{
|
|
315
|
+
id: "test",
|
|
316
|
+
cells: l,
|
|
317
|
+
options: { cellAspectRatio: "1/1" }
|
|
318
|
+
}
|
|
319
|
+
)
|
|
320
|
+
), t = e.querySelector('[role="region"]');
|
|
321
|
+
o(t == null ? void 0 : t.style.getPropertyValue("--_cell-aspect-ratio")).toBe("1/1");
|
|
322
|
+
}), r("should apply custom gutterSize", () => {
|
|
323
|
+
const { container: e } = a(
|
|
324
|
+
/* @__PURE__ */ s(
|
|
325
|
+
n,
|
|
326
|
+
{
|
|
327
|
+
id: "test",
|
|
328
|
+
cells: l,
|
|
329
|
+
options: { gutterSize: 15, wrapAround: !0 }
|
|
330
|
+
}
|
|
331
|
+
)
|
|
332
|
+
), t = e.querySelector('[role="region"]');
|
|
333
|
+
o(t == null ? void 0 : t.style.getPropertyValue("--_carousel-gutters")).toBe("15%");
|
|
334
|
+
}), r("should apply custom slideGap", () => {
|
|
335
|
+
const { container: e } = a(
|
|
336
|
+
/* @__PURE__ */ s(
|
|
337
|
+
n,
|
|
338
|
+
{
|
|
339
|
+
id: "test",
|
|
340
|
+
cells: l,
|
|
341
|
+
options: { slideGap: 2 }
|
|
342
|
+
}
|
|
343
|
+
)
|
|
344
|
+
), t = e.querySelector('[role="region"]');
|
|
345
|
+
o(t == null ? void 0 : t.style.getPropertyValue("--_slide-gap")).toBe("2rem");
|
|
346
|
+
}), r("should apply custom controlButtonsOffset", () => {
|
|
347
|
+
const { container: e } = a(
|
|
348
|
+
/* @__PURE__ */ s(
|
|
349
|
+
n,
|
|
350
|
+
{
|
|
351
|
+
id: "test",
|
|
352
|
+
cells: l,
|
|
353
|
+
options: { controlButtonsOffset: 20 }
|
|
354
|
+
}
|
|
355
|
+
)
|
|
356
|
+
), t = e.querySelector('[role="region"]');
|
|
357
|
+
o(t == null ? void 0 : t.style.getPropertyValue("--_control-btns-offset-x")).toBe("20rem");
|
|
358
|
+
});
|
|
359
|
+
}), u("Keyboard Navigation", () => {
|
|
360
|
+
r("should handle ArrowRight key press", async () => {
|
|
361
|
+
const { container: e } = a(
|
|
362
|
+
/* @__PURE__ */ s(n, { id: "test", cells: l, options: { showControls: !0 } })
|
|
363
|
+
), t = e.querySelector('[role="region"]');
|
|
364
|
+
await c(() => {
|
|
365
|
+
o(t).toBeInTheDocument();
|
|
366
|
+
}), p.keyDown(t, { key: "ArrowRight" }), o(t).toBeInTheDocument();
|
|
367
|
+
}), r("should handle ArrowLeft key press", async () => {
|
|
368
|
+
const { container: e } = a(
|
|
369
|
+
/* @__PURE__ */ s(n, { id: "test", cells: l, options: { showControls: !0 } })
|
|
370
|
+
), t = e.querySelector('[role="region"]');
|
|
371
|
+
await c(() => {
|
|
372
|
+
o(t).toBeInTheDocument();
|
|
373
|
+
}), p.keyDown(t, { key: "ArrowLeft" }), o(t).toBeInTheDocument();
|
|
374
|
+
}), r("should not handle other keys", async () => {
|
|
375
|
+
const { container: e } = a(
|
|
376
|
+
/* @__PURE__ */ s(n, { id: "test", cells: l })
|
|
377
|
+
), t = e.querySelector('[role="region"]');
|
|
378
|
+
await c(() => {
|
|
379
|
+
o(t).toBeInTheDocument();
|
|
380
|
+
}), p.keyDown(t, { key: "Enter" }), o(t).toBeInTheDocument();
|
|
381
|
+
});
|
|
382
|
+
}), u("Mouse Events", () => {
|
|
383
|
+
r("should handle mouse enter on scroller", () => {
|
|
384
|
+
a(
|
|
385
|
+
/* @__PURE__ */ s(
|
|
386
|
+
n,
|
|
387
|
+
{
|
|
388
|
+
id: "test",
|
|
389
|
+
cells: l,
|
|
390
|
+
options: { autoplay: !0 }
|
|
391
|
+
}
|
|
392
|
+
)
|
|
393
|
+
);
|
|
394
|
+
const e = i.getByRole("group");
|
|
395
|
+
p.mouseEnter(e), o(e).toBeInTheDocument();
|
|
396
|
+
}), r("should handle mouse leave on scroller", () => {
|
|
397
|
+
a(
|
|
398
|
+
/* @__PURE__ */ s(
|
|
399
|
+
n,
|
|
400
|
+
{
|
|
401
|
+
id: "test",
|
|
402
|
+
cells: l,
|
|
403
|
+
options: { autoplay: !0 }
|
|
404
|
+
}
|
|
405
|
+
)
|
|
406
|
+
);
|
|
407
|
+
const e = i.getByRole("group");
|
|
408
|
+
p.mouseLeave(e), o(e).toBeInTheDocument();
|
|
409
|
+
}), r("should handle mouse enter on control buttons", async () => {
|
|
410
|
+
a(
|
|
411
|
+
/* @__PURE__ */ s(
|
|
412
|
+
n,
|
|
413
|
+
{
|
|
414
|
+
id: "test",
|
|
415
|
+
cells: l,
|
|
416
|
+
options: { showControls: !0, autoplay: !0 }
|
|
417
|
+
}
|
|
418
|
+
)
|
|
419
|
+
), await c(() => {
|
|
420
|
+
const e = i.getByLabelText("Next Item");
|
|
421
|
+
p.mouseEnter(e), o(e).toBeInTheDocument();
|
|
422
|
+
});
|
|
423
|
+
}), r("should handle mouse leave on control buttons", async () => {
|
|
424
|
+
a(
|
|
425
|
+
/* @__PURE__ */ s(
|
|
426
|
+
n,
|
|
427
|
+
{
|
|
428
|
+
id: "test",
|
|
429
|
+
cells: l,
|
|
430
|
+
options: { showControls: !0, autoplay: !0 }
|
|
431
|
+
}
|
|
432
|
+
)
|
|
433
|
+
), await c(() => {
|
|
434
|
+
const e = i.getByLabelText("Next Item");
|
|
435
|
+
p.mouseLeave(e), o(e).toBeInTheDocument();
|
|
436
|
+
});
|
|
437
|
+
});
|
|
438
|
+
}), u("Touch Events", () => {
|
|
439
|
+
r("should handle touch start on scroller", () => {
|
|
440
|
+
a(/* @__PURE__ */ s(n, { id: "test", cells: l }));
|
|
441
|
+
const e = i.getByRole("group");
|
|
442
|
+
p.touchStart(e), o(e).toBeInTheDocument();
|
|
443
|
+
});
|
|
444
|
+
}), u("Control Button Clicks", () => {
|
|
445
|
+
r("should handle next button click", async () => {
|
|
446
|
+
a(
|
|
447
|
+
/* @__PURE__ */ s(
|
|
448
|
+
n,
|
|
449
|
+
{
|
|
450
|
+
id: "test",
|
|
451
|
+
cells: l,
|
|
452
|
+
options: { showControls: !0 }
|
|
453
|
+
}
|
|
454
|
+
)
|
|
455
|
+
), await c(() => {
|
|
456
|
+
const e = i.getByLabelText("Next Item");
|
|
457
|
+
p.click(e), o(e).toBeInTheDocument();
|
|
458
|
+
});
|
|
459
|
+
}), r("should handle previous button click", async () => {
|
|
460
|
+
a(
|
|
461
|
+
/* @__PURE__ */ s(
|
|
462
|
+
n,
|
|
463
|
+
{
|
|
464
|
+
id: "test",
|
|
465
|
+
cells: l,
|
|
466
|
+
options: { showControls: !0 }
|
|
467
|
+
}
|
|
468
|
+
)
|
|
469
|
+
), await c(() => {
|
|
470
|
+
const e = i.getByLabelText("Previous Item");
|
|
471
|
+
p.click(e), o(e).toBeInTheDocument();
|
|
472
|
+
});
|
|
473
|
+
});
|
|
474
|
+
}), u("Pagination Clicks", () => {
|
|
475
|
+
r("should handle pagination item click", async () => {
|
|
476
|
+
const { container: e } = a(
|
|
477
|
+
/* @__PURE__ */ s(
|
|
478
|
+
n,
|
|
479
|
+
{
|
|
480
|
+
id: "test",
|
|
481
|
+
cells: l,
|
|
482
|
+
options: { showPagination: !0 }
|
|
483
|
+
}
|
|
484
|
+
)
|
|
485
|
+
);
|
|
486
|
+
await c(() => {
|
|
487
|
+
const t = e.querySelectorAll(".carousel-nav__item");
|
|
488
|
+
t.length > 1 && p.click(t[1]), o(t.length).toBeGreaterThan(0);
|
|
489
|
+
});
|
|
490
|
+
});
|
|
491
|
+
}), u("Empty and Edge Cases", () => {
|
|
492
|
+
r("should handle empty cells array", () => {
|
|
493
|
+
const { container: e } = a(/* @__PURE__ */ s(n, { id: "test", cells: [] })), t = e.querySelector('[role="region"]');
|
|
494
|
+
o(t).toBeInTheDocument();
|
|
495
|
+
}), r("should handle single cell", async () => {
|
|
496
|
+
a(/* @__PURE__ */ s(n, { id: "test", cells: [l[0]] })), await c(() => {
|
|
497
|
+
const e = i.getAllByTestId(/carousel-slide-/);
|
|
498
|
+
o(e.length).toBe(1);
|
|
499
|
+
});
|
|
500
|
+
}), r("should handle cells without layout property", async () => {
|
|
501
|
+
a(/* @__PURE__ */ s(n, { id: "test", cells: [
|
|
502
|
+
{ id: 1, props: { title: "Cell 1" } },
|
|
503
|
+
{ id: 2, props: { title: "Cell 2" } }
|
|
504
|
+
] })), await c(() => {
|
|
505
|
+
const t = i.getAllByTestId(/carousel-slide-/);
|
|
506
|
+
o(t.length).toBeGreaterThan(0);
|
|
507
|
+
});
|
|
508
|
+
}), r("should handle missing cell id", async () => {
|
|
509
|
+
a(/* @__PURE__ */ s(n, { id: "test", cells: [
|
|
510
|
+
{ props: { title: "Cell 1" }, layout: "default" },
|
|
511
|
+
{ props: { title: "Cell 2" }, layout: "default" }
|
|
512
|
+
] })), await c(() => {
|
|
513
|
+
const t = i.getByRole("region");
|
|
514
|
+
o(t).toBeInTheDocument();
|
|
515
|
+
});
|
|
516
|
+
});
|
|
517
|
+
}), u("Default Options", () => {
|
|
518
|
+
r("should use default options when not provided", () => {
|
|
519
|
+
const { container: e } = a(/* @__PURE__ */ s(n, { id: "test", cells: l })), t = e.querySelector('[role="region"]');
|
|
520
|
+
o(t).toBeInTheDocument();
|
|
521
|
+
}), r("should merge custom options with defaults", async () => {
|
|
522
|
+
a(
|
|
523
|
+
/* @__PURE__ */ s(
|
|
524
|
+
n,
|
|
525
|
+
{
|
|
526
|
+
id: "test",
|
|
527
|
+
cells: l,
|
|
528
|
+
options: { showControls: !0, slideGap: 3 }
|
|
529
|
+
}
|
|
530
|
+
)
|
|
531
|
+
), await c(() => {
|
|
532
|
+
const e = i.queryByLabelText("Next Item");
|
|
533
|
+
o(e).toBeInTheDocument();
|
|
534
|
+
});
|
|
535
|
+
});
|
|
536
|
+
}), u("Accessibility", () => {
|
|
537
|
+
r("should have proper ARIA attributes", () => {
|
|
538
|
+
const { container: e } = a(
|
|
539
|
+
/* @__PURE__ */ s(n, { id: "test", cells: l, options: { title: "My Carousel" } })
|
|
540
|
+
), t = e.querySelector('[role="region"]');
|
|
541
|
+
o(t).toHaveAttribute("aria-roledescription", "carousel"), o(t).toHaveAttribute("aria-label", "My Carousel");
|
|
542
|
+
}), r("should have tabIndex on carousel container", () => {
|
|
543
|
+
const { container: e } = a(/* @__PURE__ */ s(n, { id: "test", cells: l })), t = e.querySelector('[role="region"]');
|
|
544
|
+
o(t).toHaveAttribute("tabIndex", "-1");
|
|
545
|
+
}), r("should have tabIndex on scroller", () => {
|
|
546
|
+
a(/* @__PURE__ */ s(n, { id: "test", cells: l }));
|
|
547
|
+
const e = i.getByRole("group");
|
|
548
|
+
o(e).toHaveAttribute("tabIndex", "0");
|
|
549
|
+
}), r("should have aria-live on scroller", () => {
|
|
550
|
+
a(/* @__PURE__ */ s(n, { id: "test", cells: l }));
|
|
551
|
+
const e = i.getByRole("group");
|
|
552
|
+
o(e).toHaveAttribute("aria-live", "polite");
|
|
553
|
+
}), r("should have proper button labels", async () => {
|
|
554
|
+
a(
|
|
555
|
+
/* @__PURE__ */ s(
|
|
556
|
+
n,
|
|
557
|
+
{
|
|
558
|
+
id: "test",
|
|
559
|
+
cells: l,
|
|
560
|
+
options: { showControls: !0 }
|
|
561
|
+
}
|
|
562
|
+
)
|
|
563
|
+
), await c(() => {
|
|
564
|
+
const e = i.getByLabelText("Previous Item"), t = i.getByLabelText("Next Item");
|
|
565
|
+
o(e).toHaveAttribute("aria-label", "Previous Item"), o(t).toHaveAttribute("aria-label", "Next Item");
|
|
566
|
+
});
|
|
567
|
+
}), r("should have aria-controls on navigation buttons", async () => {
|
|
568
|
+
a(
|
|
569
|
+
/* @__PURE__ */ s(
|
|
570
|
+
n,
|
|
571
|
+
{
|
|
572
|
+
id: "test",
|
|
573
|
+
cells: l,
|
|
574
|
+
options: { showControls: !0 }
|
|
575
|
+
}
|
|
576
|
+
)
|
|
577
|
+
), await c(() => {
|
|
578
|
+
const e = i.getByLabelText("Previous Item");
|
|
579
|
+
o(e).toHaveAttribute("aria-controls", "carousel-test");
|
|
580
|
+
});
|
|
581
|
+
}), r("should have aria-hidden on icon elements", async () => {
|
|
582
|
+
const { container: e } = a(
|
|
583
|
+
/* @__PURE__ */ s(
|
|
584
|
+
n,
|
|
585
|
+
{
|
|
586
|
+
id: "test",
|
|
587
|
+
cells: l,
|
|
588
|
+
options: { showControls: !0 }
|
|
589
|
+
}
|
|
590
|
+
)
|
|
591
|
+
);
|
|
592
|
+
await c(() => {
|
|
593
|
+
const t = e.querySelectorAll('i[aria-hidden="true"]');
|
|
594
|
+
o(t.length).toBeGreaterThan(0), t.forEach((d) => {
|
|
595
|
+
o(d).toHaveAttribute("aria-hidden", "true");
|
|
596
|
+
});
|
|
597
|
+
});
|
|
598
|
+
});
|
|
599
|
+
}), u("Responsive Behavior", () => {
|
|
600
|
+
r("should render without errors on mount", () => {
|
|
601
|
+
const { container: e } = a(/* @__PURE__ */ s(n, { id: "test", cells: l }));
|
|
602
|
+
o(e).toBeTruthy();
|
|
603
|
+
}), r("should handle window resize events", () => {
|
|
604
|
+
const { container: e } = a(/* @__PURE__ */ s(n, { id: "test", cells: l }));
|
|
605
|
+
window.dispatchEvent(new Event("resize"));
|
|
606
|
+
const t = e.querySelector('[role="region"]');
|
|
607
|
+
o(t).toBeInTheDocument();
|
|
608
|
+
});
|
|
609
|
+
}), u("Cleanup", () => {
|
|
610
|
+
r("should cleanup on unmount", () => {
|
|
611
|
+
const { unmount: e } = a(/* @__PURE__ */ s(n, { id: "test", cells: l }));
|
|
612
|
+
o(() => e()).not.toThrow();
|
|
613
|
+
}), r("should cleanup with autoplay enabled", () => {
|
|
614
|
+
const { unmount: e } = a(
|
|
615
|
+
/* @__PURE__ */ s(
|
|
616
|
+
n,
|
|
617
|
+
{
|
|
618
|
+
id: "test",
|
|
619
|
+
cells: l,
|
|
620
|
+
options: { autoplay: !0 }
|
|
621
|
+
}
|
|
622
|
+
)
|
|
623
|
+
);
|
|
624
|
+
o(() => e()).not.toThrow();
|
|
625
|
+
});
|
|
626
|
+
}), u("variableHeight Option", () => {
|
|
627
|
+
r("should pass variableHeight to CarouselSlide", async () => {
|
|
628
|
+
a(
|
|
629
|
+
/* @__PURE__ */ s(
|
|
630
|
+
n,
|
|
631
|
+
{
|
|
632
|
+
id: "test",
|
|
633
|
+
cells: l,
|
|
634
|
+
options: { variableHeight: !0 }
|
|
635
|
+
}
|
|
636
|
+
)
|
|
637
|
+
), await c(() => {
|
|
638
|
+
const e = i.getAllByTestId(/carousel-slide-/);
|
|
639
|
+
o(e.length).toBeGreaterThan(0);
|
|
640
|
+
});
|
|
641
|
+
}), r("should default variableHeight to false", async () => {
|
|
642
|
+
a(/* @__PURE__ */ s(n, { id: "test", cells: l })), await c(() => {
|
|
643
|
+
const e = i.getAllByTestId(/carousel-slide-/);
|
|
644
|
+
o(e.length).toBeGreaterThan(0);
|
|
645
|
+
});
|
|
646
|
+
});
|
|
647
|
+
}), u("Multiple Carousels", () => {
|
|
648
|
+
r("should handle multiple carousels on the same page", async () => {
|
|
649
|
+
const { container: e } = a(
|
|
650
|
+
/* @__PURE__ */ g(m, { children: [
|
|
651
|
+
/* @__PURE__ */ s(n, { id: "carousel-1", cells: l }),
|
|
652
|
+
/* @__PURE__ */ s(n, { id: "carousel-2", cells: l })
|
|
653
|
+
] })
|
|
654
|
+
);
|
|
655
|
+
await c(() => {
|
|
656
|
+
const t = e.querySelector("#carousel-carousel-1"), d = e.querySelector("#carousel-carousel-2");
|
|
657
|
+
o(t).toBeInTheDocument(), o(d).toBeInTheDocument();
|
|
658
|
+
});
|
|
659
|
+
});
|
|
660
|
+
}), u("Complex Options Combinations", () => {
|
|
661
|
+
r("should handle multiple options together", async () => {
|
|
662
|
+
const { container: e } = a(
|
|
663
|
+
/* @__PURE__ */ s(
|
|
664
|
+
n,
|
|
665
|
+
{
|
|
666
|
+
id: "test",
|
|
667
|
+
cells: l,
|
|
668
|
+
options: {
|
|
669
|
+
showControls: !0,
|
|
670
|
+
showPagination: !0,
|
|
671
|
+
showScrollbar: !0,
|
|
672
|
+
wrapAround: !0,
|
|
673
|
+
cellsPerSlide: 2,
|
|
674
|
+
slideAspectRatio: "16/9",
|
|
675
|
+
slideGap: 2,
|
|
676
|
+
gutterSize: 15
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
)
|
|
680
|
+
);
|
|
681
|
+
await c(() => {
|
|
682
|
+
const t = e.querySelector('[role="region"]'), d = i.queryByLabelText("Previous Item"), y = e.querySelector(".carousel-nav");
|
|
683
|
+
o(t).toBeInTheDocument(), o(d).toBeInTheDocument(), o(y).toBeInTheDocument();
|
|
684
|
+
});
|
|
685
|
+
}), r("should handle autoplay with controls", async () => {
|
|
686
|
+
a(
|
|
687
|
+
/* @__PURE__ */ s(
|
|
688
|
+
n,
|
|
689
|
+
{
|
|
690
|
+
id: "test",
|
|
691
|
+
cells: l,
|
|
692
|
+
options: {
|
|
693
|
+
autoplay: !0,
|
|
694
|
+
autoplayDelay: 2e3,
|
|
695
|
+
showControls: !0
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
)
|
|
699
|
+
), await c(() => {
|
|
700
|
+
const e = i.queryByLabelText("Next Item");
|
|
701
|
+
o(e).toBeInTheDocument();
|
|
702
|
+
});
|
|
703
|
+
});
|
|
704
|
+
});
|
|
705
|
+
});
|