@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,208 @@
|
|
|
1
|
+
var x = Object.defineProperty;
|
|
2
|
+
var f = (n, r, o) => r in n ? x(n, r, { enumerable: !0, configurable: !0, writable: !0, value: o }) : n[r] = o;
|
|
3
|
+
var d = (n, r, o) => f(n, typeof r != "symbol" ? r + "" : r, o);
|
|
4
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
5
|
+
import { v as g, d as u, b as q, a as v, i, r as a, g as t, s as y } from "../../react.esm-DLSrfVwM.mjs";
|
|
6
|
+
import "../../index-BVxBrkZB.mjs";
|
|
7
|
+
import { PromotionBlock as l } from "./PromotionBlock.js";
|
|
8
|
+
let p = null, s = null, _;
|
|
9
|
+
class H {
|
|
10
|
+
constructor(r, o) {
|
|
11
|
+
d(this, "observe", g.fn());
|
|
12
|
+
d(this, "unobserve", g.fn());
|
|
13
|
+
d(this, "disconnect", g.fn());
|
|
14
|
+
d(this, "root", null);
|
|
15
|
+
d(this, "rootMargin", "");
|
|
16
|
+
d(this, "thresholds", []);
|
|
17
|
+
p = r, s = this, _ = o;
|
|
18
|
+
}
|
|
19
|
+
takeRecords() {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
g.mock("./PromotionBlock.module.scss", () => ({
|
|
24
|
+
default: {
|
|
25
|
+
"promo-image": "promo-image-module",
|
|
26
|
+
"promo-image__text": "promo-image__text-module",
|
|
27
|
+
"promo-image--animate": "promo-image--animate-module",
|
|
28
|
+
"promo-copy": "promo-copy-module",
|
|
29
|
+
"promo-copy__header": "promo-copy__header-module",
|
|
30
|
+
"promo-copy__description": "promo-copy__description-module",
|
|
31
|
+
"promo-copy__link": "promo-copy__link-module",
|
|
32
|
+
"promo-copy--animate": "promo-copy--animate-module"
|
|
33
|
+
}
|
|
34
|
+
}));
|
|
35
|
+
u("PromotionBlock", () => {
|
|
36
|
+
const n = {
|
|
37
|
+
url: "https://example.com/promo.jpg",
|
|
38
|
+
altText: "Promotional Image",
|
|
39
|
+
text: "Special Offer",
|
|
40
|
+
aspectRatio: 1.7777777777777777
|
|
41
|
+
}, r = {
|
|
42
|
+
header: "Exclusive Deal",
|
|
43
|
+
description: "Get 50% off on all items this week only!",
|
|
44
|
+
linkText: "Shop Now",
|
|
45
|
+
href: "https://example.com/shop"
|
|
46
|
+
};
|
|
47
|
+
q(() => {
|
|
48
|
+
global.IntersectionObserver = H, p = null, s = null, _ = void 0;
|
|
49
|
+
}), v(() => {
|
|
50
|
+
g.clearAllMocks();
|
|
51
|
+
}), u("Basic Rendering", () => {
|
|
52
|
+
i("should render promotion-block container", () => {
|
|
53
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector("promotion-block");
|
|
54
|
+
t(e).toBeInTheDocument();
|
|
55
|
+
}), i("should render promo-image section", () => {
|
|
56
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector(".promo-image-module");
|
|
57
|
+
t(e).toBeInTheDocument();
|
|
58
|
+
}), i("should render promo-copy section", () => {
|
|
59
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector(".promo-copy-module");
|
|
60
|
+
t(e).toBeInTheDocument();
|
|
61
|
+
}), i("should render promo-image custom element", () => {
|
|
62
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector("promo-image");
|
|
63
|
+
t(e).toBeInTheDocument();
|
|
64
|
+
});
|
|
65
|
+
}), u("Image Rendering", () => {
|
|
66
|
+
i("should render image with correct src", () => {
|
|
67
|
+
a(/* @__PURE__ */ m(l, { image: n, promo: r }));
|
|
68
|
+
const o = y.getByRole("img");
|
|
69
|
+
t(o).toHaveAttribute("src", "https://example.com/promo.jpg");
|
|
70
|
+
}), i("should render image with correct alt text", () => {
|
|
71
|
+
a(/* @__PURE__ */ m(l, { image: n, promo: r }));
|
|
72
|
+
const o = y.getByRole("img");
|
|
73
|
+
t(o).toHaveAttribute("alt", "Promotional Image");
|
|
74
|
+
}), i("should render image text overlay", () => {
|
|
75
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector(".promo-image__text-module");
|
|
76
|
+
t(e).toHaveTextContent("Special Offer");
|
|
77
|
+
}), i("should wrap image in link", () => {
|
|
78
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector("promo-image"), c = e == null ? void 0 : e.querySelector("a");
|
|
79
|
+
t(c).toBeInTheDocument(), t(c).toHaveAttribute("href", "https://example.com/shop");
|
|
80
|
+
}), i("should set image link to open in new tab", () => {
|
|
81
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector("promo-image"), c = e == null ? void 0 : e.querySelector("a");
|
|
82
|
+
t(c).toHaveAttribute("target", "_blank"), t(c).toHaveAttribute("rel", "noreferrer");
|
|
83
|
+
});
|
|
84
|
+
}), u("Promo Copy Content", () => {
|
|
85
|
+
i("should render header text", () => {
|
|
86
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector(".promo-copy__header-module");
|
|
87
|
+
t(e).toHaveTextContent("Exclusive Deal");
|
|
88
|
+
}), i("should render header as h4 element", () => {
|
|
89
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector(".promo-copy__header-module");
|
|
90
|
+
t(e == null ? void 0 : e.tagName).toBe("H4");
|
|
91
|
+
}), i("should render description text", () => {
|
|
92
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector(".promo-copy__description-module");
|
|
93
|
+
t(e).toHaveTextContent("Get 50% off on all items this week only!");
|
|
94
|
+
}), i("should render description as paragraph element", () => {
|
|
95
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector(".promo-copy__description-module");
|
|
96
|
+
t(e == null ? void 0 : e.tagName).toBe("P");
|
|
97
|
+
}), i("should render link text", () => {
|
|
98
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector(".promo-copy__link-module");
|
|
99
|
+
t(e).toHaveTextContent("Shop Now");
|
|
100
|
+
}), i("should render link with correct href", () => {
|
|
101
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector(".promo-copy__link-module");
|
|
102
|
+
t(e).toHaveAttribute("href", "https://example.com/shop");
|
|
103
|
+
}), i("should set link to open in new tab", () => {
|
|
104
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector(".promo-copy__link-module");
|
|
105
|
+
t(e).toHaveAttribute("target", "_blank"), t(e).toHaveAttribute("rel", "noreferrer");
|
|
106
|
+
});
|
|
107
|
+
}), u("IntersectionObserver Setup", () => {
|
|
108
|
+
i("should create IntersectionObserver on mount", () => {
|
|
109
|
+
a(/* @__PURE__ */ m(l, { image: n, promo: r })), t(s).toBeTruthy();
|
|
110
|
+
}), i("should observe promo-image element", () => {
|
|
111
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector(".promo-image-module");
|
|
112
|
+
t(s == null ? void 0 : s.observe).toHaveBeenCalledWith(e);
|
|
113
|
+
}), i("should configure observer with correct options", () => {
|
|
114
|
+
a(/* @__PURE__ */ m(l, { image: n, promo: r })), t(_).toEqual({
|
|
115
|
+
root: null,
|
|
116
|
+
rootMargin: "0px",
|
|
117
|
+
threshold: 0.1
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}), u("Animation Triggering", () => {
|
|
121
|
+
i("should add animation class to promo-copy when intersecting", () => {
|
|
122
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector(".promo-copy-module"), c = o.querySelector(".promo-image-module");
|
|
123
|
+
p == null || p([
|
|
124
|
+
{ isIntersecting: !0, target: c }
|
|
125
|
+
], s), t(e.classList.contains("promo-copy--animate-module")).toBe(!0);
|
|
126
|
+
}), i("should add animation class to promo-image when intersecting", () => {
|
|
127
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector(".promo-image-module");
|
|
128
|
+
p == null || p([
|
|
129
|
+
{ isIntersecting: !0, target: e }
|
|
130
|
+
], s), t(e.classList.contains("promo-image--animate-module")).toBe(!0);
|
|
131
|
+
}), i("should not add animation classes when not intersecting", () => {
|
|
132
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector(".promo-copy-module"), c = o.querySelector(".promo-image-module");
|
|
133
|
+
p == null || p([
|
|
134
|
+
{ isIntersecting: !1, target: c }
|
|
135
|
+
], s), t(e.classList.contains("promo-copy--animate-module")).toBe(!1), t(c.classList.contains("promo-image--animate-module")).toBe(!1);
|
|
136
|
+
}), i("should unobserve element after animation triggers", () => {
|
|
137
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector(".promo-image-module");
|
|
138
|
+
p == null || p([
|
|
139
|
+
{ isIntersecting: !0, target: e }
|
|
140
|
+
], s), t(s == null ? void 0 : s.unobserve).toHaveBeenCalledWith(e);
|
|
141
|
+
}), i("should handle multiple intersection entries", () => {
|
|
142
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector(".promo-image-module");
|
|
143
|
+
p == null || p([
|
|
144
|
+
{ isIntersecting: !0, target: e },
|
|
145
|
+
{ isIntersecting: !1, target: e }
|
|
146
|
+
], s), t(e.classList.contains("promo-image--animate-module")).toBe(!0);
|
|
147
|
+
});
|
|
148
|
+
}), u("Cleanup", () => {
|
|
149
|
+
i("should disconnect observer on unmount", () => {
|
|
150
|
+
const { unmount: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r }));
|
|
151
|
+
o(), t(s == null ? void 0 : s.disconnect).toHaveBeenCalled();
|
|
152
|
+
}), i("should only disconnect once on unmount", () => {
|
|
153
|
+
const { unmount: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r }));
|
|
154
|
+
o(), t(s == null ? void 0 : s.disconnect).toHaveBeenCalledTimes(1);
|
|
155
|
+
});
|
|
156
|
+
}), u("Edge Cases", () => {
|
|
157
|
+
i("should handle empty image text", () => {
|
|
158
|
+
const o = {
|
|
159
|
+
...n,
|
|
160
|
+
text: ""
|
|
161
|
+
}, { container: e } = a(/* @__PURE__ */ m(l, { image: o, promo: r })), c = e.querySelector(".promo-image__text-module");
|
|
162
|
+
t(c).toHaveTextContent("");
|
|
163
|
+
}), i("should handle long description text", () => {
|
|
164
|
+
var h;
|
|
165
|
+
const o = {
|
|
166
|
+
...r,
|
|
167
|
+
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. ".repeat(10)
|
|
168
|
+
}, { container: e } = a(/* @__PURE__ */ m(l, { image: n, promo: o })), c = e.querySelector(".promo-copy__description-module");
|
|
169
|
+
t((h = c == null ? void 0 : c.textContent) == null ? void 0 : h.length).toBeGreaterThan(100);
|
|
170
|
+
}), i("should handle special characters in header", () => {
|
|
171
|
+
const o = {
|
|
172
|
+
...r,
|
|
173
|
+
header: "Save 50% & Get Free Shipping!"
|
|
174
|
+
}, { container: e } = a(/* @__PURE__ */ m(l, { image: n, promo: o })), c = e.querySelector(".promo-copy__header-module");
|
|
175
|
+
t(c).toHaveTextContent("Save 50% & Get Free Shipping!");
|
|
176
|
+
}), i("should handle missing alt text gracefully", () => {
|
|
177
|
+
const o = {
|
|
178
|
+
url: "https://example.com/promo.jpg",
|
|
179
|
+
altText: "",
|
|
180
|
+
text: "Special Offer",
|
|
181
|
+
aspectRatio: 1.7777777777777777
|
|
182
|
+
}, { container: e } = a(/* @__PURE__ */ m(l, { image: o, promo: r })), c = e.querySelector("img");
|
|
183
|
+
t(c).toHaveAttribute("alt", "");
|
|
184
|
+
}), i("should not trigger animation if refs are null", () => {
|
|
185
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector(".promo-image-module"), c = o.querySelector(".promo-copy-module");
|
|
186
|
+
c == null || c.remove(), t(() => {
|
|
187
|
+
p == null || p([
|
|
188
|
+
{ isIntersecting: !0, target: e }
|
|
189
|
+
], s);
|
|
190
|
+
}).not.toThrow();
|
|
191
|
+
});
|
|
192
|
+
}), u("Integration", () => {
|
|
193
|
+
i("should render complete promotion block with all content", () => {
|
|
194
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = y.getByRole("img");
|
|
195
|
+
t(e).toHaveAttribute("src", n.url), t(e).toHaveAttribute("alt", n.altText);
|
|
196
|
+
const c = o.querySelector(".promo-copy__header-module"), h = o.querySelector(".promo-copy__description-module"), S = o.querySelector(".promo-copy__link-module");
|
|
197
|
+
t(c).toHaveTextContent(r.header), t(h).toHaveTextContent(r.description), t(S).toHaveTextContent(r.linkText), t(S).toHaveAttribute("href", r.href);
|
|
198
|
+
}), i("should set up observer and trigger animation workflow", () => {
|
|
199
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector(".promo-image-module"), c = o.querySelector(".promo-copy-module");
|
|
200
|
+
t(s == null ? void 0 : s.observe).toHaveBeenCalledWith(e), t(e.classList.contains("promo-image--animate-module")).toBe(!1), t(c.classList.contains("promo-copy--animate-module")).toBe(!1), p == null || p([
|
|
201
|
+
{ isIntersecting: !0, target: e }
|
|
202
|
+
], s), t(e.classList.contains("promo-image--animate-module")).toBe(!0), t(c.classList.contains("promo-copy--animate-module")).toBe(!0), t(s == null ? void 0 : s.unobserve).toHaveBeenCalledWith(e);
|
|
203
|
+
}), i("should maintain link consistency across image and copy", () => {
|
|
204
|
+
const { container: o } = a(/* @__PURE__ */ m(l, { image: n, promo: r })), e = o.querySelector("promo-image a"), c = o.querySelector(".promo-copy__link-module");
|
|
205
|
+
t(e).toHaveAttribute("href", r.href), t(c).toHaveAttribute("href", r.href), t(e).toHaveAttribute("target", "_blank"), t(c).toHaveAttribute("target", "_blank");
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
});
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { jsx as e, jsxs as h, Fragment as g } from "react/jsx-runtime";
|
|
2
|
+
import { v as m, d as s, a as w, i as n, r as d, g as o, s as i } from "../../react.esm-DLSrfVwM.mjs";
|
|
3
|
+
import "../../index-BVxBrkZB.mjs";
|
|
4
|
+
import { PromotionsRowBlock as r } from "./PromotionsRowBlock.js";
|
|
5
|
+
m.mock("../EqualSizeFlexRow", () => ({
|
|
6
|
+
default: ({ children: t, gap: l }) => /* @__PURE__ */ e("div", { "data-gap": l, "data-testid": "equal-size-flex-row", children: t })
|
|
7
|
+
}));
|
|
8
|
+
m.mock("./PromotionsRowBlock.module.scss", () => ({
|
|
9
|
+
default: {}
|
|
10
|
+
}));
|
|
11
|
+
s("PromotionsRowBlock", () => {
|
|
12
|
+
w(() => {
|
|
13
|
+
m.clearAllMocks();
|
|
14
|
+
}), s("Basic Rendering", () => {
|
|
15
|
+
n("should render promotions-row-block container", () => {
|
|
16
|
+
const { container: t } = d(
|
|
17
|
+
/* @__PURE__ */ e(r, { children: /* @__PURE__ */ e("div", { children: "Test Child" }) })
|
|
18
|
+
), l = t.querySelector("promotions-row-block");
|
|
19
|
+
o(l).toBeInTheDocument();
|
|
20
|
+
}), n("should render EqualSizeFlexRow component", () => {
|
|
21
|
+
d(
|
|
22
|
+
/* @__PURE__ */ e(r, { children: /* @__PURE__ */ e("div", { children: "Test Child" }) })
|
|
23
|
+
);
|
|
24
|
+
const t = i.getByTestId("equal-size-flex-row");
|
|
25
|
+
o(t).toBeInTheDocument();
|
|
26
|
+
}), n("should wrap children in EqualSizeFlexRow", () => {
|
|
27
|
+
const { container: t } = d(
|
|
28
|
+
/* @__PURE__ */ e(r, { children: /* @__PURE__ */ e("div", { children: "Test Child" }) })
|
|
29
|
+
), l = t.querySelector("promotions-row-block"), c = i.getByTestId("equal-size-flex-row");
|
|
30
|
+
o(l).toContainElement(c);
|
|
31
|
+
});
|
|
32
|
+
}), s("Children Rendering", () => {
|
|
33
|
+
n("should render single child", () => {
|
|
34
|
+
d(
|
|
35
|
+
/* @__PURE__ */ e(r, { children: /* @__PURE__ */ e("div", { "data-testid": "child-1", children: "Child 1" }) })
|
|
36
|
+
), o(i.getByTestId("child-1")).toBeInTheDocument(), o(i.getByText("Child 1")).toBeInTheDocument();
|
|
37
|
+
}), n("should render multiple children", () => {
|
|
38
|
+
d(
|
|
39
|
+
/* @__PURE__ */ h(r, { children: [
|
|
40
|
+
/* @__PURE__ */ e("div", { "data-testid": "child-1", children: "Child 1" }),
|
|
41
|
+
/* @__PURE__ */ e("div", { "data-testid": "child-2", children: "Child 2" }),
|
|
42
|
+
/* @__PURE__ */ e("div", { "data-testid": "child-3", children: "Child 3" })
|
|
43
|
+
] })
|
|
44
|
+
), o(i.getByTestId("child-1")).toBeInTheDocument(), o(i.getByTestId("child-2")).toBeInTheDocument(), o(i.getByTestId("child-3")).toBeInTheDocument();
|
|
45
|
+
}), n("should render text content", () => {
|
|
46
|
+
d(
|
|
47
|
+
/* @__PURE__ */ e(r, { children: "Simple text content" })
|
|
48
|
+
), o(i.getByText("Simple text content")).toBeInTheDocument();
|
|
49
|
+
}), n("should render complex nested components", () => {
|
|
50
|
+
d(
|
|
51
|
+
/* @__PURE__ */ e(r, { children: /* @__PURE__ */ h("div", { "data-testid": "complex-child", children: [
|
|
52
|
+
/* @__PURE__ */ e("h3", { children: "Title" }),
|
|
53
|
+
/* @__PURE__ */ e("p", { children: "Description" }),
|
|
54
|
+
/* @__PURE__ */ e("button", { children: "Action" })
|
|
55
|
+
] }) })
|
|
56
|
+
), o(i.getByRole("heading", { name: "Title" })).toBeInTheDocument(), o(i.getByText("Description")).toBeInTheDocument(), o(i.getByRole("button", { name: "Action" })).toBeInTheDocument();
|
|
57
|
+
}), n("should preserve children order", () => {
|
|
58
|
+
d(
|
|
59
|
+
/* @__PURE__ */ h(r, { children: [
|
|
60
|
+
/* @__PURE__ */ e("div", { "data-testid": "first", children: "First" }),
|
|
61
|
+
/* @__PURE__ */ e("div", { "data-testid": "second", children: "Second" }),
|
|
62
|
+
/* @__PURE__ */ e("div", { "data-testid": "third", children: "Third" })
|
|
63
|
+
] })
|
|
64
|
+
);
|
|
65
|
+
const t = i.getByTestId("equal-size-flex-row"), l = Array.from(t.children);
|
|
66
|
+
o(l[0]).toHaveAttribute("data-testid", "first"), o(l[1]).toHaveAttribute("data-testid", "second"), o(l[2]).toHaveAttribute("data-testid", "third");
|
|
67
|
+
});
|
|
68
|
+
}), s("Gap Prop", () => {
|
|
69
|
+
n("should use default gap when not provided", () => {
|
|
70
|
+
d(
|
|
71
|
+
/* @__PURE__ */ e(r, { children: /* @__PURE__ */ e("div", { children: "Child" }) })
|
|
72
|
+
);
|
|
73
|
+
const t = i.getByTestId("equal-size-flex-row");
|
|
74
|
+
o(t).toHaveAttribute("data-gap", "1.5rem");
|
|
75
|
+
}), n("should apply custom gap value", () => {
|
|
76
|
+
d(
|
|
77
|
+
/* @__PURE__ */ e(r, { gap: "2rem", children: /* @__PURE__ */ e("div", { children: "Child" }) })
|
|
78
|
+
);
|
|
79
|
+
const t = i.getByTestId("equal-size-flex-row");
|
|
80
|
+
o(t).toHaveAttribute("data-gap", "2rem");
|
|
81
|
+
}), n("should accept gap in pixels", () => {
|
|
82
|
+
d(
|
|
83
|
+
/* @__PURE__ */ e(r, { gap: "24px", children: /* @__PURE__ */ e("div", { children: "Child" }) })
|
|
84
|
+
);
|
|
85
|
+
const t = i.getByTestId("equal-size-flex-row");
|
|
86
|
+
o(t).toHaveAttribute("data-gap", "24px");
|
|
87
|
+
}), n("should accept gap in em units", () => {
|
|
88
|
+
d(
|
|
89
|
+
/* @__PURE__ */ e(r, { gap: "1.5em", children: /* @__PURE__ */ e("div", { children: "Child" }) })
|
|
90
|
+
);
|
|
91
|
+
const t = i.getByTestId("equal-size-flex-row");
|
|
92
|
+
o(t).toHaveAttribute("data-gap", "1.5em");
|
|
93
|
+
}), n("should accept gap as zero", () => {
|
|
94
|
+
d(
|
|
95
|
+
/* @__PURE__ */ e(r, { gap: "0", children: /* @__PURE__ */ e("div", { children: "Child" }) })
|
|
96
|
+
);
|
|
97
|
+
const t = i.getByTestId("equal-size-flex-row");
|
|
98
|
+
o(t).toHaveAttribute("data-gap", "0");
|
|
99
|
+
}), n("should pass gap prop to EqualSizeFlexRow", () => {
|
|
100
|
+
const t = "3rem";
|
|
101
|
+
d(
|
|
102
|
+
/* @__PURE__ */ e(r, { gap: t, children: /* @__PURE__ */ e("div", { children: "Child" }) })
|
|
103
|
+
);
|
|
104
|
+
const l = i.getByTestId("equal-size-flex-row");
|
|
105
|
+
o(l).toHaveAttribute("data-gap", t);
|
|
106
|
+
});
|
|
107
|
+
}), s("Component Structure", () => {
|
|
108
|
+
n("should have single promotions-row-block element", () => {
|
|
109
|
+
const { container: t } = d(
|
|
110
|
+
/* @__PURE__ */ e(r, { children: /* @__PURE__ */ e("div", { children: "Child" }) })
|
|
111
|
+
), l = t.querySelectorAll("promotions-row-block");
|
|
112
|
+
o(l).toHaveLength(1);
|
|
113
|
+
}), n("should have single EqualSizeFlexRow inside promotions-row-block", () => {
|
|
114
|
+
const { container: t } = d(
|
|
115
|
+
/* @__PURE__ */ e(r, { children: /* @__PURE__ */ e("div", { children: "Child" }) })
|
|
116
|
+
), l = t.querySelector("promotions-row-block"), c = l == null ? void 0 : l.querySelectorAll('[data-testid="equal-size-flex-row"]');
|
|
117
|
+
o(c).toHaveLength(1);
|
|
118
|
+
}), n("should maintain hierarchy: promotions-row-block > EqualSizeFlexRow > children", () => {
|
|
119
|
+
const { container: t } = d(
|
|
120
|
+
/* @__PURE__ */ e(r, { children: /* @__PURE__ */ e("div", { "data-testid": "test-child", children: "Child" }) })
|
|
121
|
+
), l = t.querySelector("promotions-row-block"), c = i.getByTestId("equal-size-flex-row"), a = i.getByTestId("test-child");
|
|
122
|
+
o(l).toContainElement(c), o(c).toContainElement(a);
|
|
123
|
+
});
|
|
124
|
+
}), s("Edge Cases", () => {
|
|
125
|
+
n("should handle empty children", () => {
|
|
126
|
+
const { container: t } = d(
|
|
127
|
+
/* @__PURE__ */ e(r, { children: null })
|
|
128
|
+
), l = t.querySelector("promotions-row-block");
|
|
129
|
+
o(l).toBeInTheDocument();
|
|
130
|
+
}), n("should handle undefined children", () => {
|
|
131
|
+
const { container: t } = d(
|
|
132
|
+
/* @__PURE__ */ e(r, { children: void 0 })
|
|
133
|
+
), l = t.querySelector("promotions-row-block");
|
|
134
|
+
o(l).toBeInTheDocument();
|
|
135
|
+
}), n("should handle conditional children", () => {
|
|
136
|
+
d(
|
|
137
|
+
/* @__PURE__ */ h(r, { children: [
|
|
138
|
+
/* @__PURE__ */ e("div", { "data-testid": "conditional-child", children: "Visible" }),
|
|
139
|
+
!1
|
|
140
|
+
] })
|
|
141
|
+
), o(i.getByTestId("conditional-child")).toBeInTheDocument(), o(i.queryByTestId("hidden-child")).not.toBeInTheDocument();
|
|
142
|
+
}), n("should handle array of children", () => {
|
|
143
|
+
const t = ["Item 1", "Item 2", "Item 3"];
|
|
144
|
+
d(
|
|
145
|
+
/* @__PURE__ */ e(r, { children: t.map(
|
|
146
|
+
(l, c) => /* @__PURE__ */ e("div", { "data-testid": `item-${c}`, children: l }, c)
|
|
147
|
+
) })
|
|
148
|
+
), t.forEach((l, c) => {
|
|
149
|
+
o(i.getByTestId(`item-${c}`)).toHaveTextContent(l);
|
|
150
|
+
});
|
|
151
|
+
}), n("should handle fragments", () => {
|
|
152
|
+
d(
|
|
153
|
+
/* @__PURE__ */ e(r, { children: /* @__PURE__ */ h(g, { children: [
|
|
154
|
+
/* @__PURE__ */ e("div", { "data-testid": "fragment-child-1", children: "Child 1" }),
|
|
155
|
+
/* @__PURE__ */ e("div", { "data-testid": "fragment-child-2", children: "Child 2" })
|
|
156
|
+
] }) })
|
|
157
|
+
), o(i.getByTestId("fragment-child-1")).toBeInTheDocument(), o(i.getByTestId("fragment-child-2")).toBeInTheDocument();
|
|
158
|
+
}), n("should handle very long gap value", () => {
|
|
159
|
+
d(
|
|
160
|
+
/* @__PURE__ */ e(r, { gap: "10rem", children: /* @__PURE__ */ e("div", { children: "Child" }) })
|
|
161
|
+
);
|
|
162
|
+
const t = i.getByTestId("equal-size-flex-row");
|
|
163
|
+
o(t).toHaveAttribute("data-gap", "10rem");
|
|
164
|
+
}), n("should handle gap with calc() function", () => {
|
|
165
|
+
d(
|
|
166
|
+
/* @__PURE__ */ e(r, { gap: "calc(1rem + 2px)", children: /* @__PURE__ */ e("div", { children: "Child" }) })
|
|
167
|
+
);
|
|
168
|
+
const t = i.getByTestId("equal-size-flex-row");
|
|
169
|
+
o(t).toHaveAttribute("data-gap", "calc(1rem + 2px)");
|
|
170
|
+
});
|
|
171
|
+
}), s("Integration", () => {
|
|
172
|
+
n("should render complete promotions row with multiple children and custom gap", () => {
|
|
173
|
+
d(
|
|
174
|
+
/* @__PURE__ */ h(r, { gap: "2.5rem", children: [
|
|
175
|
+
/* @__PURE__ */ e("div", { "data-testid": "promo-1", children: "Promo 1" }),
|
|
176
|
+
/* @__PURE__ */ e("div", { "data-testid": "promo-2", children: "Promo 2" }),
|
|
177
|
+
/* @__PURE__ */ e("div", { "data-testid": "promo-3", children: "Promo 3" })
|
|
178
|
+
] })
|
|
179
|
+
);
|
|
180
|
+
const t = document.querySelector("promotions-row-block"), l = i.getByTestId("equal-size-flex-row");
|
|
181
|
+
o(t).toBeInTheDocument(), o(l).toHaveAttribute("data-gap", "2.5rem"), o(i.getByTestId("promo-1")).toBeInTheDocument(), o(i.getByTestId("promo-2")).toBeInTheDocument(), o(i.getByTestId("promo-3")).toBeInTheDocument();
|
|
182
|
+
}), n("should work with default gap and single child", () => {
|
|
183
|
+
d(
|
|
184
|
+
/* @__PURE__ */ e(r, { children: /* @__PURE__ */ e("div", { "data-testid": "single-promo", children: "Single Promotion" }) })
|
|
185
|
+
);
|
|
186
|
+
const t = i.getByTestId("equal-size-flex-row");
|
|
187
|
+
o(t).toHaveAttribute("data-gap", "1.5rem"), o(i.getByTestId("single-promo")).toBeInTheDocument();
|
|
188
|
+
}), n("should properly nest all elements", () => {
|
|
189
|
+
const { container: t } = d(
|
|
190
|
+
/* @__PURE__ */ e(r, { gap: "1rem", children: /* @__PURE__ */ h("div", { "data-testid": "nested-child", children: [
|
|
191
|
+
/* @__PURE__ */ e("h4", { children: "Nested Title" }),
|
|
192
|
+
/* @__PURE__ */ e("p", { children: "Nested Content" })
|
|
193
|
+
] }) })
|
|
194
|
+
), l = t.querySelector("promotions-row-block"), c = i.getByTestId("equal-size-flex-row"), a = i.getByTestId("nested-child"), u = i.getByRole("heading", { name: "Nested Title" }), p = i.getByText("Nested Content");
|
|
195
|
+
o(l).toContainElement(c), o(c).toContainElement(a), o(a).toContainElement(u), o(a).toContainElement(p);
|
|
196
|
+
});
|
|
197
|
+
}), s("Type Safety", () => {
|
|
198
|
+
n("should accept valid gap string values", () => {
|
|
199
|
+
["1rem", "2em", "16px", "0", "calc(1rem + 2px)"].forEach((l) => {
|
|
200
|
+
const { unmount: c } = d(
|
|
201
|
+
/* @__PURE__ */ e(r, { gap: l, children: /* @__PURE__ */ e("div", { children: "Child" }) })
|
|
202
|
+
), a = i.getByTestId("equal-size-flex-row");
|
|
203
|
+
o(a).toHaveAttribute("data-gap", l), c();
|
|
204
|
+
});
|
|
205
|
+
}), n("should accept ReactNode children", () => {
|
|
206
|
+
[
|
|
207
|
+
"text string",
|
|
208
|
+
123,
|
|
209
|
+
/* @__PURE__ */ e("div", { children: "Element" }, "1"),
|
|
210
|
+
[/* @__PURE__ */ e("div", { children: "Array Item 1" }, "2"), /* @__PURE__ */ e("div", { children: "Array Item 2" }, "3")],
|
|
211
|
+
null,
|
|
212
|
+
void 0
|
|
213
|
+
].forEach((l) => {
|
|
214
|
+
const { unmount: c, container: a } = d(
|
|
215
|
+
/* @__PURE__ */ e(r, { children: l })
|
|
216
|
+
), u = a.querySelector("promotions-row-block");
|
|
217
|
+
o(u).toBeInTheDocument(), c();
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
});
|