@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,353 @@
|
|
|
1
|
+
import { jsxs as f, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { v as u, d as m, b as y, a as T, i as o, r as n, g as i, s as l } from "../../react.esm-DLSrfVwM.mjs";
|
|
3
|
+
import { u as p } from "../../index-BUN4jQ3m.mjs";
|
|
4
|
+
import "../../index-BVxBrkZB.mjs";
|
|
5
|
+
import { FeaturedList as r } from "./FeaturedList.js";
|
|
6
|
+
u.mock("../ImageCard", () => ({
|
|
7
|
+
default: ({ cta: d, content: a, image: e, fullCardClickable: t, displayCTA: c, handleClicks: g, relatedResourceId: h }) => /* @__PURE__ */ f(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
"data-cta-href": d == null ? void 0 : d.href,
|
|
11
|
+
"data-cta-type": d == null ? void 0 : d.type,
|
|
12
|
+
"data-resource-id": h,
|
|
13
|
+
"data-testid": "image-card",
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ s("div", { "data-testid": "card-content", children: a }),
|
|
16
|
+
/* @__PURE__ */ s("img", { alt: e == null ? void 0 : e.altText, src: e == null ? void 0 : e.url }),
|
|
17
|
+
t && /* @__PURE__ */ s("span", { "data-testid": "full-card-clickable", children: "clickable" }),
|
|
18
|
+
c && /* @__PURE__ */ s("span", { "data-testid": "display-cta", children: "cta visible" }),
|
|
19
|
+
/* @__PURE__ */ s("button", { onClick: () => g && g({ resourceId: h }), children: "Click" })
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
}));
|
|
24
|
+
u.mock("../Loading", () => ({
|
|
25
|
+
default: () => /* @__PURE__ */ s("div", { "data-testid": "loading", children: "Loading..." })
|
|
26
|
+
}));
|
|
27
|
+
u.mock("../AirDateFormatter", () => ({
|
|
28
|
+
default: ({ airdateStr: d, separatorType: a }) => /* @__PURE__ */ s("div", { "data-airdate": d, "data-separator": a, "data-testid": "air-date-formatter", children: d })
|
|
29
|
+
}));
|
|
30
|
+
u.mock("../../utils/helpers", () => ({
|
|
31
|
+
convert12to24: u.fn((d) => d === "10:00 PM" ? "22:00" : d === "08:30 AM" ? "08:30" : d)
|
|
32
|
+
}));
|
|
33
|
+
u.mock("../../utils/program-helpers", () => ({
|
|
34
|
+
determineSeriesPrefix: u.fn((d) => `series-${d}`)
|
|
35
|
+
}));
|
|
36
|
+
m("FeaturedList", () => {
|
|
37
|
+
let d;
|
|
38
|
+
y(() => {
|
|
39
|
+
d = document.createElement("div"), d.id = "root", document.body.appendChild(d), u.clearAllMocks();
|
|
40
|
+
}), T(() => {
|
|
41
|
+
document.body.removeChild(d);
|
|
42
|
+
});
|
|
43
|
+
const a = (e) => ({
|
|
44
|
+
id: 1,
|
|
45
|
+
program: "Test Program",
|
|
46
|
+
program_class: "Series",
|
|
47
|
+
title_code: "TEST123",
|
|
48
|
+
series_prefix: "TP",
|
|
49
|
+
start_date: "2024-01-15",
|
|
50
|
+
start_time: "10:00 PM",
|
|
51
|
+
content: {
|
|
52
|
+
slug: "test-program",
|
|
53
|
+
image: "https://example.com/image.jpg"
|
|
54
|
+
},
|
|
55
|
+
...e
|
|
56
|
+
});
|
|
57
|
+
m("Loading State", () => {
|
|
58
|
+
o("should render Loading component when list is null", () => {
|
|
59
|
+
n(/* @__PURE__ */ s(r, { list: null })), i(l.getByTestId("loading")).toBeInTheDocument();
|
|
60
|
+
}), o("should render Loading inside a div when list is null", () => {
|
|
61
|
+
const { container: e } = n(/* @__PURE__ */ s(r, { list: null })), t = e.querySelector("div");
|
|
62
|
+
i(t).toBeInTheDocument(), i(t == null ? void 0 : t.querySelector('[data-testid="loading"]')).toBeInTheDocument();
|
|
63
|
+
});
|
|
64
|
+
}), m("Empty State", () => {
|
|
65
|
+
o("should render no results message when list is empty", () => {
|
|
66
|
+
n(/* @__PURE__ */ s(r, { list: [] })), i(l.getByText("There are no items to display.")).toBeInTheDocument();
|
|
67
|
+
}), o("should apply featured-list__no-results class to no results message", () => {
|
|
68
|
+
const { container: e } = n(/* @__PURE__ */ s(r, { list: [] })), t = e.querySelector(".featured-list__no-results");
|
|
69
|
+
i(t).toBeInTheDocument(), i(t).toHaveTextContent("There are no items to display.");
|
|
70
|
+
}), o("should not render featured-list element when empty", () => {
|
|
71
|
+
n(/* @__PURE__ */ s(r, { list: [] }));
|
|
72
|
+
const e = document.querySelector("featured-list");
|
|
73
|
+
i(e).not.toBeInTheDocument();
|
|
74
|
+
});
|
|
75
|
+
}), m("List with Items", () => {
|
|
76
|
+
o("should render featured-list custom element", () => {
|
|
77
|
+
const e = [a()];
|
|
78
|
+
n(/* @__PURE__ */ s(r, { list: e }));
|
|
79
|
+
const t = document.querySelector("featured-list");
|
|
80
|
+
i(t).toBeInTheDocument();
|
|
81
|
+
}), o("should render ImageCard for single item", () => {
|
|
82
|
+
const e = [a()];
|
|
83
|
+
n(/* @__PURE__ */ s(r, { list: e }));
|
|
84
|
+
const t = l.getAllByTestId("image-card");
|
|
85
|
+
i(t).toHaveLength(1);
|
|
86
|
+
}), o("should render ImageCard for multiple items", () => {
|
|
87
|
+
const e = [
|
|
88
|
+
a({ id: 1 }),
|
|
89
|
+
a({ id: 2 }),
|
|
90
|
+
a({ id: 3 })
|
|
91
|
+
];
|
|
92
|
+
n(/* @__PURE__ */ s(r, { list: e }));
|
|
93
|
+
const t = l.getAllByTestId("image-card");
|
|
94
|
+
i(t).toHaveLength(3);
|
|
95
|
+
}), o("should pass correct image data to ImageCard", () => {
|
|
96
|
+
const e = [a({
|
|
97
|
+
program: "Test Show",
|
|
98
|
+
content: {
|
|
99
|
+
slug: "test-show",
|
|
100
|
+
image: "https://example.com/test.jpg"
|
|
101
|
+
}
|
|
102
|
+
})];
|
|
103
|
+
n(/* @__PURE__ */ s(r, { list: e }));
|
|
104
|
+
const t = l.getByAltText("Test Show");
|
|
105
|
+
i(t).toHaveAttribute("src", "https://example.com/test.jpg");
|
|
106
|
+
}), o("should use default imageAspectRatio", () => {
|
|
107
|
+
const e = [a()];
|
|
108
|
+
n(/* @__PURE__ */ s(r, { list: e })), i(l.getByTestId("image-card")).toBeInTheDocument();
|
|
109
|
+
}), o("should use custom imageAspectRatio", () => {
|
|
110
|
+
const e = [a()];
|
|
111
|
+
n(/* @__PURE__ */ s(r, { imageAspectRatio: 16 / 9, list: e })), i(l.getByTestId("image-card")).toBeInTheDocument();
|
|
112
|
+
});
|
|
113
|
+
}), m("AirDateFormatter Integration", () => {
|
|
114
|
+
o("should render AirDateFormatter with correct date and time", () => {
|
|
115
|
+
const e = [a({
|
|
116
|
+
start_date: "2024-01-15",
|
|
117
|
+
start_time: "10:00 PM"
|
|
118
|
+
})];
|
|
119
|
+
n(/* @__PURE__ */ s(r, { list: e }));
|
|
120
|
+
const t = l.getByTestId("air-date-formatter");
|
|
121
|
+
i(t).toHaveAttribute("data-airdate", "2024-01-15 22:00");
|
|
122
|
+
}), o("should use pipe separator type", () => {
|
|
123
|
+
const e = [a()];
|
|
124
|
+
n(/* @__PURE__ */ s(r, { list: e }));
|
|
125
|
+
const t = l.getByTestId("air-date-formatter");
|
|
126
|
+
i(t).toHaveAttribute("data-separator", "pipe");
|
|
127
|
+
}), o("should convert 12-hour time to 24-hour format", () => {
|
|
128
|
+
const e = [a({
|
|
129
|
+
start_date: "2024-01-20",
|
|
130
|
+
start_time: "08:30 AM"
|
|
131
|
+
})];
|
|
132
|
+
n(/* @__PURE__ */ s(r, { list: e }));
|
|
133
|
+
const t = l.getByTestId("air-date-formatter");
|
|
134
|
+
i(t).toHaveAttribute("data-airdate", "2024-01-20 08:30");
|
|
135
|
+
});
|
|
136
|
+
}), m("CTA Configuration - Series", () => {
|
|
137
|
+
o("should create show link for Series when hasSeriesPages is true", () => {
|
|
138
|
+
const e = [a({
|
|
139
|
+
program_class: "Series",
|
|
140
|
+
content: { slug: "test-series", image: "" }
|
|
141
|
+
})];
|
|
142
|
+
n(/* @__PURE__ */ s(r, { hasSeriesPages: !0, list: e }));
|
|
143
|
+
const t = l.getByTestId("image-card");
|
|
144
|
+
i(t).toHaveAttribute("data-cta-href", "/show/test-series");
|
|
145
|
+
}), o("should use internal-link type for Series when hasSeriesPages is true", () => {
|
|
146
|
+
const e = [a({
|
|
147
|
+
program_class: "Series",
|
|
148
|
+
content: { slug: "test-series", image: "" }
|
|
149
|
+
})];
|
|
150
|
+
n(/* @__PURE__ */ s(r, { hasSeriesPages: !0, list: e }));
|
|
151
|
+
const t = l.getByTestId("image-card");
|
|
152
|
+
i(t).toHaveAttribute("data-cta-type", "internal-link");
|
|
153
|
+
}), o("should use empty href for Series when hasSeriesPages is false", () => {
|
|
154
|
+
const e = [a({
|
|
155
|
+
program_class: "Series",
|
|
156
|
+
content: { slug: "test-series", image: "" }
|
|
157
|
+
})];
|
|
158
|
+
n(/* @__PURE__ */ s(r, { hasSeriesPages: !1, list: e }));
|
|
159
|
+
const t = l.getByTestId("image-card");
|
|
160
|
+
i(t).toHaveAttribute("data-cta-href", "");
|
|
161
|
+
}), o("should use show-modal type when hasSeriesPages is false", () => {
|
|
162
|
+
const e = [a({
|
|
163
|
+
program_class: "Series",
|
|
164
|
+
content: { slug: "test-series", image: "" }
|
|
165
|
+
})];
|
|
166
|
+
n(/* @__PURE__ */ s(r, { hasSeriesPages: !1, list: e }));
|
|
167
|
+
const t = l.getByTestId("image-card");
|
|
168
|
+
i(t).toHaveAttribute("data-cta-type", "show-modal");
|
|
169
|
+
}), o("should use determineSeriesPrefix for Series relatedResourceId", () => {
|
|
170
|
+
const e = [a({
|
|
171
|
+
program_class: "Series",
|
|
172
|
+
series_prefix: "ABC"
|
|
173
|
+
})];
|
|
174
|
+
n(/* @__PURE__ */ s(r, { list: e }));
|
|
175
|
+
const t = l.getByTestId("image-card");
|
|
176
|
+
i(t).toHaveAttribute("data-resource-id", "series-ABC");
|
|
177
|
+
});
|
|
178
|
+
}), m("CTA Configuration - Film", () => {
|
|
179
|
+
o("should create movie link for Film when hasSeriesPages is true", () => {
|
|
180
|
+
const e = [a({
|
|
181
|
+
program_class: "Film",
|
|
182
|
+
content: { slug: "test-movie", image: "" }
|
|
183
|
+
})];
|
|
184
|
+
n(/* @__PURE__ */ s(r, { hasSeriesPages: !0, list: e }));
|
|
185
|
+
const t = l.getByTestId("image-card");
|
|
186
|
+
i(t).toHaveAttribute("data-cta-href", "/movie/test-movie");
|
|
187
|
+
}), o("should use internal-link type for Film when hasSeriesPages is true", () => {
|
|
188
|
+
const e = [a({
|
|
189
|
+
program_class: "Film",
|
|
190
|
+
content: { slug: "test-movie", image: "" }
|
|
191
|
+
})];
|
|
192
|
+
n(/* @__PURE__ */ s(r, { hasSeriesPages: !0, list: e }));
|
|
193
|
+
const t = l.getByTestId("image-card");
|
|
194
|
+
i(t).toHaveAttribute("data-cta-type", "internal-link");
|
|
195
|
+
}), o("should use empty href for Film when hasSeriesPages is false", () => {
|
|
196
|
+
const e = [a({
|
|
197
|
+
program_class: "Film",
|
|
198
|
+
content: { slug: "test-movie", image: "" }
|
|
199
|
+
})];
|
|
200
|
+
n(/* @__PURE__ */ s(r, { hasSeriesPages: !1, list: e }));
|
|
201
|
+
const t = l.getByTestId("image-card");
|
|
202
|
+
i(t).toHaveAttribute("data-cta-href", "");
|
|
203
|
+
}), o("should use title_code for Film relatedResourceId", () => {
|
|
204
|
+
const e = [a({
|
|
205
|
+
program_class: "Film",
|
|
206
|
+
title_code: "MOVIE123"
|
|
207
|
+
})];
|
|
208
|
+
n(/* @__PURE__ */ s(r, { list: e }));
|
|
209
|
+
const t = l.getByTestId("image-card");
|
|
210
|
+
i(t).toHaveAttribute("data-resource-id", "MOVIE123");
|
|
211
|
+
});
|
|
212
|
+
}), m("ImageCard Props", () => {
|
|
213
|
+
o("should set fullCardClickable to true", () => {
|
|
214
|
+
const e = [a()];
|
|
215
|
+
n(/* @__PURE__ */ s(r, { list: e })), i(l.getByTestId("full-card-clickable")).toBeInTheDocument();
|
|
216
|
+
}), o("should set displayCTA to false", () => {
|
|
217
|
+
const e = [a()];
|
|
218
|
+
n(/* @__PURE__ */ s(r, { list: e })), i(l.queryByTestId("display-cta")).not.toBeInTheDocument();
|
|
219
|
+
}), o("should handle missing slug gracefully", () => {
|
|
220
|
+
const e = [a({
|
|
221
|
+
content: { slug: void 0, image: "" }
|
|
222
|
+
})];
|
|
223
|
+
n(/* @__PURE__ */ s(r, { list: e }));
|
|
224
|
+
const t = l.getByTestId("image-card");
|
|
225
|
+
i(t).toHaveAttribute("data-cta-href", "");
|
|
226
|
+
}), o("should handle missing content gracefully", () => {
|
|
227
|
+
const e = [a({
|
|
228
|
+
content: void 0
|
|
229
|
+
})];
|
|
230
|
+
n(/* @__PURE__ */ s(r, { list: e }));
|
|
231
|
+
const t = l.getByTestId("image-card");
|
|
232
|
+
i(t).toBeInTheDocument();
|
|
233
|
+
}), o("should use empty string for missing image", () => {
|
|
234
|
+
const e = [a({
|
|
235
|
+
content: { slug: "test", image: void 0 }
|
|
236
|
+
})];
|
|
237
|
+
n(/* @__PURE__ */ s(r, { list: e }));
|
|
238
|
+
const t = l.getByAltText("Test Program");
|
|
239
|
+
i(t).toHaveAttribute("src", "");
|
|
240
|
+
});
|
|
241
|
+
}), m("HandleClicks Functionality", () => {
|
|
242
|
+
o("should not call handleClicks when hasSeriesPages is true", async () => {
|
|
243
|
+
const e = u.fn(), t = [a()];
|
|
244
|
+
n(/* @__PURE__ */ s(r, { hasSeriesPages: !0, handleClicks: e, list: t }));
|
|
245
|
+
const c = l.getByRole("button");
|
|
246
|
+
await p.click(c), i(e).not.toHaveBeenCalled();
|
|
247
|
+
}), o("should call handleClicks when hasSeriesPages is false", async () => {
|
|
248
|
+
const e = u.fn(), t = [a({
|
|
249
|
+
program_class: "Series",
|
|
250
|
+
series_prefix: "TEST"
|
|
251
|
+
})];
|
|
252
|
+
n(/* @__PURE__ */ s(r, { handleClicks: e, hasSeriesPages: !1, list: t }));
|
|
253
|
+
const c = l.getByRole("button");
|
|
254
|
+
await p.click(c), i(e).toHaveBeenCalled();
|
|
255
|
+
}), o("should use default no-op handleClicks when not provided", () => {
|
|
256
|
+
const e = [a()];
|
|
257
|
+
i(() => n(/* @__PURE__ */ s(r, { hasSeriesPages: !1, list: e }))).not.toThrow();
|
|
258
|
+
});
|
|
259
|
+
}), m("Edge Cases", () => {
|
|
260
|
+
o("should handle items with null content image", () => {
|
|
261
|
+
const e = [a({
|
|
262
|
+
content: { slug: "test", image: null }
|
|
263
|
+
})];
|
|
264
|
+
n(/* @__PURE__ */ s(r, { list: e }));
|
|
265
|
+
const t = l.getByAltText("Test Program");
|
|
266
|
+
i(t).toHaveAttribute("src", "");
|
|
267
|
+
}), o("should handle different program classes", () => {
|
|
268
|
+
const e = [
|
|
269
|
+
a({ id: 1, program_class: "Series" }),
|
|
270
|
+
a({ id: 2, program_class: "Film" }),
|
|
271
|
+
a({ id: 3, program_class: "Special" })
|
|
272
|
+
];
|
|
273
|
+
n(/* @__PURE__ */ s(r, { list: e }));
|
|
274
|
+
const t = l.getAllByTestId("image-card");
|
|
275
|
+
i(t).toHaveLength(3);
|
|
276
|
+
}), o("should handle very long list", () => {
|
|
277
|
+
const e = Array.from(
|
|
278
|
+
{ length: 50 },
|
|
279
|
+
(c, g) => a({ id: g + 1 })
|
|
280
|
+
);
|
|
281
|
+
n(/* @__PURE__ */ s(r, { list: e }));
|
|
282
|
+
const t = l.getAllByTestId("image-card");
|
|
283
|
+
i(t).toHaveLength(50);
|
|
284
|
+
}), o("should handle items with special characters in program name", () => {
|
|
285
|
+
const e = [a({
|
|
286
|
+
program: "Test's Program & More!"
|
|
287
|
+
})];
|
|
288
|
+
n(/* @__PURE__ */ s(r, { list: e })), i(l.getByAltText("Test's Program & More!")).toBeInTheDocument();
|
|
289
|
+
}), o("should render unique keys for each item", () => {
|
|
290
|
+
const e = [
|
|
291
|
+
a({ id: 1 }),
|
|
292
|
+
a({ id: 2 }),
|
|
293
|
+
a({ id: 3 })
|
|
294
|
+
], { container: t } = n(/* @__PURE__ */ s(r, { list: e })), c = t.querySelector("featured-list");
|
|
295
|
+
i(c == null ? void 0 : c.children).toHaveLength(3);
|
|
296
|
+
});
|
|
297
|
+
}), m("Integration", () => {
|
|
298
|
+
o("should render complete featured list with all features", () => {
|
|
299
|
+
const e = u.fn(), t = [
|
|
300
|
+
a({
|
|
301
|
+
id: 1,
|
|
302
|
+
program: "Drama Series",
|
|
303
|
+
program_class: "Series",
|
|
304
|
+
series_prefix: "DS",
|
|
305
|
+
start_date: "2024-01-15",
|
|
306
|
+
start_time: "10:00 PM",
|
|
307
|
+
content: {
|
|
308
|
+
slug: "drama-series",
|
|
309
|
+
image: "https://example.com/drama.jpg"
|
|
310
|
+
}
|
|
311
|
+
}),
|
|
312
|
+
a({
|
|
313
|
+
id: 2,
|
|
314
|
+
program: "Action Movie",
|
|
315
|
+
program_class: "Film",
|
|
316
|
+
title_code: "FILM123",
|
|
317
|
+
start_date: "2024-01-16",
|
|
318
|
+
start_time: "08:30 AM",
|
|
319
|
+
content: {
|
|
320
|
+
slug: "action-movie",
|
|
321
|
+
image: "https://example.com/movie.jpg"
|
|
322
|
+
}
|
|
323
|
+
})
|
|
324
|
+
];
|
|
325
|
+
n(/* @__PURE__ */ s(
|
|
326
|
+
r,
|
|
327
|
+
{
|
|
328
|
+
hasSeriesPages: !0,
|
|
329
|
+
handleClicks: e,
|
|
330
|
+
imageAspectRatio: 16 / 9,
|
|
331
|
+
list: t
|
|
332
|
+
}
|
|
333
|
+
));
|
|
334
|
+
const c = document.querySelector("featured-list");
|
|
335
|
+
i(c).toBeInTheDocument();
|
|
336
|
+
const g = l.getAllByTestId("image-card");
|
|
337
|
+
i(g).toHaveLength(2), i(l.getByAltText("Drama Series")).toBeInTheDocument(), i(l.getByAltText("Action Movie")).toBeInTheDocument();
|
|
338
|
+
const h = l.getAllByTestId("air-date-formatter");
|
|
339
|
+
i(h).toHaveLength(2);
|
|
340
|
+
}), o("should update when list changes", () => {
|
|
341
|
+
const { rerender: e } = n(/* @__PURE__ */ s(r, { list: [a({ id: 1 })] }));
|
|
342
|
+
i(l.getAllByTestId("image-card")).toHaveLength(1), e(/* @__PURE__ */ s(
|
|
343
|
+
r,
|
|
344
|
+
{
|
|
345
|
+
list: [
|
|
346
|
+
a({ id: 1 }),
|
|
347
|
+
a({ id: 2 })
|
|
348
|
+
]
|
|
349
|
+
}
|
|
350
|
+
)), i(l.getAllByTestId("image-card")).toHaveLength(2), e(/* @__PURE__ */ s(r, { list: [] })), i(l.getByText("There are no items to display.")).toBeInTheDocument();
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
});
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { jsx as n, jsxs as p, Fragment as h } from "react/jsx-runtime";
|
|
2
|
+
import { d as s, b as d, a as T, i, r, g as e, s as c } from "../../react.esm-DLSrfVwM.mjs";
|
|
3
|
+
import "../../index-BVxBrkZB.mjs";
|
|
4
|
+
import { Figure as a } from "./Figure.js";
|
|
5
|
+
s("Figure", () => {
|
|
6
|
+
let g;
|
|
7
|
+
d(() => {
|
|
8
|
+
g = document.createElement("div"), g.id = "root", document.body.appendChild(g);
|
|
9
|
+
}), T(() => {
|
|
10
|
+
document.body.removeChild(g);
|
|
11
|
+
}), s("Basic Rendering", () => {
|
|
12
|
+
i("should render figure element", () => {
|
|
13
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test" } }));
|
|
14
|
+
const t = document.querySelector("figure");
|
|
15
|
+
e(t).toBeInTheDocument();
|
|
16
|
+
}), i("should render img element", () => {
|
|
17
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test" } }));
|
|
18
|
+
const t = c.getByRole("img");
|
|
19
|
+
e(t).toBeInTheDocument();
|
|
20
|
+
}), i("should apply figure CSS class", () => {
|
|
21
|
+
const { container: t } = r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test" } })), o = t.querySelector(".figure");
|
|
22
|
+
e(o).toBeInTheDocument(), e(o == null ? void 0 : o.tagName).toBe("FIGURE");
|
|
23
|
+
});
|
|
24
|
+
}), s("Image Attributes", () => {
|
|
25
|
+
i("should set src attribute on img", () => {
|
|
26
|
+
r(/* @__PURE__ */ n(a, { image: { url: "https://example.com/image.jpg", altText: "Test" } }));
|
|
27
|
+
const t = c.getByRole("img");
|
|
28
|
+
e(t).toHaveAttribute("src", "https://example.com/image.jpg");
|
|
29
|
+
}), i("should set alt attribute on img", () => {
|
|
30
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test Image" } }));
|
|
31
|
+
const t = c.getByRole("img");
|
|
32
|
+
e(t).toHaveAttribute("alt", "Test Image");
|
|
33
|
+
}), i("should handle empty url", () => {
|
|
34
|
+
r(/* @__PURE__ */ n(a, { image: { url: "", altText: "Test" } }));
|
|
35
|
+
const t = c.getByRole("img");
|
|
36
|
+
e(t).toHaveAttribute("src", "");
|
|
37
|
+
}), i("should handle empty altText", () => {
|
|
38
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "" } }));
|
|
39
|
+
const t = document.querySelector("img");
|
|
40
|
+
e(t).toBeInTheDocument(), e(t).toHaveAttribute("alt", "");
|
|
41
|
+
}), i("should handle altText with special characters", () => {
|
|
42
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test's Image & More!" } }));
|
|
43
|
+
const t = c.getByRole("img");
|
|
44
|
+
e(t).toHaveAttribute("alt", "Test's Image & More!");
|
|
45
|
+
});
|
|
46
|
+
}), s("Title Attribute", () => {
|
|
47
|
+
i("should set title attribute on figure when altText is provided", () => {
|
|
48
|
+
const { container: t } = r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test Title" } })), o = t.querySelector("figure");
|
|
49
|
+
e(o).toHaveAttribute("title", "Test Title");
|
|
50
|
+
}), i("should set empty title when altText is empty", () => {
|
|
51
|
+
const { container: t } = r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "" } })), o = t.querySelector("figure");
|
|
52
|
+
e(o).toHaveAttribute("title", "");
|
|
53
|
+
}), i("should handle title with special characters", () => {
|
|
54
|
+
const { container: t } = r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: 'Title: "Special" & More!' } })), o = t.querySelector("figure");
|
|
55
|
+
e(o).toHaveAttribute("title", 'Title: "Special" & More!');
|
|
56
|
+
});
|
|
57
|
+
}), s("Caption Rendering", () => {
|
|
58
|
+
i("should not render figcaption when caption is not provided", () => {
|
|
59
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test" } }));
|
|
60
|
+
const t = document.querySelector("figcaption");
|
|
61
|
+
e(t).not.toBeInTheDocument();
|
|
62
|
+
}), i("should render figcaption when caption is provided", () => {
|
|
63
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test", caption: "Test caption" } }));
|
|
64
|
+
const t = document.querySelector("figcaption");
|
|
65
|
+
e(t).toBeInTheDocument();
|
|
66
|
+
}), i("should render caption text", () => {
|
|
67
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test", caption: "This is a caption" } })), e(c.getByText("This is a caption")).toBeInTheDocument();
|
|
68
|
+
}), i("should not render figcaption when caption is empty string", () => {
|
|
69
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test", caption: "" } }));
|
|
70
|
+
const t = document.querySelector("figcaption");
|
|
71
|
+
e(t).not.toBeInTheDocument();
|
|
72
|
+
}), i("should not render figcaption when caption is undefined", () => {
|
|
73
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test", caption: void 0 } }));
|
|
74
|
+
const t = document.querySelector("figcaption");
|
|
75
|
+
e(t).not.toBeInTheDocument();
|
|
76
|
+
});
|
|
77
|
+
}), s("HTML Parsing in Caption", () => {
|
|
78
|
+
i("should parse HTML tags in caption", () => {
|
|
79
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test", caption: "<strong>Bold text</strong>" } }));
|
|
80
|
+
const t = document.querySelector("strong");
|
|
81
|
+
e(t).toBeInTheDocument(), e(t).toHaveTextContent("Bold text");
|
|
82
|
+
}), i("should parse multiple HTML tags", () => {
|
|
83
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test", caption: "<em>Italic</em> and <strong>bold</strong>" } })), e(document.querySelector("em")).toBeInTheDocument(), e(document.querySelector("strong")).toBeInTheDocument();
|
|
84
|
+
}), i("should parse links in caption", () => {
|
|
85
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test", caption: '<a href="/source">Source</a>' } }));
|
|
86
|
+
const t = c.getByRole("link", { name: /source/i });
|
|
87
|
+
e(t).toBeInTheDocument(), e(t).toHaveAttribute("href", "/source");
|
|
88
|
+
}), i("should parse nested HTML elements", () => {
|
|
89
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test", caption: "<span>Nested <strong>content</strong></span>" } }));
|
|
90
|
+
const t = document.querySelector("span"), o = t == null ? void 0 : t.querySelector("strong");
|
|
91
|
+
e(t).toBeInTheDocument(), e(o).toBeInTheDocument(), e(o).toHaveTextContent("content");
|
|
92
|
+
}), i("should handle plain text caption without HTML", () => {
|
|
93
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test", caption: "Plain text caption" } })), e(c.getByText("Plain text caption")).toBeInTheDocument();
|
|
94
|
+
}), i("should parse line breaks", () => {
|
|
95
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test", caption: "Line 1<br/>Line 2" } }));
|
|
96
|
+
const t = document.querySelector("br");
|
|
97
|
+
e(t).toBeInTheDocument();
|
|
98
|
+
}), i("should handle mixed content", () => {
|
|
99
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test", caption: "Some text <strong>bold</strong> more text" } }));
|
|
100
|
+
const t = document.querySelector("figcaption");
|
|
101
|
+
e(t).toHaveTextContent("Some text bold more text"), e(t == null ? void 0 : t.querySelector("strong")).toBeInTheDocument();
|
|
102
|
+
});
|
|
103
|
+
}), s("Default Props", () => {
|
|
104
|
+
i("should use default image values when not provided", () => {
|
|
105
|
+
r(/* @__PURE__ */ n(a, {}));
|
|
106
|
+
const t = document.querySelector("img");
|
|
107
|
+
e(t).toBeInTheDocument(), e(t).toHaveAttribute("src", ""), e(t).toHaveAttribute("alt", "");
|
|
108
|
+
}), i("should not render caption with default values", () => {
|
|
109
|
+
r(/* @__PURE__ */ n(a, {}));
|
|
110
|
+
const t = document.querySelector("figcaption");
|
|
111
|
+
e(t).not.toBeInTheDocument();
|
|
112
|
+
}), i("should render figure element with defaults", () => {
|
|
113
|
+
r(/* @__PURE__ */ n(a, {}));
|
|
114
|
+
const t = document.querySelector("figure");
|
|
115
|
+
e(t).toBeInTheDocument();
|
|
116
|
+
}), i("should set empty title with default values", () => {
|
|
117
|
+
const { container: t } = r(/* @__PURE__ */ n(a, {})), o = t.querySelector("figure");
|
|
118
|
+
e(o).toHaveAttribute("title", "");
|
|
119
|
+
});
|
|
120
|
+
}), s("Component Structure", () => {
|
|
121
|
+
i("should have correct DOM hierarchy without caption", () => {
|
|
122
|
+
const { container: t } = r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test" } })), o = t.querySelector("figure"), l = o == null ? void 0 : o.querySelector("img"), u = o == null ? void 0 : o.querySelector("figcaption");
|
|
123
|
+
e(o).toBeInTheDocument(), e(l).toBeInTheDocument(), e(u).not.toBeInTheDocument();
|
|
124
|
+
}), i("should have correct DOM hierarchy with caption", () => {
|
|
125
|
+
const { container: t } = r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test", caption: "Caption" } })), o = t.querySelector("figure"), l = o == null ? void 0 : o.querySelector("img"), u = o == null ? void 0 : o.querySelector("figcaption");
|
|
126
|
+
e(o).toBeInTheDocument(), e(l).toBeInTheDocument(), e(u).toBeInTheDocument();
|
|
127
|
+
}), i("should render img before figcaption", () => {
|
|
128
|
+
var u, m;
|
|
129
|
+
const { container: t } = r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test", caption: "Caption" } })), o = t.querySelector("figure"), l = Array.from((o == null ? void 0 : o.children) || []);
|
|
130
|
+
e((u = l[0]) == null ? void 0 : u.tagName).toBe("IMG"), e((m = l[1]) == null ? void 0 : m.tagName).toBe("FIGCAPTION");
|
|
131
|
+
});
|
|
132
|
+
}), s("Edge Cases", () => {
|
|
133
|
+
i("should handle very long alt text", () => {
|
|
134
|
+
const t = "This is a very long alt text that describes the image in great detail and contains a lot of information about what is shown in the image.";
|
|
135
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: t } }));
|
|
136
|
+
const o = c.getByRole("img");
|
|
137
|
+
e(o).toHaveAttribute("alt", t);
|
|
138
|
+
}), i("should handle very long caption", () => {
|
|
139
|
+
const t = "This is a very long caption that provides extensive information about the image, its context, and any relevant details that might be important for understanding the visual content.";
|
|
140
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test", caption: t } })), e(c.getByText(t)).toBeInTheDocument();
|
|
141
|
+
}), i("should handle caption with only HTML tags", () => {
|
|
142
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test", caption: "<strong></strong>" } }));
|
|
143
|
+
const t = document.querySelector("figcaption"), o = t == null ? void 0 : t.querySelector("strong");
|
|
144
|
+
e(t).toBeInTheDocument(), e(o).toBeInTheDocument();
|
|
145
|
+
}), i("should handle self-closing tags in caption", () => {
|
|
146
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test", caption: "Line 1<br />Line 2" } }));
|
|
147
|
+
const t = document.querySelector("br");
|
|
148
|
+
e(t).toBeInTheDocument();
|
|
149
|
+
}), i("should handle unicode characters in alt text", () => {
|
|
150
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Photo © 2024 — Image™ 😊" } }));
|
|
151
|
+
const t = c.getByRole("img");
|
|
152
|
+
e(t).toHaveAttribute("alt", "Photo © 2024 — Image™ 😊");
|
|
153
|
+
}), i("should handle unicode characters in caption", () => {
|
|
154
|
+
r(/* @__PURE__ */ n(a, { image: { url: "test.jpg", altText: "Test", caption: "Caption © 2024 — Text™ 😊" } })), e(c.getByText(/Caption © 2024 — Text™ 😊/)).toBeInTheDocument();
|
|
155
|
+
}), i("should handle url with query parameters", () => {
|
|
156
|
+
r(/* @__PURE__ */ n(a, { image: { url: "https://example.com/image.jpg?w=500&h=300", altText: "Test" } }));
|
|
157
|
+
const t = c.getByRole("img");
|
|
158
|
+
e(t).toHaveAttribute("src", "https://example.com/image.jpg?w=500&h=300");
|
|
159
|
+
}), i("should handle data URLs", () => {
|
|
160
|
+
const t = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA";
|
|
161
|
+
r(/* @__PURE__ */ n(a, { image: { url: t, altText: "Test" } }));
|
|
162
|
+
const o = c.getByRole("img");
|
|
163
|
+
e(o).toHaveAttribute("src", t);
|
|
164
|
+
});
|
|
165
|
+
}), s("Integration", () => {
|
|
166
|
+
i("should render complete figure with all features", () => {
|
|
167
|
+
const { container: t } = r(
|
|
168
|
+
/* @__PURE__ */ n(
|
|
169
|
+
a,
|
|
170
|
+
{
|
|
171
|
+
image: {
|
|
172
|
+
url: "https://example.com/photo.jpg",
|
|
173
|
+
altText: "Beautiful Landscape Photo",
|
|
174
|
+
caption: 'A stunning view of the <strong>mountains</strong> at <a href="/sunset">sunset</a>.'
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
), o = t.querySelector("figure");
|
|
179
|
+
e(o).toHaveAttribute("title", "Beautiful Landscape Photo"), e(o).toHaveClass("figure");
|
|
180
|
+
const l = c.getByRole("img");
|
|
181
|
+
e(l).toHaveAttribute("src", "https://example.com/photo.jpg"), e(l).toHaveAttribute("alt", "Beautiful Landscape Photo");
|
|
182
|
+
const u = document.querySelector("figcaption");
|
|
183
|
+
e(u).toBeInTheDocument(), e(u).toHaveTextContent("A stunning view of the mountains at sunset."), e(document.querySelector("strong")).toHaveTextContent("mountains"), e(c.getByRole("link", { name: /sunset/i })).toHaveAttribute("href", "/sunset");
|
|
184
|
+
}), i("should update when props change", () => {
|
|
185
|
+
const { rerender: t } = r(/* @__PURE__ */ n(a, { image: { url: "image1.jpg", altText: "First" } }));
|
|
186
|
+
let o = c.getByRole("img");
|
|
187
|
+
e(o).toHaveAttribute("src", "image1.jpg"), e(o).toHaveAttribute("alt", "First"), e(document.querySelector("figcaption")).not.toBeInTheDocument(), t(/* @__PURE__ */ n(a, { image: { url: "image2.jpg", altText: "Second", caption: "New caption" } })), o = c.getByRole("img"), e(o).toHaveAttribute("src", "image2.jpg"), e(o).toHaveAttribute("alt", "Second"), e(document.querySelector("figcaption")).toBeInTheDocument(), e(c.getByText("New caption")).toBeInTheDocument();
|
|
188
|
+
}), i("should render multiple Figure components independently", () => {
|
|
189
|
+
const { container: t } = r(
|
|
190
|
+
/* @__PURE__ */ p(h, { children: [
|
|
191
|
+
/* @__PURE__ */ n(a, { image: { url: "image1.jpg", altText: "First Image", caption: "Caption 1" } }),
|
|
192
|
+
/* @__PURE__ */ n(a, { image: { url: "image2.jpg", altText: "Second Image", caption: "Caption 2" } })
|
|
193
|
+
] })
|
|
194
|
+
), o = t.querySelectorAll("figure");
|
|
195
|
+
e(o).toHaveLength(2), e(c.getByAltText("First Image")).toBeInTheDocument(), e(c.getByAltText("Second Image")).toBeInTheDocument(), e(c.getByText("Caption 1")).toBeInTheDocument(), e(c.getByText("Caption 2")).toBeInTheDocument();
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
});
|