@scrippsproduct/networks-ui-library 2.0.5-aplha.1 → 2.0.5
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/components/AnchorTag/AnchorTag.test.js +9 -19
- package/dist/components/BCVideoPlayer/BCVideoPlayer.test.js +3 -3
- package/dist/components/CarouselSlide/CarouselSlide.test.js +58 -57
- package/dist/components/FindUs/FindUs.js +122 -93
- package/dist/components/ImageCard/ImageCardCore.test.js +2 -2
- package/dist/components/PromotionsRowModule/PromotionsRowModule.test.js +163 -149
- package/package.json +1 -1
|
@@ -117,12 +117,12 @@ c("AnchorTag", () => {
|
|
|
117
117
|
};
|
|
118
118
|
n("should render image when image prop is provided", () => {
|
|
119
119
|
i(/* @__PURE__ */ a(o, { href: "/", image: l, label: "Image Link" }));
|
|
120
|
-
const e = s.getByRole("
|
|
120
|
+
const e = s.getByRole("presentation");
|
|
121
121
|
t(e).toBeInTheDocument(), t(e).toHaveAttribute("src", "https://example.com/image.jpg");
|
|
122
|
-
}), n("should use label as alt text for image", () => {
|
|
122
|
+
}), n("should not use label as alt text for image", () => {
|
|
123
123
|
i(/* @__PURE__ */ a(o, { href: "/", image: l, label: "Test Label" }));
|
|
124
|
-
const e = s.getByRole("
|
|
125
|
-
t(e).toHaveAttribute("alt", "
|
|
124
|
+
const e = s.getByRole("presentation");
|
|
125
|
+
t(e).toHaveAttribute("alt", "");
|
|
126
126
|
}), n("should render label in sr-only span when image is present", () => {
|
|
127
127
|
const { container: e } = i(/* @__PURE__ */ a(o, { href: "/", image: l, label: "Screen Reader Text" })), r = e.querySelector(".sr-only");
|
|
128
128
|
t(r).toBeInTheDocument(), t(r == null ? void 0 : r.textContent).toBe("Screen Reader Text");
|
|
@@ -349,16 +349,6 @@ c("AnchorTag", () => {
|
|
|
349
349
|
height: 200
|
|
350
350
|
}, { container: e } = i(/* @__PURE__ */ a(o, { image: l, label: "Accessible Text" })), r = e.querySelector(".sr-only");
|
|
351
351
|
t(r).toHaveTextContent("Accessible Text");
|
|
352
|
-
}), n("should have proper alt text on image", () => {
|
|
353
|
-
i(/* @__PURE__ */ a(o, { image: {
|
|
354
|
-
url: "https://example.com/image.jpg",
|
|
355
|
-
altText: "Test",
|
|
356
|
-
aspectRatio: 1.5,
|
|
357
|
-
width: 300,
|
|
358
|
-
height: 200
|
|
359
|
-
}, label: "Alt Text Here" }));
|
|
360
|
-
const e = s.getByRole("img");
|
|
361
|
-
t(e).toHaveAttribute("alt", "Alt Text Here");
|
|
362
352
|
}), n("should properly indicate external links with rel noreferrer", () => {
|
|
363
353
|
i(/* @__PURE__ */ a(o, { href: "https://example.com", label: "External", type: "external-link" }));
|
|
364
354
|
const l = s.getByRole("link");
|
|
@@ -379,7 +369,7 @@ c("AnchorTag", () => {
|
|
|
379
369
|
}
|
|
380
370
|
]
|
|
381
371
|
}, label: "Image with Sources" }));
|
|
382
|
-
const e = s.getByRole("
|
|
372
|
+
const e = s.getByRole("presentation");
|
|
383
373
|
t(e).toHaveAttribute("src", "https://example.com/image.jpg");
|
|
384
374
|
}), n("should handle image with caption", () => {
|
|
385
375
|
i(/* @__PURE__ */ a(o, { image: {
|
|
@@ -390,7 +380,7 @@ c("AnchorTag", () => {
|
|
|
390
380
|
height: 200,
|
|
391
381
|
caption: "This is a caption"
|
|
392
382
|
}, label: "Captioned Image" }));
|
|
393
|
-
const e = s.getByRole("
|
|
383
|
+
const e = s.getByRole("presentation");
|
|
394
384
|
t(e).toBeInTheDocument();
|
|
395
385
|
}), n("should handle image with text property", () => {
|
|
396
386
|
i(/* @__PURE__ */ a(o, { image: {
|
|
@@ -401,7 +391,7 @@ c("AnchorTag", () => {
|
|
|
401
391
|
height: 200,
|
|
402
392
|
text: "Additional text"
|
|
403
393
|
}, label: "Image with Text" }));
|
|
404
|
-
const e = s.getByRole("
|
|
394
|
+
const e = s.getByRole("presentation");
|
|
405
395
|
t(e).toBeInTheDocument();
|
|
406
396
|
});
|
|
407
397
|
}), c("Integration Tests", () => {
|
|
@@ -456,8 +446,8 @@ c("AnchorTag", () => {
|
|
|
456
446
|
);
|
|
457
447
|
const e = s.getByRole("link");
|
|
458
448
|
t(e).toHaveClass("logo-link"), t(e).toHaveClass("anchor-tag--image"), t(e).toHaveAttribute("href", "/"), t(e).toHaveAttribute("target", "_self"), t(e).toHaveStyle({ "--anchor-tag-image-ratio": "2" });
|
|
459
|
-
const r = s.getByRole("
|
|
460
|
-
t(r).toHaveAttribute("src", "https://example.com/logo.png"), t(r).toHaveAttribute("alt", "
|
|
449
|
+
const r = s.getByRole("presentation");
|
|
450
|
+
t(r).toHaveAttribute("src", "https://example.com/logo.png"), t(r).toHaveAttribute("alt", "");
|
|
461
451
|
});
|
|
462
452
|
});
|
|
463
453
|
});
|
|
@@ -20,8 +20,8 @@ d("BCVideoPlayer", () => {
|
|
|
20
20
|
r(o).toBeInTheDocument();
|
|
21
21
|
}), a("should render wrapper with correct id", () => {
|
|
22
22
|
c(/* @__PURE__ */ t(n, { bcId: "123456" }));
|
|
23
|
-
const e = document.getElementById("video-player-wrapper");
|
|
24
|
-
r(e).toHaveAttribute("id", "video-player-wrapper");
|
|
23
|
+
const e = document.getElementById("video-player-wrapper-bc-player");
|
|
24
|
+
r(e).toHaveAttribute("id", "video-player-wrapper-bc-player");
|
|
25
25
|
}), a("should render wrapper with correct class", () => {
|
|
26
26
|
const { container: e } = c(/* @__PURE__ */ t(n, { bcId: "123456" })), o = e.querySelector(".video-player__wrapper");
|
|
27
27
|
r(o).toHaveClass("video-player__wrapper");
|
|
@@ -222,7 +222,7 @@ d("BCVideoPlayer", () => {
|
|
|
222
222
|
}
|
|
223
223
|
)
|
|
224
224
|
), p = o.querySelector(".video-player__wrapper");
|
|
225
|
-
r(p).toBeInTheDocument(), r(p).toHaveAttribute("id", "video-player-wrapper");
|
|
225
|
+
r(p).toBeInTheDocument(), r(p).toHaveAttribute("id", "video-player-wrapper-custom-player");
|
|
226
226
|
}), a("should handle keyboard events with all props", () => {
|
|
227
227
|
const e = l.fn(), { container: o } = c(
|
|
228
228
|
/* @__PURE__ */ t(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import { v as y, d, b as p, i as r, r as a,
|
|
2
|
+
import { v as y, d, b as p, i as r, r as a, w as u, g as i, s as c } from "../../react.esm-S2Q_NbYC.mjs";
|
|
3
3
|
import "../../index-BZQHStQa.mjs";
|
|
4
4
|
import { CarouselSlide as n } from "./CarouselSlide.js";
|
|
5
5
|
y.mock("@scrippsproduct/console-logger", () => ({
|
|
@@ -36,51 +36,52 @@ d("CarouselSlide", () => {
|
|
|
36
36
|
}), d("Basic Rendering", () => {
|
|
37
37
|
r("should render slide with basic props", async () => {
|
|
38
38
|
const { container: t } = a(
|
|
39
|
-
/* @__PURE__ */ l(n, {
|
|
40
|
-
)
|
|
41
|
-
|
|
39
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: s })
|
|
40
|
+
);
|
|
41
|
+
await u(() => {
|
|
42
|
+
const e = t.querySelector("li");
|
|
42
43
|
i(e).toBeInTheDocument();
|
|
43
44
|
});
|
|
44
45
|
}), r("should render with correct aria-label", () => {
|
|
45
46
|
const { container: t } = a(
|
|
46
|
-
/* @__PURE__ */ l(n, {
|
|
47
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: s })
|
|
47
48
|
), e = t.querySelector("li");
|
|
48
49
|
i(e).toHaveAttribute("aria-label", "1 of 3");
|
|
49
50
|
}), r("should render with aria-roledescription", () => {
|
|
50
51
|
const { container: t } = a(
|
|
51
|
-
/* @__PURE__ */ l(n, {
|
|
52
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: s })
|
|
52
53
|
), e = t.querySelector("li");
|
|
53
54
|
i(e).toHaveAttribute("aria-roledescription", "carousel-item");
|
|
54
55
|
}), r("should render with data-index attribute", () => {
|
|
55
56
|
const { container: t } = a(
|
|
56
|
-
/* @__PURE__ */ l(n, {
|
|
57
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 2, slide: s })
|
|
57
58
|
), e = t.querySelector("li");
|
|
58
59
|
i(e).toHaveAttribute("data-index", "2");
|
|
59
60
|
}), r("should render with correct index for different positions", () => {
|
|
60
61
|
const { container: t } = a(
|
|
61
|
-
/* @__PURE__ */ l(n, {
|
|
62
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 5, slide: s })
|
|
62
63
|
), e = t.querySelector("li");
|
|
63
64
|
i(e).toHaveAttribute("data-index", "5");
|
|
64
65
|
});
|
|
65
66
|
}), d("Inert Attribute", () => {
|
|
66
67
|
r("should not have inert attribute when slide is current", () => {
|
|
67
68
|
const { container: t } = a(
|
|
68
|
-
/* @__PURE__ */ l(n, {
|
|
69
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: s })
|
|
69
70
|
), e = t.querySelector("li");
|
|
70
71
|
i(e).not.toHaveAttribute("inert");
|
|
71
72
|
}), r("should have inert attribute when slide is not current", () => {
|
|
72
73
|
const { container: t } = a(
|
|
73
|
-
/* @__PURE__ */ l(n, {
|
|
74
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 1, slide: s })
|
|
74
75
|
), e = t.querySelector("li");
|
|
75
76
|
i(e).toHaveAttribute("inert");
|
|
76
77
|
}), r("should have inert attribute when currentIndex is greater than index", () => {
|
|
77
78
|
const { container: t } = a(
|
|
78
|
-
/* @__PURE__ */ l(n, {
|
|
79
|
+
/* @__PURE__ */ l(n, { currentIndex: 2, index: 0, slide: s })
|
|
79
80
|
), e = t.querySelector("li");
|
|
80
81
|
i(e).toHaveAttribute("inert");
|
|
81
82
|
}), r("should not have inert when indices match at higher values", () => {
|
|
82
83
|
const { container: t } = a(
|
|
83
|
-
/* @__PURE__ */ l(n, {
|
|
84
|
+
/* @__PURE__ */ l(n, { currentIndex: 5, index: 5, slide: s })
|
|
84
85
|
), e = t.querySelector("li");
|
|
85
86
|
i(e).not.toHaveAttribute("inert");
|
|
86
87
|
});
|
|
@@ -90,10 +91,10 @@ d("CarouselSlide", () => {
|
|
|
90
91
|
/* @__PURE__ */ l(
|
|
91
92
|
n,
|
|
92
93
|
{
|
|
93
|
-
|
|
94
|
-
index: 0,
|
|
94
|
+
variableHeight: !0,
|
|
95
95
|
currentIndex: 0,
|
|
96
|
-
|
|
96
|
+
index: 0,
|
|
97
|
+
slide: s
|
|
97
98
|
}
|
|
98
99
|
)
|
|
99
100
|
), e = t.querySelector("li");
|
|
@@ -103,9 +104,9 @@ d("CarouselSlide", () => {
|
|
|
103
104
|
/* @__PURE__ */ l(
|
|
104
105
|
n,
|
|
105
106
|
{
|
|
106
|
-
slide: s,
|
|
107
|
-
index: 0,
|
|
108
107
|
currentIndex: 0,
|
|
108
|
+
index: 0,
|
|
109
|
+
slide: s,
|
|
109
110
|
variableHeight: !1
|
|
110
111
|
}
|
|
111
112
|
)
|
|
@@ -113,14 +114,14 @@ d("CarouselSlide", () => {
|
|
|
113
114
|
i(e).not.toHaveClass("slide--variable-height");
|
|
114
115
|
}), r("should not apply variable height class by default", () => {
|
|
115
116
|
const { container: t } = a(
|
|
116
|
-
/* @__PURE__ */ l(n, {
|
|
117
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: s })
|
|
117
118
|
), e = t.querySelector("li");
|
|
118
119
|
i(e).not.toHaveClass("slide--variable-height");
|
|
119
120
|
});
|
|
120
121
|
}), d("CSS Classes", () => {
|
|
121
122
|
r("should always have slide class", () => {
|
|
122
123
|
const { container: t } = a(
|
|
123
|
-
/* @__PURE__ */ l(n, {
|
|
124
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: s })
|
|
124
125
|
), e = t.querySelector("li");
|
|
125
126
|
i(e).toHaveClass("slide");
|
|
126
127
|
}), r("should have multiple classes when variableHeight is true", () => {
|
|
@@ -128,10 +129,10 @@ d("CarouselSlide", () => {
|
|
|
128
129
|
/* @__PURE__ */ l(
|
|
129
130
|
n,
|
|
130
131
|
{
|
|
131
|
-
|
|
132
|
-
index: 0,
|
|
132
|
+
variableHeight: !0,
|
|
133
133
|
currentIndex: 0,
|
|
134
|
-
|
|
134
|
+
index: 0,
|
|
135
|
+
slide: s
|
|
135
136
|
}
|
|
136
137
|
)
|
|
137
138
|
), e = t.querySelector("li");
|
|
@@ -139,29 +140,29 @@ d("CarouselSlide", () => {
|
|
|
139
140
|
});
|
|
140
141
|
}), d("Layout Loading", () => {
|
|
141
142
|
r("should render layout component when layout is found", async () => {
|
|
142
|
-
a(/* @__PURE__ */ l(n, { slide: {
|
|
143
|
+
a(/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: {
|
|
143
144
|
ariaLabel: "1 of 3",
|
|
144
145
|
cells: [{ id: 1, props: { title: "Figure Title" }, layout: "Figure" }],
|
|
145
146
|
layout: "Figure"
|
|
146
|
-
}
|
|
147
|
+
} })), await u(() => {
|
|
147
148
|
const e = c.getByTestId("figure-layout");
|
|
148
149
|
i(e).toBeInTheDocument(), i(e).toHaveTextContent("Figure Title");
|
|
149
150
|
});
|
|
150
151
|
}), r("should render text layout when layout is Text", async () => {
|
|
151
|
-
a(/* @__PURE__ */ l(n, { slide: {
|
|
152
|
+
a(/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: {
|
|
152
153
|
ariaLabel: "1 of 3",
|
|
153
154
|
cells: [{ id: 1, props: { content: "Text Content" }, layout: "Text" }],
|
|
154
155
|
layout: "Text"
|
|
155
|
-
}
|
|
156
|
+
} })), await u(() => {
|
|
156
157
|
const e = c.getByTestId("text-layout");
|
|
157
158
|
i(e).toBeInTheDocument(), i(e).toHaveTextContent("Text Content");
|
|
158
159
|
});
|
|
159
160
|
}), r("should render video layout when layout is Video", async () => {
|
|
160
|
-
a(/* @__PURE__ */ l(n, { slide: {
|
|
161
|
+
a(/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: {
|
|
161
162
|
ariaLabel: "1 of 3",
|
|
162
163
|
cells: [{ id: 1, props: { videoId: "video-123" }, layout: "Video" }],
|
|
163
164
|
layout: "Video"
|
|
164
|
-
}
|
|
165
|
+
} })), await u(() => {
|
|
165
166
|
const e = c.getByTestId("video-layout");
|
|
166
167
|
i(e).toBeInTheDocument(), i(e).toHaveTextContent("video-123");
|
|
167
168
|
});
|
|
@@ -171,14 +172,14 @@ d("CarouselSlide", () => {
|
|
|
171
172
|
cells: [{ id: 1, props: { title: "Test" }, layout: "Unknown" }],
|
|
172
173
|
layout: "Unknown"
|
|
173
174
|
}, { container: e } = a(
|
|
174
|
-
/* @__PURE__ */ l(n, {
|
|
175
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: t })
|
|
175
176
|
), o = e.querySelector("li");
|
|
176
177
|
i(o).toBeInTheDocument(), i(o == null ? void 0 : o.children.length).toBe(0);
|
|
177
178
|
});
|
|
178
179
|
}), d("Multiple Cells", () => {
|
|
179
180
|
r("should render multiple cells", async () => {
|
|
180
181
|
a(
|
|
181
|
-
/* @__PURE__ */ l(n, { slide: {
|
|
182
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: {
|
|
182
183
|
ariaLabel: "1 of 3",
|
|
183
184
|
cells: [
|
|
184
185
|
{ id: 1, props: { title: "Cell 1" }, layout: "Figure" },
|
|
@@ -186,35 +187,35 @@ d("CarouselSlide", () => {
|
|
|
186
187
|
{ id: 3, props: { title: "Cell 3" }, layout: "Figure" }
|
|
187
188
|
],
|
|
188
189
|
layout: "Figure"
|
|
189
|
-
}
|
|
190
|
+
} })
|
|
190
191
|
), await u(() => {
|
|
191
192
|
const e = c.getAllByTestId("figure-layout");
|
|
192
193
|
i(e).toHaveLength(3), i(e[0]).toHaveTextContent("Cell 1"), i(e[1]).toHaveTextContent("Cell 2"), i(e[2]).toHaveTextContent("Cell 3");
|
|
193
194
|
});
|
|
194
195
|
}), r("should render cells with unique keys", async () => {
|
|
195
196
|
a(
|
|
196
|
-
/* @__PURE__ */ l(n, { slide: {
|
|
197
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 2, slide: {
|
|
197
198
|
ariaLabel: "1 of 3",
|
|
198
199
|
cells: [
|
|
199
200
|
{ id: 1, props: { title: "Cell A" }, layout: "Figure" },
|
|
200
201
|
{ id: 2, props: { title: "Cell B" }, layout: "Figure" }
|
|
201
202
|
],
|
|
202
203
|
layout: "Figure"
|
|
203
|
-
}
|
|
204
|
+
} })
|
|
204
205
|
), await u(() => {
|
|
205
206
|
const e = c.getAllByTestId("figure-layout");
|
|
206
207
|
i(e).toHaveLength(2);
|
|
207
208
|
});
|
|
208
209
|
}), r("should use slide layout for all cells in the slide", async () => {
|
|
209
210
|
a(
|
|
210
|
-
/* @__PURE__ */ l(n, { slide: {
|
|
211
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: {
|
|
211
212
|
ariaLabel: "1 of 3",
|
|
212
213
|
cells: [
|
|
213
214
|
{ id: 1, props: { title: "Figure Cell 1" }, layout: "Figure" },
|
|
214
215
|
{ id: 2, props: { title: "Figure Cell 2" }, layout: "Figure" }
|
|
215
216
|
],
|
|
216
217
|
layout: "Figure"
|
|
217
|
-
}
|
|
218
|
+
} })
|
|
218
219
|
), await u(() => {
|
|
219
220
|
const e = c.getAllByTestId("figure-layout");
|
|
220
221
|
i(e).toHaveLength(2), i(e[0]).toHaveTextContent("Figure Cell 1"), i(e[1]).toHaveTextContent("Figure Cell 2");
|
|
@@ -227,7 +228,7 @@ d("CarouselSlide", () => {
|
|
|
227
228
|
cells: [],
|
|
228
229
|
layout: "Figure"
|
|
229
230
|
}, { container: e } = a(
|
|
230
|
-
/* @__PURE__ */ l(n, {
|
|
231
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: t })
|
|
231
232
|
), o = e.querySelector("li");
|
|
232
233
|
i(o).toBeInTheDocument(), i(o == null ? void 0 : o.children.length).toBe(0);
|
|
233
234
|
}), r("should handle missing layout in cell", async () => {
|
|
@@ -236,7 +237,7 @@ d("CarouselSlide", () => {
|
|
|
236
237
|
cells: [{ id: 1, props: { title: "Test" } }],
|
|
237
238
|
layout: ""
|
|
238
239
|
}, { container: e } = a(
|
|
239
|
-
/* @__PURE__ */ l(n, {
|
|
240
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: t })
|
|
240
241
|
), o = e.querySelector("li");
|
|
241
242
|
i(o).toBeInTheDocument();
|
|
242
243
|
}), r("should handle empty aria-label", () => {
|
|
@@ -245,24 +246,24 @@ d("CarouselSlide", () => {
|
|
|
245
246
|
cells: [h],
|
|
246
247
|
layout: "Figure"
|
|
247
248
|
}, { container: e } = a(
|
|
248
|
-
/* @__PURE__ */ l(n, {
|
|
249
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: t })
|
|
249
250
|
), o = e.querySelector("li");
|
|
250
251
|
i(o).toHaveAttribute("aria-label", "");
|
|
251
252
|
}), r("should handle negative indices gracefully", () => {
|
|
252
253
|
const { container: t } = a(
|
|
253
|
-
/* @__PURE__ */ l(n, {
|
|
254
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: -1, slide: s })
|
|
254
255
|
), e = t.querySelector("li");
|
|
255
256
|
i(e).toHaveAttribute("data-index", "-1"), i(e).toHaveAttribute("inert");
|
|
256
257
|
}), r("should handle large index values", () => {
|
|
257
258
|
const { container: t } = a(
|
|
258
|
-
/* @__PURE__ */ l(n, {
|
|
259
|
+
/* @__PURE__ */ l(n, { currentIndex: 999, index: 999, slide: s })
|
|
259
260
|
), e = t.querySelector("li");
|
|
260
261
|
i(e).toHaveAttribute("data-index", "999"), i(e).not.toHaveAttribute("inert");
|
|
261
262
|
});
|
|
262
263
|
}), d("Props Passing to Layout", () => {
|
|
263
264
|
r("should pass all cell props to layout component", async () => {
|
|
264
265
|
a(
|
|
265
|
-
/* @__PURE__ */ l(n, { slide: {
|
|
266
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: {
|
|
266
267
|
ariaLabel: "1 of 1",
|
|
267
268
|
cells: [
|
|
268
269
|
{
|
|
@@ -277,17 +278,17 @@ d("CarouselSlide", () => {
|
|
|
277
278
|
}
|
|
278
279
|
],
|
|
279
280
|
layout: "Figure"
|
|
280
|
-
}
|
|
281
|
+
} })
|
|
281
282
|
), await u(() => {
|
|
282
283
|
const e = c.getByTestId("figure-layout");
|
|
283
284
|
i(e).toBeInTheDocument();
|
|
284
285
|
});
|
|
285
286
|
}), r("should handle cells without id", async () => {
|
|
286
|
-
a(/* @__PURE__ */ l(n, { slide: {
|
|
287
|
+
a(/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: {
|
|
287
288
|
ariaLabel: "1 of 1",
|
|
288
289
|
cells: [{ props: { title: "No ID Cell" }, layout: "Figure" }],
|
|
289
290
|
layout: "Figure"
|
|
290
|
-
}
|
|
291
|
+
} })), await u(() => {
|
|
291
292
|
const e = c.getByTestId("figure-layout");
|
|
292
293
|
i(e).toBeInTheDocument();
|
|
293
294
|
});
|
|
@@ -303,30 +304,30 @@ d("CarouselSlide", () => {
|
|
|
303
304
|
cells: [{ id: 2, props: { title: "Updated" }, layout: "Figure" }],
|
|
304
305
|
layout: "Figure"
|
|
305
306
|
}, { rerender: o } = a(
|
|
306
|
-
/* @__PURE__ */ l(n, {
|
|
307
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: t })
|
|
307
308
|
);
|
|
308
309
|
await u(() => {
|
|
309
310
|
i(c.getByText("Initial")).toBeInTheDocument();
|
|
310
|
-
}), o(/* @__PURE__ */ l(n, {
|
|
311
|
+
}), o(/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: e })), await u(() => {
|
|
311
312
|
i(c.getByText("Updated")).toBeInTheDocument();
|
|
312
313
|
});
|
|
313
314
|
}), r("should update inert attribute when currentIndex changes", () => {
|
|
314
315
|
const { container: t, rerender: e } = a(
|
|
315
|
-
/* @__PURE__ */ l(n, {
|
|
316
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 1, slide: s })
|
|
316
317
|
);
|
|
317
318
|
let o = t.querySelector("li");
|
|
318
|
-
i(o).toHaveAttribute("inert"), e(/* @__PURE__ */ l(n, {
|
|
319
|
+
i(o).toHaveAttribute("inert"), e(/* @__PURE__ */ l(n, { currentIndex: 1, index: 1, slide: s })), o = t.querySelector("li"), i(o).not.toHaveAttribute("inert");
|
|
319
320
|
}), r("should update data-index when index changes", () => {
|
|
320
321
|
const { container: t, rerender: e } = a(
|
|
321
|
-
/* @__PURE__ */ l(n, {
|
|
322
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: s })
|
|
322
323
|
);
|
|
323
324
|
let o = t.querySelector("li");
|
|
324
|
-
i(o).toHaveAttribute("data-index", "0"), e(/* @__PURE__ */ l(n, {
|
|
325
|
+
i(o).toHaveAttribute("data-index", "0"), e(/* @__PURE__ */ l(n, { currentIndex: 0, index: 3, slide: s })), o = t.querySelector("li"), i(o).toHaveAttribute("data-index", "3");
|
|
325
326
|
});
|
|
326
327
|
}), d("Accessibility", () => {
|
|
327
328
|
r("should have proper role description for screen readers", () => {
|
|
328
329
|
const { container: t } = a(
|
|
329
|
-
/* @__PURE__ */ l(n, {
|
|
330
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: s })
|
|
330
331
|
), e = t.querySelector('li[aria-roledescription="carousel-item"]');
|
|
331
332
|
i(e).toBeInTheDocument();
|
|
332
333
|
}), r("should provide context with aria-label", () => {
|
|
@@ -335,17 +336,17 @@ d("CarouselSlide", () => {
|
|
|
335
336
|
cells: [h],
|
|
336
337
|
layout: "Figure"
|
|
337
338
|
}, { container: e } = a(
|
|
338
|
-
/* @__PURE__ */ l(n, {
|
|
339
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 2, slide: t })
|
|
339
340
|
), o = e.querySelector("li");
|
|
340
341
|
i(o).toHaveAttribute("aria-label", "Slide 3 of 10");
|
|
341
342
|
}), r("should be inert when not focused to prevent tab navigation", () => {
|
|
342
343
|
const { container: t } = a(
|
|
343
|
-
/* @__PURE__ */ l(n, {
|
|
344
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 2, slide: s })
|
|
344
345
|
), e = t.querySelector("li");
|
|
345
346
|
i(e).toHaveAttribute("inert");
|
|
346
347
|
}), r("should not be inert when focused to allow tab navigation", () => {
|
|
347
348
|
const { container: t } = a(
|
|
348
|
-
/* @__PURE__ */ l(n, {
|
|
349
|
+
/* @__PURE__ */ l(n, { currentIndex: 0, index: 0, slide: s })
|
|
349
350
|
), e = t.querySelector("li");
|
|
350
351
|
i(e).not.toHaveAttribute("inert");
|
|
351
352
|
});
|
|
@@ -362,10 +363,10 @@ d("CarouselSlide", () => {
|
|
|
362
363
|
/* @__PURE__ */ l(
|
|
363
364
|
n,
|
|
364
365
|
{
|
|
365
|
-
|
|
366
|
-
index: 4,
|
|
366
|
+
variableHeight: !0,
|
|
367
367
|
currentIndex: 4,
|
|
368
|
-
|
|
368
|
+
index: 4,
|
|
369
|
+
slide: t
|
|
369
370
|
}
|
|
370
371
|
)
|
|
371
372
|
), o = e.querySelector("li");
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { jsxs as s, jsx as e, Fragment as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { getViewingPlatforms as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
1
|
+
import { jsxs as s, jsx as e, Fragment as W } from "react/jsx-runtime";
|
|
2
|
+
import { useState as d, useEffect as P } from "react";
|
|
3
|
+
import { getViewingPlatforms as q } from "../../utils/getViewingPlatforms.js";
|
|
4
|
+
import { classes as f } from "../../utils/helpers.js";
|
|
5
|
+
import { ChannelSearch as I } from "../ChannelSearch/ChannelSearch.js";
|
|
6
|
+
import { RescanInstructions as O } from "../RescanInstructions/RescanInstructions.js";
|
|
7
|
+
import { DeviceAndPlatformLists as z } from "../DeviceAndPlatformLists/DeviceAndPlatformLists.js";
|
|
8
|
+
import { GeneralErrorBoundary as h } from "../../error-boundries/GeneralErrorBoundry.js";
|
|
9
|
+
import '../../assets/FindUs.css';const E = "_findus__column_jx1qh_8", p = {
|
|
9
10
|
"grid-wrapper": "_grid-wrapper_jx1qh_1",
|
|
10
|
-
findus__column:
|
|
11
|
+
findus__column: E
|
|
11
12
|
};
|
|
12
|
-
function
|
|
13
|
+
function V({
|
|
13
14
|
network: n,
|
|
14
|
-
baseApiUrl:
|
|
15
|
-
platformsApiUrl:
|
|
16
|
-
allowStateSearch:
|
|
17
|
-
allowZipcodeSearch:
|
|
15
|
+
baseApiUrl: _,
|
|
16
|
+
platformsApiUrl: g = "https://api.scrippscloud.com/viewing-platforms/v1",
|
|
17
|
+
allowStateSearch: v = !0,
|
|
18
|
+
allowZipcodeSearch: y = !0,
|
|
18
19
|
allowAutoScroll: o = !0,
|
|
19
20
|
autoScrollOffset: a = 25,
|
|
20
21
|
compactLayout: t = !0,
|
|
21
22
|
showChannelSearchAndRescan: c = !0,
|
|
22
|
-
numberOfColumns:
|
|
23
|
+
numberOfColumns: N,
|
|
23
24
|
ad: l = {
|
|
24
25
|
campaign: "",
|
|
25
26
|
source: "",
|
|
@@ -27,101 +28,129 @@ function G({
|
|
|
27
28
|
content: "learn_more"
|
|
28
29
|
}
|
|
29
30
|
}) {
|
|
30
|
-
const [r,
|
|
31
|
-
return
|
|
31
|
+
const [r, w] = d(null), [b, j] = d(o ? a : 0), [u, x] = d(null);
|
|
32
|
+
return P(() => {
|
|
32
33
|
r === null && (async () => {
|
|
33
|
-
const i = await
|
|
34
|
+
const i = await q({ network: n.platformsSlug, platformsApiUrl: g });
|
|
34
35
|
if (Object.prototype.hasOwnProperty.call(i, "error")) {
|
|
35
|
-
|
|
36
|
+
x("An error occured while fetching the platforms."), console.error("An error occured while fetching the platforms:", i), w(/* @__PURE__ */ new Map());
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
+
w(i);
|
|
39
40
|
})();
|
|
40
|
-
}, [r, n.platformsSlug,
|
|
41
|
+
}, [r, n.platformsSlug, g]), P(() => {
|
|
41
42
|
if (window.innerWidth <= 960) {
|
|
42
43
|
const i = setInterval(() => {
|
|
43
44
|
if (document.querySelector(".mobile-nav")) {
|
|
44
45
|
clearInterval(i);
|
|
45
|
-
const
|
|
46
|
-
|
|
46
|
+
const m = document.querySelector(".mobile-nav"), M = (m == null ? void 0 : m.offsetHeight) ?? 0;
|
|
47
|
+
j(M + a);
|
|
47
48
|
}
|
|
48
49
|
}, 100);
|
|
49
50
|
}
|
|
50
|
-
}, [a]), /* @__PURE__ */ s(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
}, [a]), /* @__PURE__ */ s(
|
|
52
|
+
"section",
|
|
53
|
+
{
|
|
54
|
+
className: f([
|
|
55
|
+
p["find-us"],
|
|
56
|
+
t ? "find-us--compact" : ""
|
|
57
|
+
]),
|
|
58
|
+
children: [
|
|
59
|
+
c && !t && /* @__PURE__ */ e(
|
|
60
|
+
h,
|
|
58
61
|
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
errorMessage: "Please try again later. If the problem persists please use the <strong>contact us</strong> link below to report the issue.",
|
|
63
|
+
errorTitle: "We're sorry, there's currently an issue with our channel search.",
|
|
64
|
+
children: /* @__PURE__ */ e("div", { className: "find-us__channel-search-section", children: /* @__PURE__ */ e(
|
|
65
|
+
I,
|
|
66
|
+
{
|
|
67
|
+
ad: {
|
|
68
|
+
campaign: l.campaign ?? "",
|
|
69
|
+
source: l.source ?? "",
|
|
70
|
+
medium: l.medium ?? "referral",
|
|
71
|
+
content: l.content ?? "learn_more"
|
|
72
|
+
},
|
|
73
|
+
allowAutoScroll: o,
|
|
74
|
+
allowStateSearch: v,
|
|
75
|
+
allowZipcodeSearch: y,
|
|
76
|
+
autoScrollOffset: b,
|
|
77
|
+
baseApiUrl: _,
|
|
78
|
+
compactLayout: t,
|
|
79
|
+
network: n
|
|
80
|
+
}
|
|
81
|
+
) })
|
|
72
82
|
}
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
),
|
|
84
|
+
/* @__PURE__ */ e("div", { className: "find-us__rescan-platform-section", children: /* @__PURE__ */ s(
|
|
85
|
+
"div",
|
|
86
|
+
{
|
|
87
|
+
className: f([
|
|
88
|
+
p["grid-wrapper"],
|
|
89
|
+
"findus__grid-wrapper",
|
|
90
|
+
c ? "" : "findus__grid-wrapper--full-width"
|
|
91
|
+
]),
|
|
92
|
+
children: [
|
|
93
|
+
c && /* @__PURE__ */ s(
|
|
94
|
+
"div",
|
|
95
|
+
{
|
|
96
|
+
className: f([
|
|
97
|
+
p.findus__column,
|
|
98
|
+
"findus__column"
|
|
99
|
+
]),
|
|
100
|
+
children: [
|
|
101
|
+
t && /* @__PURE__ */ s(W, { children: [
|
|
102
|
+
/* @__PURE__ */ s("h4", { className: "channel-search__header", children: [
|
|
103
|
+
"Digital Antenna ",
|
|
104
|
+
/* @__PURE__ */ e("span", { className: "channel-search__header--lighter", children: "(Over-the-Air Broadcast)" })
|
|
105
|
+
] }),
|
|
106
|
+
/* @__PURE__ */ e(
|
|
107
|
+
h,
|
|
108
|
+
{
|
|
109
|
+
errorMessage: "Please try again later. If the problem persists please use the <strong>contact us</strong> link below to report the issue.",
|
|
110
|
+
errorTitle: "We're sorry, there's currently an issue with our channel search.",
|
|
111
|
+
children: /* @__PURE__ */ e(
|
|
112
|
+
I,
|
|
113
|
+
{
|
|
114
|
+
allowAutoScroll: o,
|
|
115
|
+
allowStateSearch: v,
|
|
116
|
+
allowZipcodeSearch: y,
|
|
117
|
+
autoScrollOffset: b,
|
|
118
|
+
baseApiUrl: _,
|
|
119
|
+
compactLayout: t,
|
|
120
|
+
network: n
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
] }),
|
|
126
|
+
/* @__PURE__ */ e(O, { brandName: n.brand_name })
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
/* @__PURE__ */ s(
|
|
131
|
+
h,
|
|
90
132
|
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
133
|
+
errorMessage: "Please try again later. If the problem persists please use the <strong>contact us</strong> link below to report the issue.",
|
|
134
|
+
errorTitle: "We're sorry, there's currently an issue with our device and platform lists.",
|
|
135
|
+
children: [
|
|
136
|
+
r !== null && r.size > 0 && u === null && /* @__PURE__ */ e(z, { platformResources: r, ...N && { numberOfColumns: N } }),
|
|
137
|
+
r !== null && r.size > 0 && u !== null && /* @__PURE__ */ e("div", { className: "find-us__error", children: /* @__PURE__ */ e("p", { className: "find-us__error-message", children: u }) }),
|
|
138
|
+
r !== null && r.size === 0 && /* @__PURE__ */ e("div", { className: "find-us__error", children: /* @__PURE__ */ s("p", { className: "find-us__error-message", children: [
|
|
139
|
+
"We couldn't find any viewing platforms for ",
|
|
140
|
+
n.brand_name,
|
|
141
|
+
"."
|
|
142
|
+
] }) })
|
|
143
|
+
]
|
|
98
144
|
}
|
|
99
145
|
)
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
f,
|
|
107
|
-
{
|
|
108
|
-
errorMessage: "Please try again later. If the problem persists please use the <strong>contact us</strong> link below to report the issue.",
|
|
109
|
-
errorTitle: "We're sorry, there's currently an issue with our device and platform lists.",
|
|
110
|
-
children: [
|
|
111
|
-
r !== null && r.size > 0 && u === null && /* @__PURE__ */ e(O, { platformResources: r, ...y && { numberOfColumns: y } }),
|
|
112
|
-
r !== null && r.size > 0 && u !== null && /* @__PURE__ */ e("div", { className: "find-us__error", children: /* @__PURE__ */ e("p", { className: "find-us__error-message", children: u }) }),
|
|
113
|
-
r !== null && r.size === 0 && /* @__PURE__ */ e("div", { className: "find-us__error", children: /* @__PURE__ */ s("p", { className: "find-us__error-message", children: [
|
|
114
|
-
"We couldn't find any viewing platforms for ",
|
|
115
|
-
n.brand_name,
|
|
116
|
-
"."
|
|
117
|
-
] }) })
|
|
118
|
-
]
|
|
119
|
-
}
|
|
120
|
-
)
|
|
121
|
-
] }) })
|
|
122
|
-
] });
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
) })
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
);
|
|
123
152
|
}
|
|
124
153
|
export {
|
|
125
|
-
|
|
126
|
-
|
|
154
|
+
V as FindUs,
|
|
155
|
+
V as default
|
|
127
156
|
};
|
|
@@ -483,9 +483,9 @@ p("ImageCardCore", () => {
|
|
|
483
483
|
t(e).not.toBeInTheDocument();
|
|
484
484
|
});
|
|
485
485
|
}), p("Default CTA Labels", () => {
|
|
486
|
-
l('should use "View
|
|
486
|
+
l('should use "View Video" for play-video when no label', () => {
|
|
487
487
|
const e = r({ type: "play-video", label: "" });
|
|
488
|
-
a(/* @__PURE__ */ n(i, { cta: e, styles: o })), t(c.getByText("View
|
|
488
|
+
a(/* @__PURE__ */ n(i, { cta: e, styles: o })), t(c.getByText("View Video")).toBeInTheDocument();
|
|
489
489
|
}), l('should use "View More" for internal-link when no label', () => {
|
|
490
490
|
const e = r({ type: "internal-link", label: "" });
|
|
491
491
|
a(/* @__PURE__ */ n(i, { cta: e, styles: o })), t(c.getByText("View More")).toBeInTheDocument();
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { v as h, d as m, b as
|
|
1
|
+
import { jsx as a, jsxs as B } from "react/jsx-runtime";
|
|
2
|
+
import { v as h, d as m, b as I, a as v, i as r, r as l, g as n, s as c, w as u } from "../../react.esm-S2Q_NbYC.mjs";
|
|
3
3
|
import "../../index-BZQHStQa.mjs";
|
|
4
|
-
import { PromotionsRowModule as
|
|
4
|
+
import { PromotionsRowModule as s } from "./PromotionsRowModule.js";
|
|
5
5
|
h.mock("../PromotionsRowBlock", () => ({
|
|
6
|
-
default: ({ children: o, gap: e }) => /* @__PURE__ */
|
|
6
|
+
default: ({ children: o, gap: e }) => /* @__PURE__ */ a("div", { "data-gap": e, "data-testid": "promotions-row-block", children: o })
|
|
7
7
|
}));
|
|
8
8
|
h.mock("../ImageCard", () => ({
|
|
9
|
-
default: ({ image: o, title: e, content: i, cta: p, relatedResourceId: y, classname: T, overlayContent:
|
|
9
|
+
default: ({ image: o, title: e, content: i, cta: p, relatedResourceId: y, classname: T, overlayContent: C }) => /* @__PURE__ */ B(
|
|
10
10
|
"div",
|
|
11
11
|
{
|
|
12
12
|
"data-classname": T,
|
|
13
|
-
"data-content": i,
|
|
13
|
+
"data-content": typeof i == "string" ? i : void 0,
|
|
14
14
|
"data-cta-text": p == null ? void 0 : p.label,
|
|
15
15
|
"data-image-url": o.url,
|
|
16
16
|
"data-related-id": y,
|
|
@@ -19,7 +19,8 @@ h.mock("../ImageCard", () => ({
|
|
|
19
19
|
children: [
|
|
20
20
|
"ImageCard: ",
|
|
21
21
|
e,
|
|
22
|
-
|
|
22
|
+
i,
|
|
23
|
+
C
|
|
23
24
|
]
|
|
24
25
|
}
|
|
25
26
|
)
|
|
@@ -58,62 +59,62 @@ const g = {
|
|
|
58
59
|
...e
|
|
59
60
|
});
|
|
60
61
|
m("PromotionsRowModule", () => {
|
|
61
|
-
|
|
62
|
+
I(() => {
|
|
62
63
|
h.clearAllMocks();
|
|
63
64
|
}), v(() => {
|
|
64
65
|
h.clearAllMocks();
|
|
65
66
|
}), m("Basic Rendering", () => {
|
|
66
|
-
|
|
67
|
-
const o = [t("1")], { container: e } =
|
|
68
|
-
|
|
69
|
-
}),
|
|
67
|
+
r("should render section with promotions-row class", () => {
|
|
68
|
+
const o = [t("1")], { container: e } = l(/* @__PURE__ */ a(s, { promos: o })), i = e.querySelector("section.promotions-row");
|
|
69
|
+
n(i).toBeInTheDocument();
|
|
70
|
+
}), r("should render title when provided", () => {
|
|
70
71
|
const o = [t("1")];
|
|
71
|
-
|
|
72
|
-
}),
|
|
72
|
+
l(/* @__PURE__ */ a(s, { promos: o, title: "Special Offers" })), n(c.getByRole("heading", { name: "Special Offers" })).toBeInTheDocument();
|
|
73
|
+
}), r("should render title as h2 element", () => {
|
|
73
74
|
const o = [t("1")];
|
|
74
|
-
|
|
75
|
-
const e =
|
|
76
|
-
|
|
77
|
-
}),
|
|
75
|
+
l(/* @__PURE__ */ a(s, { promos: o, title: "Special Offers" }));
|
|
76
|
+
const e = c.getByRole("heading", { name: "Special Offers", level: 2 });
|
|
77
|
+
n(e).toBeInTheDocument();
|
|
78
|
+
}), r("should apply correct classes to title", () => {
|
|
78
79
|
const o = [t("1")];
|
|
79
|
-
|
|
80
|
-
const e =
|
|
81
|
-
|
|
82
|
-
}),
|
|
83
|
-
const o = [t("1")], { container: e } =
|
|
84
|
-
|
|
80
|
+
l(/* @__PURE__ */ a(s, { promos: o, title: "Special Offers" }));
|
|
81
|
+
const e = c.getByRole("heading", { name: "Special Offers" });
|
|
82
|
+
n(e).toHaveClass("h2", "promotions-row__header");
|
|
83
|
+
}), r("should render empty title when not provided", () => {
|
|
84
|
+
const o = [t("1")], { container: e } = l(/* @__PURE__ */ a(s, { promos: o })), i = e.querySelector("h2");
|
|
85
|
+
n(i).toHaveTextContent("");
|
|
85
86
|
});
|
|
86
87
|
}), m("PromotionsRowBlock Rendering (≤4 promos)", () => {
|
|
87
|
-
|
|
88
|
+
r("should render PromotionsRowBlock with single promo", () => {
|
|
88
89
|
const o = [t("1")];
|
|
89
|
-
|
|
90
|
-
}),
|
|
90
|
+
l(/* @__PURE__ */ a(s, { promos: o })), n(c.getByTestId("promotions-row-block")).toBeInTheDocument();
|
|
91
|
+
}), r("should render PromotionsRowBlock with 2 promos", () => {
|
|
91
92
|
const o = [t("1"), t("2")];
|
|
92
|
-
|
|
93
|
-
}),
|
|
93
|
+
l(/* @__PURE__ */ a(s, { promos: o })), n(c.getByTestId("promotions-row-block")).toBeInTheDocument();
|
|
94
|
+
}), r("should render PromotionsRowBlock with exactly 4 promos", () => {
|
|
94
95
|
const o = [
|
|
95
96
|
t("1"),
|
|
96
97
|
t("2"),
|
|
97
98
|
t("3"),
|
|
98
99
|
t("4")
|
|
99
100
|
];
|
|
100
|
-
|
|
101
|
-
}),
|
|
101
|
+
l(/* @__PURE__ */ a(s, { promos: o })), n(c.getByTestId("promotions-row-block")).toBeInTheDocument();
|
|
102
|
+
}), r("should apply 2rem gap to PromotionsRowBlock", () => {
|
|
102
103
|
const o = [t("1")];
|
|
103
|
-
|
|
104
|
-
const e =
|
|
105
|
-
|
|
106
|
-
}),
|
|
104
|
+
l(/* @__PURE__ */ a(s, { promos: o }));
|
|
105
|
+
const e = c.getByTestId("promotions-row-block");
|
|
106
|
+
n(e).toHaveAttribute("data-gap", "2rem");
|
|
107
|
+
}), r("should not render Carousel when promos ≤ 4", () => {
|
|
107
108
|
const o = [
|
|
108
109
|
t("1"),
|
|
109
110
|
t("2"),
|
|
110
111
|
t("3"),
|
|
111
112
|
t("4")
|
|
112
113
|
];
|
|
113
|
-
|
|
114
|
+
l(/* @__PURE__ */ a(s, { promos: o })), n(c.queryByTestId("carousel")).not.toBeInTheDocument();
|
|
114
115
|
});
|
|
115
116
|
}), m("Carousel Rendering (>4 promos)", () => {
|
|
116
|
-
|
|
117
|
+
r("should render Carousel when promos > 4", async () => {
|
|
117
118
|
const o = [
|
|
118
119
|
t("1"),
|
|
119
120
|
t("2"),
|
|
@@ -121,79 +122,92 @@ m("PromotionsRowModule", () => {
|
|
|
121
122
|
t("4"),
|
|
122
123
|
t("5")
|
|
123
124
|
];
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
l(/* @__PURE__ */ a(s, { promos: o })), await u(() => {
|
|
126
|
+
n(c.getByTestId("carousel")).toBeInTheDocument();
|
|
126
127
|
});
|
|
127
|
-
}),
|
|
128
|
+
}), r("should render h1 title for carousel view", async () => {
|
|
128
129
|
const o = Array.from({ length: 5 }, (e, i) => t(`${i + 1}`));
|
|
129
|
-
|
|
130
|
-
const e =
|
|
131
|
-
|
|
130
|
+
l(/* @__PURE__ */ a(s, { promos: o, title: "Carousel Title" })), await u(() => {
|
|
131
|
+
const e = c.getByRole("heading", { name: "Carousel Title", level: 1 });
|
|
132
|
+
n(e).toBeInTheDocument();
|
|
132
133
|
});
|
|
133
|
-
}),
|
|
134
|
+
}), r("should apply h3 class to carousel title", async () => {
|
|
134
135
|
const o = Array.from({ length: 5 }, (e, i) => t(`${i + 1}`));
|
|
135
|
-
|
|
136
|
-
const e =
|
|
137
|
-
|
|
136
|
+
l(/* @__PURE__ */ a(s, { promos: o, title: "Carousel Title" })), await u(() => {
|
|
137
|
+
const e = c.getByRole("heading", { name: "Carousel Title" });
|
|
138
|
+
n(e).toHaveClass("h3", "promotions-row__header");
|
|
138
139
|
});
|
|
139
|
-
}),
|
|
140
|
+
}), r("should not render PromotionsRowBlock when carousel is shown", async () => {
|
|
140
141
|
const o = Array.from({ length: 5 }, (e, i) => t(`${i + 1}`));
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}),
|
|
144
|
-
}),
|
|
142
|
+
l(/* @__PURE__ */ a(s, { promos: o })), await u(() => {
|
|
143
|
+
n(c.getByTestId("carousel")).toBeInTheDocument();
|
|
144
|
+
}), n(c.queryByTestId("promotions-row-block")).not.toBeInTheDocument();
|
|
145
|
+
}), r("should pass correct number of cells to Carousel", async () => {
|
|
145
146
|
const o = Array.from({ length: 6 }, (e, i) => t(`${i + 1}`));
|
|
146
|
-
|
|
147
|
-
const e =
|
|
148
|
-
|
|
147
|
+
l(/* @__PURE__ */ a(s, { promos: o })), await u(() => {
|
|
148
|
+
const e = c.getByTestId("carousel");
|
|
149
|
+
n(e).toHaveAttribute("data-cells-count", "6");
|
|
149
150
|
});
|
|
150
151
|
});
|
|
151
152
|
}), m("ImageCard Rendering", () => {
|
|
152
|
-
|
|
153
|
+
r("should render ImageCard for each promo", () => {
|
|
153
154
|
const o = [
|
|
154
155
|
t("1"),
|
|
155
156
|
t("2"),
|
|
156
157
|
t("3")
|
|
157
158
|
];
|
|
158
|
-
|
|
159
|
-
const e =
|
|
160
|
-
|
|
161
|
-
}),
|
|
159
|
+
l(/* @__PURE__ */ a(s, { promos: o }));
|
|
160
|
+
const e = c.getAllByTestId("image-card");
|
|
161
|
+
n(e).toHaveLength(3);
|
|
162
|
+
}), r("should pass image prop to ImageCard", () => {
|
|
162
163
|
const o = [t("1")];
|
|
163
|
-
|
|
164
|
-
const e =
|
|
165
|
-
|
|
166
|
-
}),
|
|
164
|
+
l(/* @__PURE__ */ a(s, { promos: o }));
|
|
165
|
+
const e = c.getByTestId("image-card");
|
|
166
|
+
n(e).toHaveAttribute("data-image-url", g.url);
|
|
167
|
+
}), r("should pass title prop to ImageCard", () => {
|
|
167
168
|
const o = [t("1", { title: "Special Promo" })];
|
|
168
|
-
|
|
169
|
-
const e =
|
|
170
|
-
|
|
171
|
-
}),
|
|
169
|
+
l(/* @__PURE__ */ a(s, { promos: o }));
|
|
170
|
+
const e = c.getByTestId("image-card");
|
|
171
|
+
n(e).toHaveAttribute("data-title", "Special Promo");
|
|
172
|
+
}), r("should pass content prop to ImageCard", () => {
|
|
172
173
|
const o = [t("1", { content: "Special content" })];
|
|
173
|
-
|
|
174
|
-
const e =
|
|
175
|
-
|
|
176
|
-
}),
|
|
174
|
+
l(/* @__PURE__ */ a(s, { promos: o, shouldClampContent: !1 }));
|
|
175
|
+
const e = c.getByTestId("image-card");
|
|
176
|
+
n(e).toHaveAttribute("data-content", "Special content");
|
|
177
|
+
}), r("should wrap content in a clamped-content div when shouldClampContent is true", () => {
|
|
178
|
+
const o = [t("1", { content: "Special content" })], { container: e } = l(
|
|
179
|
+
/* @__PURE__ */ a(s, { shouldClampContent: !0, promos: o })
|
|
180
|
+
), i = e.querySelector(".promotions-row__clamped-content");
|
|
181
|
+
n(i).toBeInTheDocument(), n(i).toHaveTextContent("Special content");
|
|
182
|
+
}), r("should wrap content in a clamped-content div by default", () => {
|
|
183
|
+
const o = [t("1", { content: "Special content" })], { container: e } = l(/* @__PURE__ */ a(s, { promos: o })), i = e.querySelector(".promotions-row__clamped-content");
|
|
184
|
+
n(i).toBeInTheDocument(), n(i).toHaveTextContent("Special content");
|
|
185
|
+
}), r("should not wrap content when shouldClampContent is false", () => {
|
|
186
|
+
const o = [t("1", { content: "Special content" })], { container: e } = l(
|
|
187
|
+
/* @__PURE__ */ a(s, { promos: o, shouldClampContent: !1 })
|
|
188
|
+
), i = e.querySelector(".promotions-row__clamped-content");
|
|
189
|
+
n(i).not.toBeInTheDocument();
|
|
190
|
+
}), r("should pass cta prop to ImageCard", () => {
|
|
177
191
|
const o = [t("1")];
|
|
178
|
-
|
|
179
|
-
const e =
|
|
180
|
-
|
|
181
|
-
}),
|
|
192
|
+
l(/* @__PURE__ */ a(s, { promos: o }));
|
|
193
|
+
const e = c.getByTestId("image-card");
|
|
194
|
+
n(e).toHaveAttribute("data-cta-text", d.label);
|
|
195
|
+
}), r("should pass relatedResourceId to ImageCard", () => {
|
|
182
196
|
const o = [t("test-id-123")];
|
|
183
|
-
|
|
184
|
-
const e =
|
|
185
|
-
|
|
186
|
-
}),
|
|
197
|
+
l(/* @__PURE__ */ a(s, { promos: o }));
|
|
198
|
+
const e = c.getByTestId("image-card");
|
|
199
|
+
n(e).toHaveAttribute("data-related-id", "test-id-123");
|
|
200
|
+
}), r("should pass classname to ImageCard when provided", () => {
|
|
187
201
|
const o = [t("1", { classname: "custom-class" })];
|
|
188
|
-
|
|
189
|
-
const e =
|
|
190
|
-
|
|
202
|
+
l(/* @__PURE__ */ a(s, { promos: o }));
|
|
203
|
+
const e = c.getByTestId("image-card");
|
|
204
|
+
n(e).toHaveAttribute("data-classname", "custom-class");
|
|
191
205
|
});
|
|
192
206
|
}), m("CtaBlock Overlay Content", () => {
|
|
193
|
-
|
|
207
|
+
r("should not render CtaBlock when overlayContent is not provided", () => {
|
|
194
208
|
const o = [t("1")];
|
|
195
|
-
|
|
196
|
-
}),
|
|
209
|
+
l(/* @__PURE__ */ a(s, { promos: o })), n(c.queryByTestId("cta-block")).not.toBeInTheDocument();
|
|
210
|
+
}), r("should render CtaBlock when overlayContent is provided", () => {
|
|
197
211
|
const o = [t("1", {
|
|
198
212
|
overlayContent: {
|
|
199
213
|
title: "Overlay Title",
|
|
@@ -201,69 +215,69 @@ m("PromotionsRowModule", () => {
|
|
|
201
215
|
cta: d
|
|
202
216
|
}
|
|
203
217
|
})];
|
|
204
|
-
|
|
205
|
-
}),
|
|
218
|
+
l(/* @__PURE__ */ a(s, { promos: o })), n(c.getByTestId("cta-block")).toBeInTheDocument();
|
|
219
|
+
}), r("should pass overlayContent title to CtaBlock", () => {
|
|
206
220
|
const o = [t("1", {
|
|
207
221
|
overlayContent: {
|
|
208
222
|
title: "Overlay Title",
|
|
209
223
|
cta: d
|
|
210
224
|
}
|
|
211
225
|
})];
|
|
212
|
-
|
|
213
|
-
const e =
|
|
214
|
-
|
|
215
|
-
}),
|
|
226
|
+
l(/* @__PURE__ */ a(s, { promos: o }));
|
|
227
|
+
const e = c.getByTestId("cta-block");
|
|
228
|
+
n(e).toHaveAttribute("data-title", "Overlay Title");
|
|
229
|
+
}), r("should pass overlayContent cta to CtaBlock", () => {
|
|
216
230
|
const o = [t("1", {
|
|
217
231
|
overlayContent: {
|
|
218
232
|
cta: d
|
|
219
233
|
}
|
|
220
234
|
})];
|
|
221
|
-
|
|
222
|
-
const e =
|
|
223
|
-
|
|
224
|
-
}),
|
|
235
|
+
l(/* @__PURE__ */ a(s, { promos: o }));
|
|
236
|
+
const e = c.getByTestId("cta-block");
|
|
237
|
+
n(e).toHaveAttribute("data-cta-text", d.label);
|
|
238
|
+
}), r("should render multiple CtaBlocks for multiple promos with overlayContent", () => {
|
|
225
239
|
const o = [
|
|
226
240
|
t("1", { overlayContent: { title: "Overlay 1", cta: d } }),
|
|
227
241
|
t("2", { overlayContent: { title: "Overlay 2", cta: d } }),
|
|
228
242
|
t("3", { overlayContent: { title: "Overlay 3", cta: d } })
|
|
229
243
|
];
|
|
230
|
-
|
|
231
|
-
const e =
|
|
232
|
-
|
|
244
|
+
l(/* @__PURE__ */ a(s, { promos: o }));
|
|
245
|
+
const e = c.getAllByTestId("cta-block");
|
|
246
|
+
n(e).toHaveLength(3);
|
|
233
247
|
});
|
|
234
248
|
}), m("HandleClicks Prop", () => {
|
|
235
|
-
|
|
249
|
+
r("should use provided handleClicks function", () => {
|
|
236
250
|
const o = h.fn(), e = [t("1")];
|
|
237
|
-
|
|
238
|
-
}),
|
|
251
|
+
l(/* @__PURE__ */ a(s, { handleClicks: o, promos: e })), n(c.getByTestId("image-card")).toBeInTheDocument();
|
|
252
|
+
}), r("should use default handleClicks when not provided", () => {
|
|
239
253
|
const o = [t("1")];
|
|
240
|
-
|
|
241
|
-
}),
|
|
254
|
+
l(/* @__PURE__ */ a(s, { promos: o })), n(c.getByTestId("image-card")).toBeInTheDocument();
|
|
255
|
+
}), r("should use default handleClicks when null", () => {
|
|
242
256
|
const o = [t("1")];
|
|
243
|
-
|
|
257
|
+
l(/* @__PURE__ */ a(s, { handleClicks: null, promos: o })), n(c.getByTestId("image-card")).toBeInTheDocument();
|
|
244
258
|
});
|
|
245
259
|
}), m("Edge Cases", () => {
|
|
246
|
-
|
|
247
|
-
const { container: o } =
|
|
248
|
-
|
|
249
|
-
}),
|
|
250
|
-
|
|
260
|
+
r("should handle empty promos array", () => {
|
|
261
|
+
const { container: o } = l(/* @__PURE__ */ a(s, { promos: [] })), e = o.querySelector("section.promotions-row");
|
|
262
|
+
n(e).toBeInTheDocument();
|
|
263
|
+
}), r("should handle promos without optional fields", () => {
|
|
264
|
+
l(/* @__PURE__ */ a(s, { promos: [{
|
|
251
265
|
id: "1",
|
|
252
266
|
image: g
|
|
253
|
-
}] })),
|
|
254
|
-
}),
|
|
255
|
-
const o = "This is a very long title ".repeat(10).trim(), e = [t("1")], { container: i } =
|
|
256
|
-
|
|
257
|
-
}),
|
|
267
|
+
}] })), n(c.getByTestId("image-card")).toBeInTheDocument();
|
|
268
|
+
}), r("should handle very long title", () => {
|
|
269
|
+
const o = "This is a very long title ".repeat(10).trim(), e = [t("1")], { container: i } = l(/* @__PURE__ */ a(s, { promos: e, title: o })), p = i.querySelector("h2");
|
|
270
|
+
n(p).toHaveTextContent(o);
|
|
271
|
+
}), r("should handle special characters in title", () => {
|
|
258
272
|
const o = 'Special & "Quoted" Title <test>', e = [t("1")];
|
|
259
|
-
|
|
260
|
-
}),
|
|
273
|
+
l(/* @__PURE__ */ a(s, { promos: e, title: o })), n(c.getByRole("heading", { name: o })).toBeInTheDocument();
|
|
274
|
+
}), r("should handle many promos (>10)", async () => {
|
|
261
275
|
const o = Array.from({ length: 15 }, (e, i) => t(`${i + 1}`));
|
|
262
|
-
|
|
263
|
-
const e =
|
|
264
|
-
|
|
276
|
+
l(/* @__PURE__ */ a(s, { promos: o })), await u(() => {
|
|
277
|
+
const e = c.getByTestId("carousel");
|
|
278
|
+
n(e).toHaveAttribute("data-cells-count", "15");
|
|
265
279
|
});
|
|
266
|
-
}),
|
|
280
|
+
}), r("should handle promos with undefined overlayContent properties", () => {
|
|
267
281
|
const o = [t("1", {
|
|
268
282
|
overlayContent: {
|
|
269
283
|
title: void 0,
|
|
@@ -271,29 +285,29 @@ m("PromotionsRowModule", () => {
|
|
|
271
285
|
cta: void 0
|
|
272
286
|
}
|
|
273
287
|
})];
|
|
274
|
-
|
|
288
|
+
l(/* @__PURE__ */ a(s, { promos: o })), n(c.getByTestId("cta-block")).toBeInTheDocument();
|
|
275
289
|
});
|
|
276
290
|
}), m("Conditional Rendering Logic", () => {
|
|
277
|
-
|
|
278
|
-
const { rerender: o } =
|
|
279
|
-
|
|
291
|
+
r("should switch from PromotionsRowBlock to Carousel when promos increase", async () => {
|
|
292
|
+
const { rerender: o } = l(/* @__PURE__ */ a(s, { promos: [t("1")] }));
|
|
293
|
+
n(c.getByTestId("promotions-row-block")).toBeInTheDocument();
|
|
280
294
|
const e = Array.from({ length: 5 }, (i, p) => t(`${p + 1}`));
|
|
281
|
-
o(/* @__PURE__ */ s
|
|
282
|
-
|
|
283
|
-
}),
|
|
284
|
-
}),
|
|
285
|
-
const o = [t("1")], { container: e } =
|
|
286
|
-
|
|
287
|
-
}),
|
|
288
|
-
const o = Array.from({ length: 5 }, (p, y) => t(`${y + 1}`)), { container: e } =
|
|
295
|
+
o(/* @__PURE__ */ a(s, { promos: e })), await u(() => {
|
|
296
|
+
n(c.getByTestId("carousel")).toBeInTheDocument();
|
|
297
|
+
}), n(c.queryByTestId("promotions-row-block")).not.toBeInTheDocument();
|
|
298
|
+
}), r("should render section element for PromotionsRowBlock view", () => {
|
|
299
|
+
const o = [t("1")], { container: e } = l(/* @__PURE__ */ a(s, { promos: o })), i = e.querySelector("section");
|
|
300
|
+
n(i).toBeInTheDocument();
|
|
301
|
+
}), r("should not render section element for Carousel view", async () => {
|
|
302
|
+
const o = Array.from({ length: 5 }, (p, y) => t(`${y + 1}`)), { container: e } = l(/* @__PURE__ */ a(s, { promos: o }));
|
|
289
303
|
await u(() => {
|
|
290
|
-
|
|
304
|
+
n(c.getByTestId("carousel")).toBeInTheDocument();
|
|
291
305
|
});
|
|
292
306
|
const i = e.querySelector("section");
|
|
293
|
-
|
|
307
|
+
n(i).not.toBeInTheDocument();
|
|
294
308
|
});
|
|
295
309
|
}), m("Integration", () => {
|
|
296
|
-
|
|
310
|
+
r("should render complete module with all elements", () => {
|
|
297
311
|
const o = [
|
|
298
312
|
t("1", {
|
|
299
313
|
title: "Promo 1",
|
|
@@ -305,28 +319,28 @@ m("PromotionsRowModule", () => {
|
|
|
305
319
|
content: "Content 2"
|
|
306
320
|
})
|
|
307
321
|
];
|
|
308
|
-
|
|
309
|
-
}),
|
|
322
|
+
l(/* @__PURE__ */ a(s, { promos: o, title: "Test Module" })), n(c.getByRole("heading", { name: "Test Module" })).toBeInTheDocument(), n(c.getByTestId("promotions-row-block")).toBeInTheDocument(), n(c.getAllByTestId("image-card")).toHaveLength(2), n(c.getByTestId("cta-block")).toBeInTheDocument();
|
|
323
|
+
}), r("should render carousel with all promos when count > 4", async () => {
|
|
310
324
|
const o = Array.from(
|
|
311
325
|
{ length: 8 },
|
|
312
326
|
(e, i) => t(`${i + 1}`, { title: `Promo ${i + 1}` })
|
|
313
327
|
);
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
const e =
|
|
317
|
-
|
|
328
|
+
l(/* @__PURE__ */ a(s, { promos: o, title: "Carousel Module" })), await u(() => {
|
|
329
|
+
n(c.getByRole("heading", { name: "Carousel Module", level: 1 })).toBeInTheDocument();
|
|
330
|
+
const e = c.getByTestId("carousel");
|
|
331
|
+
n(e).toHaveAttribute("data-cells-count", "8");
|
|
318
332
|
});
|
|
319
|
-
}),
|
|
333
|
+
}), r("should handle mix of promos with and without overlayContent", () => {
|
|
320
334
|
const o = [
|
|
321
335
|
t("1", { overlayContent: { title: "Overlay 1", cta: d } }),
|
|
322
336
|
t("2"),
|
|
323
337
|
t("3", { overlayContent: { title: "Overlay 3", cta: d } })
|
|
324
338
|
];
|
|
325
|
-
|
|
339
|
+
l(/* @__PURE__ */ a(s, { promos: o })), n(c.getAllByTestId("image-card")).toHaveLength(3), n(c.getAllByTestId("cta-block")).toHaveLength(2);
|
|
326
340
|
});
|
|
327
341
|
}), m("Type Safety", () => {
|
|
328
|
-
|
|
329
|
-
|
|
342
|
+
r("should accept valid Promo array", () => {
|
|
343
|
+
l(/* @__PURE__ */ a(s, { promos: [
|
|
330
344
|
{
|
|
331
345
|
id: "1",
|
|
332
346
|
title: "Promo 1",
|
|
@@ -338,12 +352,12 @@ m("PromotionsRowModule", () => {
|
|
|
338
352
|
id: "2",
|
|
339
353
|
image: g
|
|
340
354
|
}
|
|
341
|
-
] })),
|
|
342
|
-
}),
|
|
355
|
+
] })), n(c.getAllByTestId("image-card")).toHaveLength(2);
|
|
356
|
+
}), r("should accept handleClicks function with correct signature", () => {
|
|
343
357
|
const o = (i) => {
|
|
344
358
|
console.warn(i);
|
|
345
359
|
}, e = [t("1")];
|
|
346
|
-
|
|
360
|
+
l(/* @__PURE__ */ a(s, { handleClicks: o, promos: e })), n(c.getByTestId("image-card")).toBeInTheDocument();
|
|
347
361
|
});
|
|
348
362
|
});
|
|
349
363
|
});
|
package/package.json
CHANGED