@scrippsproduct/networks-ui-library 1.1.8 → 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/assets/ScheduleLayout.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,378 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { v as y, d, b as p, i as r, r as a, g as i, w as u, s as c } from "../../react.esm-DLSrfVwM.mjs";
|
|
3
|
+
import "../../index-BVxBrkZB.mjs";
|
|
4
|
+
import { CarouselSlide as n } from "./CarouselSlide.js";
|
|
5
|
+
y.mock("@scrippsproduct/console-logger", () => ({
|
|
6
|
+
default: {
|
|
7
|
+
setComponent: y.fn(),
|
|
8
|
+
log: y.fn()
|
|
9
|
+
}
|
|
10
|
+
}));
|
|
11
|
+
y.mock("../../utils/helpers", () => ({
|
|
12
|
+
classes: (h) => h.filter(Boolean).join(" ")
|
|
13
|
+
}));
|
|
14
|
+
y.mock("../../settings", () => {
|
|
15
|
+
const { lazy: h } = require("react"), s = ({ title: o }) => /* @__PURE__ */ l("div", { "data-testid": "figure-layout", children: o }), t = ({ content: o }) => /* @__PURE__ */ l("div", { "data-testid": "text-layout", children: o }), e = ({ videoId: o }) => /* @__PURE__ */ l("div", { "data-testid": "video-layout", children: o });
|
|
16
|
+
return {
|
|
17
|
+
slideLayoutsMap: /* @__PURE__ */ new Map([
|
|
18
|
+
["Figure", h(() => Promise.resolve({ default: s }))],
|
|
19
|
+
["Text", h(() => Promise.resolve({ default: t }))],
|
|
20
|
+
["Video", h(() => Promise.resolve({ default: e }))]
|
|
21
|
+
])
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
d("CarouselSlide", () => {
|
|
25
|
+
const h = {
|
|
26
|
+
id: 1,
|
|
27
|
+
props: { title: "Test Cell" },
|
|
28
|
+
layout: "Figure"
|
|
29
|
+
}, s = {
|
|
30
|
+
ariaLabel: "1 of 3",
|
|
31
|
+
cells: [h],
|
|
32
|
+
layout: "Figure"
|
|
33
|
+
};
|
|
34
|
+
p(() => {
|
|
35
|
+
y.clearAllMocks();
|
|
36
|
+
}), d("Basic Rendering", () => {
|
|
37
|
+
r("should render slide with basic props", async () => {
|
|
38
|
+
const { container: t } = a(
|
|
39
|
+
/* @__PURE__ */ l(n, { slide: s, index: 0, currentIndex: 0 })
|
|
40
|
+
), e = t.querySelector("li");
|
|
41
|
+
i(e).toBeInTheDocument(), await u(() => {
|
|
42
|
+
i(e).toBeInTheDocument();
|
|
43
|
+
});
|
|
44
|
+
}), r("should render with correct aria-label", () => {
|
|
45
|
+
const { container: t } = a(
|
|
46
|
+
/* @__PURE__ */ l(n, { slide: s, index: 0, currentIndex: 0 })
|
|
47
|
+
), e = t.querySelector("li");
|
|
48
|
+
i(e).toHaveAttribute("aria-label", "1 of 3");
|
|
49
|
+
}), r("should render with aria-roledescription", () => {
|
|
50
|
+
const { container: t } = a(
|
|
51
|
+
/* @__PURE__ */ l(n, { slide: s, index: 0, currentIndex: 0 })
|
|
52
|
+
), e = t.querySelector("li");
|
|
53
|
+
i(e).toHaveAttribute("aria-roledescription", "carousel-item");
|
|
54
|
+
}), r("should render with data-index attribute", () => {
|
|
55
|
+
const { container: t } = a(
|
|
56
|
+
/* @__PURE__ */ l(n, { slide: s, index: 2, currentIndex: 0 })
|
|
57
|
+
), e = t.querySelector("li");
|
|
58
|
+
i(e).toHaveAttribute("data-index", "2");
|
|
59
|
+
}), r("should render with correct index for different positions", () => {
|
|
60
|
+
const { container: t } = a(
|
|
61
|
+
/* @__PURE__ */ l(n, { slide: s, index: 5, currentIndex: 0 })
|
|
62
|
+
), e = t.querySelector("li");
|
|
63
|
+
i(e).toHaveAttribute("data-index", "5");
|
|
64
|
+
});
|
|
65
|
+
}), d("Inert Attribute", () => {
|
|
66
|
+
r("should not have inert attribute when slide is current", () => {
|
|
67
|
+
const { container: t } = a(
|
|
68
|
+
/* @__PURE__ */ l(n, { slide: s, index: 0, currentIndex: 0 })
|
|
69
|
+
), e = t.querySelector("li");
|
|
70
|
+
i(e).not.toHaveAttribute("inert");
|
|
71
|
+
}), r("should have inert attribute when slide is not current", () => {
|
|
72
|
+
const { container: t } = a(
|
|
73
|
+
/* @__PURE__ */ l(n, { slide: s, index: 1, currentIndex: 0 })
|
|
74
|
+
), e = t.querySelector("li");
|
|
75
|
+
i(e).toHaveAttribute("inert");
|
|
76
|
+
}), r("should have inert attribute when currentIndex is greater than index", () => {
|
|
77
|
+
const { container: t } = a(
|
|
78
|
+
/* @__PURE__ */ l(n, { slide: s, index: 0, currentIndex: 2 })
|
|
79
|
+
), e = t.querySelector("li");
|
|
80
|
+
i(e).toHaveAttribute("inert");
|
|
81
|
+
}), r("should not have inert when indices match at higher values", () => {
|
|
82
|
+
const { container: t } = a(
|
|
83
|
+
/* @__PURE__ */ l(n, { slide: s, index: 5, currentIndex: 5 })
|
|
84
|
+
), e = t.querySelector("li");
|
|
85
|
+
i(e).not.toHaveAttribute("inert");
|
|
86
|
+
});
|
|
87
|
+
}), d("Variable Height", () => {
|
|
88
|
+
r("should apply variable height class when variableHeight is true", () => {
|
|
89
|
+
const { container: t } = a(
|
|
90
|
+
/* @__PURE__ */ l(
|
|
91
|
+
n,
|
|
92
|
+
{
|
|
93
|
+
slide: s,
|
|
94
|
+
index: 0,
|
|
95
|
+
currentIndex: 0,
|
|
96
|
+
variableHeight: !0
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
), e = t.querySelector("li");
|
|
100
|
+
i(e).toHaveClass("slide--variable-height");
|
|
101
|
+
}), r("should not apply variable height class when variableHeight is false", () => {
|
|
102
|
+
const { container: t } = a(
|
|
103
|
+
/* @__PURE__ */ l(
|
|
104
|
+
n,
|
|
105
|
+
{
|
|
106
|
+
slide: s,
|
|
107
|
+
index: 0,
|
|
108
|
+
currentIndex: 0,
|
|
109
|
+
variableHeight: !1
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
), e = t.querySelector("li");
|
|
113
|
+
i(e).not.toHaveClass("slide--variable-height");
|
|
114
|
+
}), r("should not apply variable height class by default", () => {
|
|
115
|
+
const { container: t } = a(
|
|
116
|
+
/* @__PURE__ */ l(n, { slide: s, index: 0, currentIndex: 0 })
|
|
117
|
+
), e = t.querySelector("li");
|
|
118
|
+
i(e).not.toHaveClass("slide--variable-height");
|
|
119
|
+
});
|
|
120
|
+
}), d("CSS Classes", () => {
|
|
121
|
+
r("should always have slide class", () => {
|
|
122
|
+
const { container: t } = a(
|
|
123
|
+
/* @__PURE__ */ l(n, { slide: s, index: 0, currentIndex: 0 })
|
|
124
|
+
), e = t.querySelector("li");
|
|
125
|
+
i(e).toHaveClass("slide");
|
|
126
|
+
}), r("should have multiple classes when variableHeight is true", () => {
|
|
127
|
+
const { container: t } = a(
|
|
128
|
+
/* @__PURE__ */ l(
|
|
129
|
+
n,
|
|
130
|
+
{
|
|
131
|
+
slide: s,
|
|
132
|
+
index: 0,
|
|
133
|
+
currentIndex: 0,
|
|
134
|
+
variableHeight: !0
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
), e = t.querySelector("li");
|
|
138
|
+
i(e == null ? void 0 : e.className).toContain("slide"), i(e == null ? void 0 : e.className).toContain("slide--variable-height");
|
|
139
|
+
});
|
|
140
|
+
}), d("Layout Loading", () => {
|
|
141
|
+
r("should render layout component when layout is found", async () => {
|
|
142
|
+
a(/* @__PURE__ */ l(n, { slide: {
|
|
143
|
+
ariaLabel: "1 of 3",
|
|
144
|
+
cells: [{ id: 1, props: { title: "Figure Title" }, layout: "Figure" }],
|
|
145
|
+
layout: "Figure"
|
|
146
|
+
}, index: 0, currentIndex: 0 })), await u(() => {
|
|
147
|
+
const e = c.getByTestId("figure-layout");
|
|
148
|
+
i(e).toBeInTheDocument(), i(e).toHaveTextContent("Figure Title");
|
|
149
|
+
});
|
|
150
|
+
}), r("should render text layout when layout is Text", async () => {
|
|
151
|
+
a(/* @__PURE__ */ l(n, { slide: {
|
|
152
|
+
ariaLabel: "1 of 3",
|
|
153
|
+
cells: [{ id: 1, props: { content: "Text Content" }, layout: "Text" }],
|
|
154
|
+
layout: "Text"
|
|
155
|
+
}, index: 0, currentIndex: 0 })), await u(() => {
|
|
156
|
+
const e = c.getByTestId("text-layout");
|
|
157
|
+
i(e).toBeInTheDocument(), i(e).toHaveTextContent("Text Content");
|
|
158
|
+
});
|
|
159
|
+
}), r("should render video layout when layout is Video", async () => {
|
|
160
|
+
a(/* @__PURE__ */ l(n, { slide: {
|
|
161
|
+
ariaLabel: "1 of 3",
|
|
162
|
+
cells: [{ id: 1, props: { videoId: "video-123" }, layout: "Video" }],
|
|
163
|
+
layout: "Video"
|
|
164
|
+
}, index: 0, currentIndex: 0 })), await u(() => {
|
|
165
|
+
const e = c.getByTestId("video-layout");
|
|
166
|
+
i(e).toBeInTheDocument(), i(e).toHaveTextContent("video-123");
|
|
167
|
+
});
|
|
168
|
+
}), r("should not render anything when layout is not found", () => {
|
|
169
|
+
const t = {
|
|
170
|
+
ariaLabel: "1 of 3",
|
|
171
|
+
cells: [{ id: 1, props: { title: "Test" }, layout: "Unknown" }],
|
|
172
|
+
layout: "Unknown"
|
|
173
|
+
}, { container: e } = a(
|
|
174
|
+
/* @__PURE__ */ l(n, { slide: t, index: 0, currentIndex: 0 })
|
|
175
|
+
), o = e.querySelector("li");
|
|
176
|
+
i(o).toBeInTheDocument(), i(o == null ? void 0 : o.children.length).toBe(0);
|
|
177
|
+
});
|
|
178
|
+
}), d("Multiple Cells", () => {
|
|
179
|
+
r("should render multiple cells", async () => {
|
|
180
|
+
a(
|
|
181
|
+
/* @__PURE__ */ l(n, { slide: {
|
|
182
|
+
ariaLabel: "1 of 3",
|
|
183
|
+
cells: [
|
|
184
|
+
{ id: 1, props: { title: "Cell 1" }, layout: "Figure" },
|
|
185
|
+
{ id: 2, props: { title: "Cell 2" }, layout: "Figure" },
|
|
186
|
+
{ id: 3, props: { title: "Cell 3" }, layout: "Figure" }
|
|
187
|
+
],
|
|
188
|
+
layout: "Figure"
|
|
189
|
+
}, index: 0, currentIndex: 0 })
|
|
190
|
+
), await u(() => {
|
|
191
|
+
const e = c.getAllByTestId("figure-layout");
|
|
192
|
+
i(e).toHaveLength(3), i(e[0]).toHaveTextContent("Cell 1"), i(e[1]).toHaveTextContent("Cell 2"), i(e[2]).toHaveTextContent("Cell 3");
|
|
193
|
+
});
|
|
194
|
+
}), r("should render cells with unique keys", async () => {
|
|
195
|
+
a(
|
|
196
|
+
/* @__PURE__ */ l(n, { slide: {
|
|
197
|
+
ariaLabel: "1 of 3",
|
|
198
|
+
cells: [
|
|
199
|
+
{ id: 1, props: { title: "Cell A" }, layout: "Figure" },
|
|
200
|
+
{ id: 2, props: { title: "Cell B" }, layout: "Figure" }
|
|
201
|
+
],
|
|
202
|
+
layout: "Figure"
|
|
203
|
+
}, index: 2, currentIndex: 0 })
|
|
204
|
+
), await u(() => {
|
|
205
|
+
const e = c.getAllByTestId("figure-layout");
|
|
206
|
+
i(e).toHaveLength(2);
|
|
207
|
+
});
|
|
208
|
+
}), r("should use slide layout for all cells in the slide", async () => {
|
|
209
|
+
a(
|
|
210
|
+
/* @__PURE__ */ l(n, { slide: {
|
|
211
|
+
ariaLabel: "1 of 3",
|
|
212
|
+
cells: [
|
|
213
|
+
{ id: 1, props: { title: "Figure Cell 1" }, layout: "Figure" },
|
|
214
|
+
{ id: 2, props: { title: "Figure Cell 2" }, layout: "Figure" }
|
|
215
|
+
],
|
|
216
|
+
layout: "Figure"
|
|
217
|
+
}, index: 0, currentIndex: 0 })
|
|
218
|
+
), await u(() => {
|
|
219
|
+
const e = c.getAllByTestId("figure-layout");
|
|
220
|
+
i(e).toHaveLength(2), i(e[0]).toHaveTextContent("Figure Cell 1"), i(e[1]).toHaveTextContent("Figure Cell 2");
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
}), d("Edge Cases", () => {
|
|
224
|
+
r("should handle empty cells array", () => {
|
|
225
|
+
const t = {
|
|
226
|
+
ariaLabel: "1 of 1",
|
|
227
|
+
cells: [],
|
|
228
|
+
layout: "Figure"
|
|
229
|
+
}, { container: e } = a(
|
|
230
|
+
/* @__PURE__ */ l(n, { slide: t, index: 0, currentIndex: 0 })
|
|
231
|
+
), o = e.querySelector("li");
|
|
232
|
+
i(o).toBeInTheDocument(), i(o == null ? void 0 : o.children.length).toBe(0);
|
|
233
|
+
}), r("should handle missing layout in cell", async () => {
|
|
234
|
+
const t = {
|
|
235
|
+
ariaLabel: "1 of 1",
|
|
236
|
+
cells: [{ id: 1, props: { title: "Test" } }],
|
|
237
|
+
layout: ""
|
|
238
|
+
}, { container: e } = a(
|
|
239
|
+
/* @__PURE__ */ l(n, { slide: t, index: 0, currentIndex: 0 })
|
|
240
|
+
), o = e.querySelector("li");
|
|
241
|
+
i(o).toBeInTheDocument();
|
|
242
|
+
}), r("should handle empty aria-label", () => {
|
|
243
|
+
const t = {
|
|
244
|
+
ariaLabel: "",
|
|
245
|
+
cells: [h],
|
|
246
|
+
layout: "Figure"
|
|
247
|
+
}, { container: e } = a(
|
|
248
|
+
/* @__PURE__ */ l(n, { slide: t, index: 0, currentIndex: 0 })
|
|
249
|
+
), o = e.querySelector("li");
|
|
250
|
+
i(o).toHaveAttribute("aria-label", "");
|
|
251
|
+
}), r("should handle negative indices gracefully", () => {
|
|
252
|
+
const { container: t } = a(
|
|
253
|
+
/* @__PURE__ */ l(n, { slide: s, index: -1, currentIndex: 0 })
|
|
254
|
+
), e = t.querySelector("li");
|
|
255
|
+
i(e).toHaveAttribute("data-index", "-1"), i(e).toHaveAttribute("inert");
|
|
256
|
+
}), r("should handle large index values", () => {
|
|
257
|
+
const { container: t } = a(
|
|
258
|
+
/* @__PURE__ */ l(n, { slide: s, index: 999, currentIndex: 999 })
|
|
259
|
+
), e = t.querySelector("li");
|
|
260
|
+
i(e).toHaveAttribute("data-index", "999"), i(e).not.toHaveAttribute("inert");
|
|
261
|
+
});
|
|
262
|
+
}), d("Props Passing to Layout", () => {
|
|
263
|
+
r("should pass all cell props to layout component", async () => {
|
|
264
|
+
a(
|
|
265
|
+
/* @__PURE__ */ l(n, { slide: {
|
|
266
|
+
ariaLabel: "1 of 1",
|
|
267
|
+
cells: [
|
|
268
|
+
{
|
|
269
|
+
id: 1,
|
|
270
|
+
props: {
|
|
271
|
+
title: "Complex Title",
|
|
272
|
+
subtitle: "Subtitle",
|
|
273
|
+
description: "Description",
|
|
274
|
+
imageUrl: "http://example.com/image.jpg"
|
|
275
|
+
},
|
|
276
|
+
layout: "Figure"
|
|
277
|
+
}
|
|
278
|
+
],
|
|
279
|
+
layout: "Figure"
|
|
280
|
+
}, index: 0, currentIndex: 0 })
|
|
281
|
+
), await u(() => {
|
|
282
|
+
const e = c.getByTestId("figure-layout");
|
|
283
|
+
i(e).toBeInTheDocument();
|
|
284
|
+
});
|
|
285
|
+
}), r("should handle cells without id", async () => {
|
|
286
|
+
a(/* @__PURE__ */ l(n, { slide: {
|
|
287
|
+
ariaLabel: "1 of 1",
|
|
288
|
+
cells: [{ props: { title: "No ID Cell" }, layout: "Figure" }],
|
|
289
|
+
layout: "Figure"
|
|
290
|
+
}, index: 0, currentIndex: 0 })), await u(() => {
|
|
291
|
+
const e = c.getByTestId("figure-layout");
|
|
292
|
+
i(e).toBeInTheDocument();
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
}), d("Re-rendering and Updates", () => {
|
|
296
|
+
r("should update when slide prop changes", async () => {
|
|
297
|
+
const t = {
|
|
298
|
+
ariaLabel: "1 of 3",
|
|
299
|
+
cells: [{ id: 1, props: { title: "Initial" }, layout: "Figure" }],
|
|
300
|
+
layout: "Figure"
|
|
301
|
+
}, e = {
|
|
302
|
+
ariaLabel: "2 of 3",
|
|
303
|
+
cells: [{ id: 2, props: { title: "Updated" }, layout: "Figure" }],
|
|
304
|
+
layout: "Figure"
|
|
305
|
+
}, { rerender: o } = a(
|
|
306
|
+
/* @__PURE__ */ l(n, { slide: t, index: 0, currentIndex: 0 })
|
|
307
|
+
);
|
|
308
|
+
await u(() => {
|
|
309
|
+
i(c.getByText("Initial")).toBeInTheDocument();
|
|
310
|
+
}), o(/* @__PURE__ */ l(n, { slide: e, index: 0, currentIndex: 0 })), await u(() => {
|
|
311
|
+
i(c.getByText("Updated")).toBeInTheDocument();
|
|
312
|
+
});
|
|
313
|
+
}), r("should update inert attribute when currentIndex changes", () => {
|
|
314
|
+
const { container: t, rerender: e } = a(
|
|
315
|
+
/* @__PURE__ */ l(n, { slide: s, index: 1, currentIndex: 0 })
|
|
316
|
+
);
|
|
317
|
+
let o = t.querySelector("li");
|
|
318
|
+
i(o).toHaveAttribute("inert"), e(/* @__PURE__ */ l(n, { slide: s, index: 1, currentIndex: 1 })), o = t.querySelector("li"), i(o).not.toHaveAttribute("inert");
|
|
319
|
+
}), r("should update data-index when index changes", () => {
|
|
320
|
+
const { container: t, rerender: e } = a(
|
|
321
|
+
/* @__PURE__ */ l(n, { slide: s, index: 0, currentIndex: 0 })
|
|
322
|
+
);
|
|
323
|
+
let o = t.querySelector("li");
|
|
324
|
+
i(o).toHaveAttribute("data-index", "0"), e(/* @__PURE__ */ l(n, { slide: s, index: 3, currentIndex: 0 })), o = t.querySelector("li"), i(o).toHaveAttribute("data-index", "3");
|
|
325
|
+
});
|
|
326
|
+
}), d("Accessibility", () => {
|
|
327
|
+
r("should have proper role description for screen readers", () => {
|
|
328
|
+
const { container: t } = a(
|
|
329
|
+
/* @__PURE__ */ l(n, { slide: s, index: 0, currentIndex: 0 })
|
|
330
|
+
), e = t.querySelector('li[aria-roledescription="carousel-item"]');
|
|
331
|
+
i(e).toBeInTheDocument();
|
|
332
|
+
}), r("should provide context with aria-label", () => {
|
|
333
|
+
const t = {
|
|
334
|
+
ariaLabel: "Slide 3 of 10",
|
|
335
|
+
cells: [h],
|
|
336
|
+
layout: "Figure"
|
|
337
|
+
}, { container: e } = a(
|
|
338
|
+
/* @__PURE__ */ l(n, { slide: t, index: 2, currentIndex: 0 })
|
|
339
|
+
), o = e.querySelector("li");
|
|
340
|
+
i(o).toHaveAttribute("aria-label", "Slide 3 of 10");
|
|
341
|
+
}), r("should be inert when not focused to prevent tab navigation", () => {
|
|
342
|
+
const { container: t } = a(
|
|
343
|
+
/* @__PURE__ */ l(n, { slide: s, index: 2, currentIndex: 0 })
|
|
344
|
+
), e = t.querySelector("li");
|
|
345
|
+
i(e).toHaveAttribute("inert");
|
|
346
|
+
}), r("should not be inert when focused to allow tab navigation", () => {
|
|
347
|
+
const { container: t } = a(
|
|
348
|
+
/* @__PURE__ */ l(n, { slide: s, index: 0, currentIndex: 0 })
|
|
349
|
+
), e = t.querySelector("li");
|
|
350
|
+
i(e).not.toHaveAttribute("inert");
|
|
351
|
+
});
|
|
352
|
+
}), d("Integration", () => {
|
|
353
|
+
r("should work with all props combined", async () => {
|
|
354
|
+
const t = {
|
|
355
|
+
ariaLabel: "5 of 10",
|
|
356
|
+
cells: [
|
|
357
|
+
{ id: 1, props: { title: "Cell 1" }, layout: "Text" },
|
|
358
|
+
{ id: 2, props: { content: "Cell 2" }, layout: "Text" }
|
|
359
|
+
],
|
|
360
|
+
layout: "Text"
|
|
361
|
+
}, { container: e } = a(
|
|
362
|
+
/* @__PURE__ */ l(
|
|
363
|
+
n,
|
|
364
|
+
{
|
|
365
|
+
slide: t,
|
|
366
|
+
index: 4,
|
|
367
|
+
currentIndex: 4,
|
|
368
|
+
variableHeight: !0
|
|
369
|
+
}
|
|
370
|
+
)
|
|
371
|
+
), o = e.querySelector("li");
|
|
372
|
+
i(o).toHaveAttribute("aria-label", "5 of 10"), i(o).toHaveAttribute("data-index", "4"), i(o).not.toHaveAttribute("inert"), i(o).toHaveClass("slide--variable-height"), await u(() => {
|
|
373
|
+
const x = c.getAllByTestId("text-layout");
|
|
374
|
+
i(x).toHaveLength(2);
|
|
375
|
+
});
|
|
376
|
+
});
|
|
377
|
+
});
|
|
378
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as r, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { p as o } from "../../../../index-
|
|
2
|
+
import { p as o } from "../../../../index-06PEPfBQ.mjs";
|
|
3
3
|
import { classes as e } from "../../../../utils/helpers.js";
|
|
4
4
|
import '../../../../assets/TwoColumnSlide.css';const t = {
|
|
5
5
|
"two-column-slide": "_two-column-slide_ltehs_1"
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { jsx as a, jsxs as g } from "react/jsx-runtime";
|
|
2
|
+
import { v as h, d as m, b as y, a as u, i as s, r as c, g as e, s as r } from "../../react.esm-DLSrfVwM.mjs";
|
|
3
|
+
import "../../index-BVxBrkZB.mjs";
|
|
4
|
+
import { CastInfoLayout as i } from "./CastInfoLayout.js";
|
|
5
|
+
h.mock("../Concat", () => ({
|
|
6
|
+
default: ({ list: n }) => /* @__PURE__ */ a("div", { "data-testid": "concat", children: n.filter(Boolean).map((l, d) => /* @__PURE__ */ a("span", { dangerouslySetInnerHTML: { __html: l || "" } }, d)) })
|
|
7
|
+
}));
|
|
8
|
+
h.mock("../ImageCard", () => ({
|
|
9
|
+
default: ({ image: n }) => /* @__PURE__ */ a("div", { "data-testid": "image-card", "data-url": n.url, "data-aspect-ratio": n.aspectRatio, children: "ImageCard" })
|
|
10
|
+
}));
|
|
11
|
+
h.mock("../AdjustableTwoColumnGrid", () => ({
|
|
12
|
+
default: ({ children: n }) => /* @__PURE__ */ a("div", { "data-testid": "two-column-grid", children: n })
|
|
13
|
+
}));
|
|
14
|
+
h.mock("../SectionedContent", () => ({
|
|
15
|
+
default: ({ sections: n }) => /* @__PURE__ */ a("div", { "data-testid": "sectioned-content", children: n.map((l, d) => /* @__PURE__ */ g("div", { "data-testid": `section-${d}`, children: [
|
|
16
|
+
/* @__PURE__ */ a("div", { "data-testid": `header-${d}`, "data-type": l.header.type, children: l.header.title }),
|
|
17
|
+
/* @__PURE__ */ a("div", { "data-testid": `content-${d}`, children: l.content })
|
|
18
|
+
] }, d)) })
|
|
19
|
+
}));
|
|
20
|
+
m("CastInfoLayout", () => {
|
|
21
|
+
const n = {
|
|
22
|
+
name: "Character Name",
|
|
23
|
+
real_name: "Actor Real Name",
|
|
24
|
+
biography: "This is a biography of the cast member.",
|
|
25
|
+
image: {
|
|
26
|
+
url: "https://example.com/image.jpg",
|
|
27
|
+
aspectRatio: 1.77,
|
|
28
|
+
altText: "Actor Real Name"
|
|
29
|
+
},
|
|
30
|
+
hometown: "New York, NY",
|
|
31
|
+
birthday: "January 1, 1990",
|
|
32
|
+
facebookHandle: "actorhandle",
|
|
33
|
+
twitterHandle: "actortwitter",
|
|
34
|
+
instagramHandle: "actorinsta"
|
|
35
|
+
};
|
|
36
|
+
let l, d;
|
|
37
|
+
y(() => {
|
|
38
|
+
h.clearAllMocks(), l = h.fn(), window.scrollTo = l, d = h.fn(), document.querySelector = d;
|
|
39
|
+
}), u(() => {
|
|
40
|
+
h.restoreAllMocks();
|
|
41
|
+
}), m("Basic Rendering", () => {
|
|
42
|
+
s("should render with complete cast member data", () => {
|
|
43
|
+
const { container: t } = c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
44
|
+
e(t).toBeInTheDocument();
|
|
45
|
+
}), s("should render AdjustableTwoColumnGrid", () => {
|
|
46
|
+
c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
47
|
+
const t = r.getByTestId("two-column-grid");
|
|
48
|
+
e(t).toBeInTheDocument();
|
|
49
|
+
}), s("should render ImageCard with correct props", () => {
|
|
50
|
+
c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
51
|
+
const t = r.getByTestId("image-card");
|
|
52
|
+
e(t).toBeInTheDocument(), e(t).toHaveAttribute("data-url", "https://example.com/image.jpg"), e(t).toHaveAttribute("data-aspect-ratio", "1.77");
|
|
53
|
+
}), s("should render SectionedContent", () => {
|
|
54
|
+
c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
55
|
+
const t = r.getByTestId("sectioned-content");
|
|
56
|
+
e(t).toBeInTheDocument();
|
|
57
|
+
});
|
|
58
|
+
}), m("Sections Rendering", () => {
|
|
59
|
+
s("should render all three sections", () => {
|
|
60
|
+
c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
61
|
+
const t = r.getByTestId("section-0"), o = r.getByTestId("section-1"), T = r.getByTestId("section-2");
|
|
62
|
+
e(t).toBeInTheDocument(), e(o).toBeInTheDocument(), e(T).toBeInTheDocument();
|
|
63
|
+
}), s("should render primary header with real name", () => {
|
|
64
|
+
c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
65
|
+
const t = r.getByTestId("header-0");
|
|
66
|
+
e(t).toHaveTextContent("Actor Real Name"), e(t).toHaveAttribute("data-type", "primary");
|
|
67
|
+
}), s("should render character name in first section content", () => {
|
|
68
|
+
c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
69
|
+
const t = r.getByTestId("content-0");
|
|
70
|
+
e(t.innerHTML).toContain("Character Name");
|
|
71
|
+
}), s("should render hometown and birthday when provided", () => {
|
|
72
|
+
c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
73
|
+
const t = r.getByTestId("content-0");
|
|
74
|
+
e(t.innerHTML).toContain("Hometown"), e(t.innerHTML).toContain("New York, NY"), e(t.innerHTML).toContain("Birthday"), e(t.innerHTML).toContain("January 1, 1990");
|
|
75
|
+
}), s("should render Biography section", () => {
|
|
76
|
+
c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
77
|
+
const t = r.getByTestId("header-1"), o = r.getByTestId("content-1");
|
|
78
|
+
e(t).toHaveTextContent("Biography"), e(t).toHaveAttribute("data-type", "secondary"), e(o).toHaveTextContent("This is a biography of the cast member.");
|
|
79
|
+
}), s("should render Follow section", () => {
|
|
80
|
+
c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
81
|
+
const t = r.getByTestId("header-2");
|
|
82
|
+
e(t).toHaveTextContent("Follow"), e(t).toHaveAttribute("data-type", "secondary");
|
|
83
|
+
});
|
|
84
|
+
}), m("Social Media Handles", () => {
|
|
85
|
+
s("should render Facebook handle when provided", () => {
|
|
86
|
+
c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
87
|
+
const t = r.getByTestId("content-2");
|
|
88
|
+
e(t.innerHTML).toContain("Facebook"), e(t.innerHTML).toContain("facebook.com/actorhandle"), e(t.innerHTML).toContain("actorhandle");
|
|
89
|
+
}), s("should render Twitter handle when provided", () => {
|
|
90
|
+
c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
91
|
+
const t = r.getByTestId("content-2");
|
|
92
|
+
e(t.innerHTML).toContain("Twitter"), e(t.innerHTML).toContain("twitter.com/actortwitter"), e(t.innerHTML).toContain("@actortwitter");
|
|
93
|
+
}), s("should render Instagram handle when provided", () => {
|
|
94
|
+
c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
95
|
+
const t = r.getByTestId("content-2");
|
|
96
|
+
e(t.innerHTML).toContain("Instagram"), e(t.innerHTML).toContain("instagram.com/actorinsta"), e(t.innerHTML).toContain("@actorinsta");
|
|
97
|
+
}), s("should render only Facebook when only Facebook is provided", () => {
|
|
98
|
+
const t = {
|
|
99
|
+
...n,
|
|
100
|
+
twitterHandle: void 0,
|
|
101
|
+
instagramHandle: void 0
|
|
102
|
+
};
|
|
103
|
+
c(/* @__PURE__ */ a(i, { castMember: t }));
|
|
104
|
+
const o = r.getByTestId("content-2");
|
|
105
|
+
e(o.innerHTML).toContain("Facebook"), e(o.innerHTML).not.toContain("Twitter"), e(o.innerHTML).not.toContain("Instagram");
|
|
106
|
+
}), s("should render only Twitter when only Twitter is provided", () => {
|
|
107
|
+
const t = {
|
|
108
|
+
...n,
|
|
109
|
+
facebookHandle: void 0,
|
|
110
|
+
instagramHandle: void 0
|
|
111
|
+
};
|
|
112
|
+
c(/* @__PURE__ */ a(i, { castMember: t }));
|
|
113
|
+
const o = r.getByTestId("content-2");
|
|
114
|
+
e(o.innerHTML).not.toContain("Facebook"), e(o.innerHTML).toContain("Twitter"), e(o.innerHTML).not.toContain("Instagram");
|
|
115
|
+
}), s("should render only Instagram when only Instagram is provided", () => {
|
|
116
|
+
const t = {
|
|
117
|
+
...n,
|
|
118
|
+
facebookHandle: void 0,
|
|
119
|
+
twitterHandle: void 0
|
|
120
|
+
};
|
|
121
|
+
c(/* @__PURE__ */ a(i, { castMember: t }));
|
|
122
|
+
const o = r.getByTestId("content-2");
|
|
123
|
+
e(o.innerHTML).not.toContain("Facebook"), e(o.innerHTML).not.toContain("Twitter"), e(o.innerHTML).toContain("Instagram");
|
|
124
|
+
}), s("should render empty string when no social handles are provided", () => {
|
|
125
|
+
const t = {
|
|
126
|
+
...n,
|
|
127
|
+
facebookHandle: void 0,
|
|
128
|
+
twitterHandle: void 0,
|
|
129
|
+
instagramHandle: void 0
|
|
130
|
+
};
|
|
131
|
+
c(/* @__PURE__ */ a(i, { castMember: t }));
|
|
132
|
+
const o = r.getByTestId("content-2");
|
|
133
|
+
e(o).toHaveTextContent("");
|
|
134
|
+
}), s("should include correct CSS classes in social media links", () => {
|
|
135
|
+
c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
136
|
+
const t = r.getByTestId("content-2");
|
|
137
|
+
e(t.innerHTML).toContain("cast__follow-platform"), e(t.innerHTML).toContain("cast__follow-link");
|
|
138
|
+
}), s('should include target="_blank" and rel="noreferrer" on social links', () => {
|
|
139
|
+
c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
140
|
+
const t = r.getByTestId("content-2");
|
|
141
|
+
e(t.innerHTML).toContain('target="_blank"'), e(t.innerHTML).toContain('rel="noreferrer"');
|
|
142
|
+
});
|
|
143
|
+
}), m("Optional Fields", () => {
|
|
144
|
+
s("should not render hometown and birthday section when both are missing", () => {
|
|
145
|
+
const t = {
|
|
146
|
+
...n,
|
|
147
|
+
hometown: void 0,
|
|
148
|
+
birthday: void 0
|
|
149
|
+
};
|
|
150
|
+
c(/* @__PURE__ */ a(i, { castMember: t }));
|
|
151
|
+
const o = r.getByTestId("content-0");
|
|
152
|
+
e(o.innerHTML).not.toContain("Hometown"), e(o.innerHTML).not.toContain("Birthday"), e(o.innerHTML).not.toContain("contact-info-pipe");
|
|
153
|
+
}), s("should not render hometown section when only hometown is missing", () => {
|
|
154
|
+
const t = {
|
|
155
|
+
...n,
|
|
156
|
+
hometown: void 0
|
|
157
|
+
};
|
|
158
|
+
c(/* @__PURE__ */ a(i, { castMember: t }));
|
|
159
|
+
const o = r.getByTestId("content-0");
|
|
160
|
+
e(o.innerHTML).not.toContain("Hometown"), e(o.innerHTML).not.toContain("contact-info-pipe");
|
|
161
|
+
}), s("should not render birthday section when only birthday is missing", () => {
|
|
162
|
+
const t = {
|
|
163
|
+
...n,
|
|
164
|
+
birthday: void 0
|
|
165
|
+
};
|
|
166
|
+
c(/* @__PURE__ */ a(i, { castMember: t }));
|
|
167
|
+
const o = r.getByTestId("content-0");
|
|
168
|
+
e(o.innerHTML).not.toContain("Birthday"), e(o.innerHTML).not.toContain("contact-info-pipe");
|
|
169
|
+
}), s("should handle empty string for hometown", () => {
|
|
170
|
+
const t = {
|
|
171
|
+
...n,
|
|
172
|
+
hometown: ""
|
|
173
|
+
};
|
|
174
|
+
c(/* @__PURE__ */ a(i, { castMember: t }));
|
|
175
|
+
const o = r.getByTestId("content-0");
|
|
176
|
+
e(o.innerHTML).not.toContain("Hometown");
|
|
177
|
+
}), s("should handle empty string for birthday", () => {
|
|
178
|
+
const t = {
|
|
179
|
+
...n,
|
|
180
|
+
birthday: ""
|
|
181
|
+
};
|
|
182
|
+
c(/* @__PURE__ */ a(i, { castMember: t }));
|
|
183
|
+
const o = r.getByTestId("content-0");
|
|
184
|
+
e(o.innerHTML).not.toContain("Birthday");
|
|
185
|
+
});
|
|
186
|
+
}), m("Props Handling", () => {
|
|
187
|
+
s("should accept castMember as a prop", () => {
|
|
188
|
+
const { container: t } = c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
189
|
+
e(t).toBeInTheDocument();
|
|
190
|
+
}), s("should handle props spread when castMember is not provided", () => {
|
|
191
|
+
const t = {
|
|
192
|
+
name: "Spread Character",
|
|
193
|
+
real_name: "Spread Actor",
|
|
194
|
+
biography: "Spread biography",
|
|
195
|
+
image: n.image
|
|
196
|
+
}, { container: o } = c(/* @__PURE__ */ a(i, { ...t }));
|
|
197
|
+
e(o).toBeInTheDocument();
|
|
198
|
+
});
|
|
199
|
+
}), m("Scroll Behavior", () => {
|
|
200
|
+
s("should call window.scrollTo when tab-content element exists", () => {
|
|
201
|
+
const t = {
|
|
202
|
+
offsetTop: 200
|
|
203
|
+
};
|
|
204
|
+
d.mockReturnValue(t), c(/* @__PURE__ */ a(i, { castMember: n })), e(d).toHaveBeenCalledWith("tab-content"), e(l).toHaveBeenCalledWith(0, 176);
|
|
205
|
+
}), s("should not call window.scrollTo when tab-content element does not exist", () => {
|
|
206
|
+
d.mockReturnValue(null), c(/* @__PURE__ */ a(i, { castMember: n })), e(d).toHaveBeenCalledWith("tab-content"), e(l).not.toHaveBeenCalled();
|
|
207
|
+
}), s("should call scroll effect only once on mount", () => {
|
|
208
|
+
const t = {
|
|
209
|
+
offsetTop: 200
|
|
210
|
+
};
|
|
211
|
+
d.mockReturnValue(t);
|
|
212
|
+
const { rerender: o } = c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
213
|
+
e(l).toHaveBeenCalledTimes(1), o(/* @__PURE__ */ a(i, { castMember: n })), e(l).toHaveBeenCalledTimes(1);
|
|
214
|
+
});
|
|
215
|
+
}), m("Edge Cases", () => {
|
|
216
|
+
s("should handle minimal cast member data", () => {
|
|
217
|
+
const t = {
|
|
218
|
+
name: "Name Only",
|
|
219
|
+
real_name: "Real Name Only",
|
|
220
|
+
biography: "Bio",
|
|
221
|
+
image: n.image
|
|
222
|
+
}, { container: o } = c(/* @__PURE__ */ a(i, { castMember: t }));
|
|
223
|
+
e(o).toBeInTheDocument();
|
|
224
|
+
}), s("should handle long biography text", () => {
|
|
225
|
+
const t = "A".repeat(1e3), o = {
|
|
226
|
+
...n,
|
|
227
|
+
biography: t
|
|
228
|
+
};
|
|
229
|
+
c(/* @__PURE__ */ a(i, { castMember: o }));
|
|
230
|
+
const T = r.getByTestId("content-1");
|
|
231
|
+
e(T).toHaveTextContent(t);
|
|
232
|
+
}), s("should handle special characters in names", () => {
|
|
233
|
+
const t = {
|
|
234
|
+
...n,
|
|
235
|
+
name: "O'Brien & D'Angelo",
|
|
236
|
+
real_name: "François José-María"
|
|
237
|
+
};
|
|
238
|
+
c(/* @__PURE__ */ a(i, { castMember: t }));
|
|
239
|
+
const o = r.getByTestId("header-0"), T = r.getByTestId("content-0");
|
|
240
|
+
e(o).toHaveTextContent("François José-María"), e(T.innerHTML).toContain("O'Brien & D'Angelo");
|
|
241
|
+
}), s("should handle special characters in social handles", () => {
|
|
242
|
+
const t = {
|
|
243
|
+
...n,
|
|
244
|
+
twitterHandle: "actor_name.official",
|
|
245
|
+
instagramHandle: "actor.name_official"
|
|
246
|
+
};
|
|
247
|
+
c(/* @__PURE__ */ a(i, { castMember: t }));
|
|
248
|
+
const o = r.getByTestId("content-2");
|
|
249
|
+
e(o.innerHTML).toContain("@actor_name.official"), e(o.innerHTML).toContain("@actor.name_official");
|
|
250
|
+
}), s("should handle empty biography", () => {
|
|
251
|
+
const t = {
|
|
252
|
+
...n,
|
|
253
|
+
biography: ""
|
|
254
|
+
};
|
|
255
|
+
c(/* @__PURE__ */ a(i, { castMember: t }));
|
|
256
|
+
const o = r.getByTestId("content-1");
|
|
257
|
+
e(o).toHaveTextContent("");
|
|
258
|
+
}), s("should handle different image aspect ratios", () => {
|
|
259
|
+
const t = {
|
|
260
|
+
...n,
|
|
261
|
+
image: {
|
|
262
|
+
url: "https://example.com/square.jpg",
|
|
263
|
+
aspectRatio: 1,
|
|
264
|
+
altText: "Square image"
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
c(/* @__PURE__ */ a(i, { castMember: t }));
|
|
268
|
+
const o = r.getByTestId("image-card");
|
|
269
|
+
e(o).toHaveAttribute("data-aspect-ratio", "1");
|
|
270
|
+
});
|
|
271
|
+
}), m("Content Structure", () => {
|
|
272
|
+
s("should render character name inside a div", () => {
|
|
273
|
+
c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
274
|
+
const t = r.getByTestId("content-0");
|
|
275
|
+
e(t.innerHTML).toContain("<div>Character Name</div>");
|
|
276
|
+
}), s("should render hometown and birthday with strong tags", () => {
|
|
277
|
+
c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
278
|
+
const t = r.getByTestId("content-0");
|
|
279
|
+
e(t.innerHTML).toContain("<strong>Hometown</strong>"), e(t.innerHTML).toContain("<strong>Birthday</strong>");
|
|
280
|
+
}), s("should render pipe separator between hometown and birthday", () => {
|
|
281
|
+
c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
282
|
+
const t = r.getByTestId("content-0");
|
|
283
|
+
e(t.innerHTML).toContain("contact-info-pipe");
|
|
284
|
+
});
|
|
285
|
+
}), m("Integration", () => {
|
|
286
|
+
s("should render complete layout with all components", () => {
|
|
287
|
+
c(/* @__PURE__ */ a(i, { castMember: n })), e(r.getByTestId("two-column-grid")).toBeInTheDocument(), e(r.getByTestId("image-card")).toBeInTheDocument(), e(r.getByTestId("sectioned-content")).toBeInTheDocument(), e(r.getAllByTestId(/^section-/)).toHaveLength(3), e(r.getAllByTestId(/^header-/)).toHaveLength(3), e(r.getAllByTestId(/^content-/)).toHaveLength(3);
|
|
288
|
+
}), s("should pass correct structure to SectionedContent", () => {
|
|
289
|
+
c(/* @__PURE__ */ a(i, { castMember: n }));
|
|
290
|
+
const t = r.getAllByTestId(/^section-/);
|
|
291
|
+
e(t).toHaveLength(3), e(r.getByTestId("header-0")).toHaveTextContent("Actor Real Name"), e(r.getByTestId("header-1")).toHaveTextContent("Biography"), e(r.getByTestId("header-2")).toHaveTextContent("Follow");
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
});
|