@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import d, { forwardRef as w } from "react";
|
|
2
|
-
import { P as _ } from "./index-
|
|
2
|
+
import { P as _ } from "./index-D3kkcgee.mjs";
|
|
3
3
|
import './assets/Form.css';function f() {
|
|
4
4
|
return f = Object.assign || function(t) {
|
|
5
5
|
for (var n = 1; n < arguments.length; n++) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import './assets/ResultsTable.css';const _ = {
|
|
2
|
+
"results-table": "_results-table_8gs3t_1",
|
|
3
|
+
"results-table__row": "_results-table__row_8gs3t_4",
|
|
4
|
+
"results-table__item": "_results-table__item_8gs3t_9",
|
|
5
|
+
"results-table__header": "_results-table__header_8gs3t_9",
|
|
6
|
+
"results-table__mobile-label": "_results-table__mobile-label_8gs3t_24",
|
|
7
|
+
"results-table__no-results": "_results-table__no-results_8gs3t_34",
|
|
8
|
+
"results-table--compact": "_results-table--compact_8gs3t_40",
|
|
9
|
+
"results-table__header-row": "_results-table__header-row_8gs3t_52",
|
|
10
|
+
"fade-in__wrapper": "_fade-in__wrapper_8gs3t_115"
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
_ as s
|
|
14
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var o = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2
|
+
function l(e) {
|
|
3
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4
|
+
}
|
|
5
|
+
export {
|
|
6
|
+
o as c,
|
|
7
|
+
l as g
|
|
8
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._results-
|
|
1
|
+
._results-table_8gs3t_1{margin-bottom:2.5em}._results-table__row_8gs3t_4{display:flex;justify-content:space-evenly;margin:0}._results-table__item_8gs3t_9,._results-table__header_8gs3t_9{display:grid;flex:1 1 20%;align-items:center;padding:.6em 1.4em;border-right:1px solid}._results-table__title-row_8gs3t_16{display:flex;justify-content:space-between;margin:0 0 1.4em auto}._results-table__title_8gs3t_16{padding-left:1.6em}._results-table__mobile-label_8gs3t_24{display:none}._results-table__header_8gs3t_9{font-weight:700;text-transform:uppercase}._results-table__item_8gs3t_9:last-child,._results-table__header_8gs3t_9:last-child{border-right:none}._results-table__no-results_8gs3t_34{padding:1em 0;text-align:center}._results-table--compact_8gs3t_40 ._results-table__item_8gs3t_9{display:flex;gap:.6em;align-items:flex-end;padding:.4em .8em .4em 0;border-right:none}._results-table--compact_8gs3t_40 ._results-table__mobile-label_8gs3t_24{display:inline-block;flex:0 0 4em;font-weight:700}._results-table--compact_8gs3t_40 ._results-table__header-row_8gs3t_52{display:none}._results-table--compact_8gs3t_40 ._results-table__row_8gs3t_4{flex-direction:column;justify-content:flex-start;padding:.7em 0;border-top:1px dotted}._results-table--compact_8gs3t_40 ._results-table__row_8gs3t_4:first-of-type,._results-table--compact_8gs3t_40 ._results-table__row_8gs3t_4:nth-of-type(2){padding-top:0;border-top:none}._results-table--compact_8gs3t_40 ._results-table__title_8gs3t_16{padding-left:.8em;font-size:1.2em}._results-table--compact_8gs3t_40 ._results-table__title-row_8gs3t_16{margin-bottom:0}._results-table--compact_8gs3t_40 ._results-table__hide-on-mobile_8gs3t_72{display:none}@media screen and (max-width:768px){._results-table__item_8gs3t_9{display:flex;padding:.4em .8em;border-right:none}._results-table__mobile-label_8gs3t_24{display:inline-block;flex:0 0 4.5em;font-weight:700}._results-table__header-row_8gs3t_52{display:none}._results-table__row_8gs3t_4{flex-direction:column;justify-content:flex-start;padding:.7em 0;border-bottom:1px dotted}._results-table__row_8gs3t_4:last-of-type{padding:1.5em 0;border-bottom:none}._results-table__row_8gs3t_4:nth-of-type(2){padding-top:0}._results-table__title_8gs3t_16{padding-left:.8em;font-size:1.2em}._results-table__title-row_8gs3t_16{margin-bottom:0}._results-table__hide-on-mobile_8gs3t_72{display:none}}@media(prefers-reduced-motion:no-preference){._fade-in__wrapper_8gs3t_115{animation-name:_page-fade-in_8gs3t_1;animation-duration:625ms;animation-fill-mode:backwards}}@keyframes _page-fade-in_8gs3t_1{0%{opacity:0}to{opacity:1}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.schedule-content-constrainer{min-height:100vh;min-height:100dvh}sticky-content-wrapper{display:block;position:sticky;z-index:10;top:-1px}sticky-content-wrapper[data-pinned-state=pinned]{background-image:radial-gradient(ellipse at top left,var(--theme-color-200) 0,var(--theme-color-200) 50%,var(--theme-color-100) 90%)}.date-navigation__list:before{content:"";width:0;height:0;border-style:solid;border-width:0 14px 14px;border-color:transparent transparent var(--mono-color-100) transparent;position:absolute;bottom:-1px;transform:translate(calc(var(--pointer-position) - 100%));transition:transform .325s ease-in-out}@media screen and (max-width:80rem){.schedule-content-constrainer{padding-top:.01rem}}@media screen and (max-width:60rem){.schedule-date-nav-constrainer{width:calc(100% - 1.8rem);padding-block-start:.5rem}.schedule-page .header-divider{display:none}sticky-content-wrapper{top:5rem}}
|
|
1
|
+
schedule-layout{display:block}.schedule-content-constrainer{min-height:100vh;min-height:100dvh}sticky-content-wrapper{display:block;position:sticky;z-index:10;top:-1px}sticky-content-wrapper[data-pinned-state=pinned]{background-image:radial-gradient(ellipse at top left,var(--theme-color-200) 0,var(--theme-color-200) 50%,var(--theme-color-100) 90%)}.date-navigation__list:before{content:"";width:0;height:0;border-style:solid;border-width:0 14px 14px;border-color:transparent transparent var(--mono-color-100) transparent;position:absolute;bottom:-1px;transform:translate(calc(var(--pointer-position) - 100%));transition:transform .325s ease-in-out}@media screen and (max-width:80rem){.schedule-content-constrainer{padding-top:.01rem}}@media screen and (max-width:60rem){.schedule-date-nav-constrainer{width:calc(100% - 1.8rem);padding-block-start:.5rem}.schedule-page .header-divider{display:none}sticky-content-wrapper{top:5rem}}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { v as b, d as r, b as m, a as p, i as s, r as a, g as o, s as l, c as d, w as h } from "../../react.esm-DLSrfVwM.mjs";
|
|
3
|
+
import { u } from "../../index-BUN4jQ3m.mjs";
|
|
4
|
+
import "../../index-BVxBrkZB.mjs";
|
|
5
|
+
import { ActionButton as c } from "./ActionButton.js";
|
|
6
|
+
b.mock("../../utils/events", async () => ({
|
|
7
|
+
...await b.importActual("../../utils/events"),
|
|
8
|
+
publish: b.fn()
|
|
9
|
+
}));
|
|
10
|
+
r("ActionButton", () => {
|
|
11
|
+
m(() => {
|
|
12
|
+
b.clearAllMocks();
|
|
13
|
+
}), p(() => {
|
|
14
|
+
b.clearAllMocks();
|
|
15
|
+
}), r("Basic Rendering", () => {
|
|
16
|
+
s("should render with label text", () => {
|
|
17
|
+
a(/* @__PURE__ */ n(c, { label: "Click Me" })), o(l.getByRole("button", { name: /click me/i })).toBeInTheDocument();
|
|
18
|
+
}), s("should render with default button type", () => {
|
|
19
|
+
a(/* @__PURE__ */ n(c, { label: "Submit" }));
|
|
20
|
+
const t = l.getByRole("button");
|
|
21
|
+
o(t).toHaveAttribute("type", "button");
|
|
22
|
+
}), s("should render with custom button type", () => {
|
|
23
|
+
a(/* @__PURE__ */ n(c, { label: "Submit", type: "submit" }));
|
|
24
|
+
const t = l.getByRole("button");
|
|
25
|
+
o(t).toHaveAttribute("type", "submit");
|
|
26
|
+
}), s("should apply custom className", () => {
|
|
27
|
+
a(/* @__PURE__ */ n(c, { classname: "custom-class", label: "Test" }));
|
|
28
|
+
const t = l.getByRole("button");
|
|
29
|
+
o(t).toHaveClass("custom-class");
|
|
30
|
+
}), s("should apply variant class when provided", () => {
|
|
31
|
+
const { container: t } = a(/* @__PURE__ */ n(c, { label: "Test", varient: "primary" })), e = t.querySelector(".action-btn--primary");
|
|
32
|
+
o(e).toBeInTheDocument();
|
|
33
|
+
}), s("should apply size class when provided", () => {
|
|
34
|
+
const { container: t } = a(/* @__PURE__ */ n(c, { label: "Test", size: "large" })), e = t.querySelector(".action-btn--large");
|
|
35
|
+
o(e).toBeInTheDocument();
|
|
36
|
+
});
|
|
37
|
+
}), r("Click Handling", () => {
|
|
38
|
+
s("should call onClick handler when clicked", async () => {
|
|
39
|
+
const t = u.setup(), e = b.fn();
|
|
40
|
+
a(/* @__PURE__ */ n(c, { label: "Click Me", onClick: e }));
|
|
41
|
+
const i = l.getByRole("button");
|
|
42
|
+
await t.click(i), o(e).toHaveBeenCalledTimes(1);
|
|
43
|
+
}), s("should publish event when clicked", async () => {
|
|
44
|
+
const { publish: t } = await import("../../utils/events.js"), e = u.setup();
|
|
45
|
+
a(/* @__PURE__ */ n(c, { label: "Click Me" }));
|
|
46
|
+
const i = l.getByRole("button");
|
|
47
|
+
await e.click(i), o(t).toHaveBeenCalledWith("scripps:actionbtn:clicked");
|
|
48
|
+
}), s("should change to waiting state when clicked", async () => {
|
|
49
|
+
const t = u.setup();
|
|
50
|
+
a(/* @__PURE__ */ n(c, { label: "Click Me" }));
|
|
51
|
+
const e = l.getByRole("button");
|
|
52
|
+
o(l.getByText("Click Me")).toBeInTheDocument(), await t.click(e), o(l.queryByText("Click Me")).not.toBeInTheDocument();
|
|
53
|
+
const i = e.querySelector(".dots-pulse");
|
|
54
|
+
o(i).toBeInTheDocument();
|
|
55
|
+
}), s("should not call onClick when disabled", async () => {
|
|
56
|
+
const t = u.setup(), e = b.fn();
|
|
57
|
+
a(/* @__PURE__ */ n(c, { disabled: !0, label: "Click Me", onClick: e }));
|
|
58
|
+
const i = l.getByRole("button");
|
|
59
|
+
await t.click(i), o(e).not.toHaveBeenCalled();
|
|
60
|
+
});
|
|
61
|
+
}), r("Disabled State", () => {
|
|
62
|
+
s("should be disabled when disabled prop is true", () => {
|
|
63
|
+
a(/* @__PURE__ */ n(c, { disabled: !0, label: "Test" }));
|
|
64
|
+
const t = l.getByRole("button");
|
|
65
|
+
o(t).toBeDisabled();
|
|
66
|
+
}), s("should be disabled when in waiting state", async () => {
|
|
67
|
+
const t = u.setup();
|
|
68
|
+
a(/* @__PURE__ */ n(c, { label: "Test" }));
|
|
69
|
+
const e = l.getByRole("button");
|
|
70
|
+
o(e).not.toBeDisabled(), await t.click(e), o(e).toBeDisabled();
|
|
71
|
+
}), s("should remain disabled if already disabled and clicked", async () => {
|
|
72
|
+
const t = u.setup();
|
|
73
|
+
a(/* @__PURE__ */ n(c, { disabled: !0, label: "Test" }));
|
|
74
|
+
const e = l.getByRole("button");
|
|
75
|
+
o(e).toBeDisabled(), await t.click(e), o(e).toBeDisabled(), o(l.getByText("Test")).toBeInTheDocument();
|
|
76
|
+
});
|
|
77
|
+
}), r("Custom Colors", () => {
|
|
78
|
+
s("should apply custom background color", () => {
|
|
79
|
+
a(/* @__PURE__ */ n(c, { customColors: {
|
|
80
|
+
bgColor: "#ff0000",
|
|
81
|
+
bgHoverColor: "#cc0000",
|
|
82
|
+
color: "#ffffff",
|
|
83
|
+
hoverColor: "#eeeeee",
|
|
84
|
+
borderColor: "#ff0000",
|
|
85
|
+
borderHoverColor: "#cc0000"
|
|
86
|
+
}, label: "Test" }));
|
|
87
|
+
const e = l.getByRole("button");
|
|
88
|
+
o(e).toHaveStyle({ "--button-bg-color": "#ff0000" }), o(e).toHaveStyle({ "--button-color": "#ffffff" });
|
|
89
|
+
}), s("should use default hover colors when not provided", () => {
|
|
90
|
+
a(/* @__PURE__ */ n(c, { customColors: {
|
|
91
|
+
bgColor: "#ff0000",
|
|
92
|
+
bgHoverColor: "",
|
|
93
|
+
color: "#ffffff",
|
|
94
|
+
hoverColor: "",
|
|
95
|
+
borderColor: "",
|
|
96
|
+
borderHoverColor: ""
|
|
97
|
+
}, label: "Test" }));
|
|
98
|
+
const e = l.getByRole("button");
|
|
99
|
+
o(e).toHaveStyle({ "--button-hover-bg-color": "#ff0000" }), o(e).toHaveStyle({ "--button-hover-color": "#ffffff" });
|
|
100
|
+
}), s("should not apply custom styles when bgColor is empty", () => {
|
|
101
|
+
const t = {
|
|
102
|
+
bgColor: "",
|
|
103
|
+
bgHoverColor: "",
|
|
104
|
+
color: "",
|
|
105
|
+
hoverColor: "",
|
|
106
|
+
borderColor: "",
|
|
107
|
+
borderHoverColor: ""
|
|
108
|
+
}, { container: e } = a(/* @__PURE__ */ n(c, { customColors: t, label: "Test" }));
|
|
109
|
+
console.warn(e.innerHTML);
|
|
110
|
+
const i = l.getByRole("button");
|
|
111
|
+
o(i.getAttribute("style")).toBeFalsy();
|
|
112
|
+
});
|
|
113
|
+
}), r("Event Subscription", () => {
|
|
114
|
+
s("should return to idle state when action completed event is triggered", async () => {
|
|
115
|
+
const t = u.setup();
|
|
116
|
+
a(/* @__PURE__ */ n(c, { label: "Test Button" }));
|
|
117
|
+
const e = l.getByRole("button");
|
|
118
|
+
await t.click(e), o(l.queryByText("Test Button")).not.toBeInTheDocument(), o(e).toBeDisabled(), await d(async () => {
|
|
119
|
+
const i = new CustomEvent("scripps:action:completed");
|
|
120
|
+
document.dispatchEvent(i);
|
|
121
|
+
}), await h(() => {
|
|
122
|
+
o(l.getByText("Test Button")).toBeInTheDocument(), o(e).not.toBeDisabled();
|
|
123
|
+
});
|
|
124
|
+
}), s("should handle multiple action cycles", async () => {
|
|
125
|
+
const t = u.setup();
|
|
126
|
+
a(/* @__PURE__ */ n(c, { label: "Test Button" }));
|
|
127
|
+
const e = l.getByRole("button");
|
|
128
|
+
await t.click(e), o(e).toBeDisabled(), await d(async () => {
|
|
129
|
+
const i = new CustomEvent("scripps:action:completed");
|
|
130
|
+
document.dispatchEvent(i);
|
|
131
|
+
}), await h(() => {
|
|
132
|
+
o(e).not.toBeDisabled();
|
|
133
|
+
}), await t.click(e), o(e).toBeDisabled(), await d(async () => {
|
|
134
|
+
const i = new CustomEvent("scripps:action:completed");
|
|
135
|
+
document.dispatchEvent(i);
|
|
136
|
+
}), await h(() => {
|
|
137
|
+
o(e).not.toBeDisabled(), o(l.getByText("Test Button")).toBeInTheDocument();
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}), r("Additional Attributes", () => {
|
|
141
|
+
s("should pass through additional attributes", () => {
|
|
142
|
+
a(
|
|
143
|
+
/* @__PURE__ */ n(
|
|
144
|
+
c,
|
|
145
|
+
{
|
|
146
|
+
"aria-label": "Custom aria label",
|
|
147
|
+
"data-testid": "custom-button",
|
|
148
|
+
label: "Test"
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
);
|
|
152
|
+
const t = l.getByRole("button");
|
|
153
|
+
o(t).toHaveAttribute("data-testid", "custom-button"), o(t).toHaveAttribute("aria-label", "Custom aria label");
|
|
154
|
+
}), s("should handle multiple custom attributes", () => {
|
|
155
|
+
a(
|
|
156
|
+
/* @__PURE__ */ n(
|
|
157
|
+
c,
|
|
158
|
+
{
|
|
159
|
+
"aria-describedby": "description",
|
|
160
|
+
"data-tracking": "track-click",
|
|
161
|
+
id: "my-button",
|
|
162
|
+
label: "Test"
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
);
|
|
166
|
+
const t = l.getByRole("button");
|
|
167
|
+
o(t).toHaveAttribute("id", "my-button"), o(t).toHaveAttribute("data-tracking", "track-click"), o(t).toHaveAttribute("aria-describedby", "description");
|
|
168
|
+
});
|
|
169
|
+
}), r("Loading State Display", () => {
|
|
170
|
+
s("should display label in idle state", () => {
|
|
171
|
+
a(/* @__PURE__ */ n(c, { label: "Submit Form" })), o(l.getByText("Submit Form")).toBeInTheDocument();
|
|
172
|
+
}), s("should display loading dots in waiting state", async () => {
|
|
173
|
+
const t = u.setup(), { container: e } = a(/* @__PURE__ */ n(c, { label: "Submit Form" }));
|
|
174
|
+
await t.click(l.getByRole("button"));
|
|
175
|
+
const i = e.querySelector(".dots-pulse");
|
|
176
|
+
o(i).toBeInTheDocument();
|
|
177
|
+
const y = i == null ? void 0 : i.querySelectorAll("span");
|
|
178
|
+
o(y).toHaveLength(3);
|
|
179
|
+
}), s("should hide label when in waiting state", async () => {
|
|
180
|
+
const t = u.setup();
|
|
181
|
+
a(/* @__PURE__ */ n(c, { label: "Submit Form" })), o(l.getByText("Submit Form")).toBeInTheDocument(), await t.click(l.getByRole("button")), o(l.queryByText("Submit Form")).not.toBeInTheDocument();
|
|
182
|
+
});
|
|
183
|
+
}), r("Edge Cases", () => {
|
|
184
|
+
s("should handle click with no onClick handler provided", async () => {
|
|
185
|
+
const t = u.setup();
|
|
186
|
+
a(/* @__PURE__ */ n(c, { label: "Test" }));
|
|
187
|
+
const e = l.getByRole("button");
|
|
188
|
+
await o(t.click(e)).resolves.not.toThrow();
|
|
189
|
+
}), s("should handle empty variant and size strings", () => {
|
|
190
|
+
a(/* @__PURE__ */ n(c, { label: "Test", size: "", varient: "" }));
|
|
191
|
+
const t = l.getByRole("button");
|
|
192
|
+
o(t).toBeInTheDocument();
|
|
193
|
+
}), s("should handle multiple rapid clicks", async () => {
|
|
194
|
+
const t = u.setup(), e = b.fn();
|
|
195
|
+
a(/* @__PURE__ */ n(c, { label: "Test", onClick: e }));
|
|
196
|
+
const i = l.getByRole("button");
|
|
197
|
+
await t.click(i), o(e).toHaveBeenCalledTimes(1), await t.click(i), o(e).toHaveBeenCalledTimes(1);
|
|
198
|
+
});
|
|
199
|
+
}), r("Accessibility", () => {
|
|
200
|
+
s("should be keyboard accessible", async () => {
|
|
201
|
+
const t = u.setup(), e = b.fn();
|
|
202
|
+
a(/* @__PURE__ */ n(c, { label: "Test", onClick: e }));
|
|
203
|
+
const i = l.getByRole("button");
|
|
204
|
+
i.focus(), o(i).toHaveFocus(), await t.keyboard("{Enter}"), o(e).toHaveBeenCalled();
|
|
205
|
+
}), s("should have button role", () => {
|
|
206
|
+
a(/* @__PURE__ */ n(c, { label: "Test" })), o(l.getByRole("button")).toBeInTheDocument();
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
});
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
var f = Object.defineProperty;
|
|
2
|
+
var v = (o, n, e) => n in o ? f(o, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[n] = e;
|
|
3
|
+
var m = (o, n, e) => v(o, typeof n != "symbol" ? n + "" : n, e);
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
import { v as d, d as u, b as I, a as x, i, r as s, g as t, s as l, c as y } from "../../react.esm-DLSrfVwM.mjs";
|
|
6
|
+
import { u as T } from "../../index-BUN4jQ3m.mjs";
|
|
7
|
+
import { AdBlock as c } from "./AdBlock.js";
|
|
8
|
+
const B = d.fn();
|
|
9
|
+
u("AdBlock", () => {
|
|
10
|
+
const o = {
|
|
11
|
+
url: "https://example.com/image.jpg",
|
|
12
|
+
altText: "Test Ad Image",
|
|
13
|
+
mobile: "https://example.com/mobile-image.jpg",
|
|
14
|
+
text: "Sponsored Content"
|
|
15
|
+
}, n = {
|
|
16
|
+
campaign: "summer-sale",
|
|
17
|
+
source: "website",
|
|
18
|
+
medium: "banner",
|
|
19
|
+
content: "homepage",
|
|
20
|
+
header: "Amazing Product",
|
|
21
|
+
description: "Get the best deals on our amazing product!",
|
|
22
|
+
linkText: "Shop Now",
|
|
23
|
+
href: "https://example.com/shop"
|
|
24
|
+
};
|
|
25
|
+
I(() => {
|
|
26
|
+
window.open = B, global.IntersectionObserver = class {
|
|
27
|
+
constructor(a) {
|
|
28
|
+
m(this, "root", null);
|
|
29
|
+
m(this, "rootMargin", "0px");
|
|
30
|
+
m(this, "thresholds", [0]);
|
|
31
|
+
m(this, "observe", d.fn());
|
|
32
|
+
m(this, "unobserve", d.fn());
|
|
33
|
+
m(this, "disconnect", d.fn());
|
|
34
|
+
m(this, "takeRecords", d.fn(() => []));
|
|
35
|
+
this.callback = a;
|
|
36
|
+
}
|
|
37
|
+
// Helper to trigger callback
|
|
38
|
+
triggerIntersection(a) {
|
|
39
|
+
this.callback(
|
|
40
|
+
[{ isIntersecting: a, target: document.createElement("div") }],
|
|
41
|
+
this
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}), x(() => {
|
|
46
|
+
d.clearAllMocks();
|
|
47
|
+
}), u("Basic Rendering", () => {
|
|
48
|
+
i("should render with default theme", () => {
|
|
49
|
+
const { container: e } = s(/* @__PURE__ */ r(c, { ad: n, image: o }));
|
|
50
|
+
t(e.querySelector("ad-block")).toBeInTheDocument();
|
|
51
|
+
}), i("should render ad header", () => {
|
|
52
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o })), t(l.getByText("Amazing Product")).toBeInTheDocument();
|
|
53
|
+
}), i("should render ad description", () => {
|
|
54
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o })), t(l.getByText("Get the best deals on our amazing product!")).toBeInTheDocument();
|
|
55
|
+
}), i("should render link text", () => {
|
|
56
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o })), t(l.getByText("Shop Now")).toBeInTheDocument();
|
|
57
|
+
}), i("should render image with correct alt text", () => {
|
|
58
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o })), t(l.getByAltText("Test Ad Image")).toBeInTheDocument();
|
|
59
|
+
}), i("should render sponsored content text", () => {
|
|
60
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o })), t(l.getByText("Sponsored Content")).toBeInTheDocument();
|
|
61
|
+
});
|
|
62
|
+
}), u("Theme Variants", () => {
|
|
63
|
+
i("should render with default theme when no theme specified", () => {
|
|
64
|
+
const { container: e } = s(/* @__PURE__ */ r(c, { ad: n, image: o }));
|
|
65
|
+
t(e.querySelector("ad-block")).toBeInTheDocument();
|
|
66
|
+
}), i("should render with round2 theme", () => {
|
|
67
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o, theme: "round2" })), t(l.getByText("Amazing Product")).toBeInTheDocument();
|
|
68
|
+
}), i("should render with tablotv theme", () => {
|
|
69
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o, theme: "tablotv" })), t(l.getByText("Amazing Product")).toBeInTheDocument();
|
|
70
|
+
const e = l.getAllByAltText("Test Ad Image");
|
|
71
|
+
t(e.length).toBeGreaterThan(0);
|
|
72
|
+
}), i("should render with imageonly theme", () => {
|
|
73
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o, theme: "imageonly" })), t(l.getByText("Sponsored Content")).toBeInTheDocument();
|
|
74
|
+
}), i("should use mobile image for tablotv theme", () => {
|
|
75
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o, theme: "tablotv" }));
|
|
76
|
+
const e = l.getAllByAltText("Test Ad Image").find(
|
|
77
|
+
(a) => a.getAttribute("src") === o.mobile
|
|
78
|
+
);
|
|
79
|
+
t(e).toBeInTheDocument();
|
|
80
|
+
}), i("should not render header and description for imageonly theme", () => {
|
|
81
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o, theme: "imageonly" })), t(l.queryByText("Amazing Product")).not.toBeInTheDocument(), t(l.queryByText("Get the best deals on our amazing product!")).not.toBeInTheDocument();
|
|
82
|
+
});
|
|
83
|
+
}), u("UTM Parameters", () => {
|
|
84
|
+
i("should construct link with UTM parameters", () => {
|
|
85
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o }));
|
|
86
|
+
const e = l.getByText("Shop Now").closest("a");
|
|
87
|
+
t(e == null ? void 0 : e.href).toContain("utm_campaign=summer-sale"), t(e == null ? void 0 : e.href).toContain("utm_source=website"), t(e == null ? void 0 : e.href).toContain("utm_medium=banner"), t(e == null ? void 0 : e.href).toContain("utm_content=homepage");
|
|
88
|
+
}), i("should construct link without UTM parameters when campaign is empty", () => {
|
|
89
|
+
const e = { ...n, campaign: "" };
|
|
90
|
+
s(/* @__PURE__ */ r(c, { ad: e, image: o }));
|
|
91
|
+
const a = l.getByText("Shop Now").closest("a");
|
|
92
|
+
t(a == null ? void 0 : a.href).toBe("https://example.com/shop"), t(a == null ? void 0 : a.href).not.toContain("utm_campaign");
|
|
93
|
+
}), i("should have correct href structure", () => {
|
|
94
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o }));
|
|
95
|
+
const e = l.getByText("Shop Now").closest("a");
|
|
96
|
+
t(e == null ? void 0 : e.href).toBe(
|
|
97
|
+
"https://example.com/shop?utm_campaign=summer-sale&utm_source=website&utm_medium=banner&utm_content=homepage"
|
|
98
|
+
);
|
|
99
|
+
});
|
|
100
|
+
}), u("Link Attributes", () => {
|
|
101
|
+
i('should have target="_blank" on links', () => {
|
|
102
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o })), l.getAllByRole("link").forEach((a) => {
|
|
103
|
+
t(a).toHaveAttribute("target", "_blank");
|
|
104
|
+
});
|
|
105
|
+
}), i('should have rel="noreferrer" on links', () => {
|
|
106
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o })), l.getAllByRole("link").forEach((a) => {
|
|
107
|
+
t(a).toHaveAttribute("rel", "noreferrer");
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
}), u("Click Handling", () => {
|
|
111
|
+
i("should open link in new tab when ad block is clicked", async () => {
|
|
112
|
+
const e = T.setup(), { container: a } = s(/* @__PURE__ */ r(c, { ad: n, image: o })), h = a.querySelector("ad-block");
|
|
113
|
+
h && (await e.click(h), t(B).toHaveBeenCalled());
|
|
114
|
+
}), i("should prevent default and open link when CTA is clicked directly", async () => {
|
|
115
|
+
T.setup(), s(/* @__PURE__ */ r(c, { ad: n, image: o }));
|
|
116
|
+
const e = l.getByText("Shop Now"), a = d.fn(), { container: h } = s(/* @__PURE__ */ r(c, { ad: n, image: o })), g = h.querySelector("ad-block");
|
|
117
|
+
if (g) {
|
|
118
|
+
const p = new MouseEvent("click", { bubbles: !0 });
|
|
119
|
+
Object.defineProperty(p, "target", { value: e, enumerable: !0 }), Object.defineProperty(p, "preventDefault", { value: a, enumerable: !0 }), g.dispatchEvent(p);
|
|
120
|
+
}
|
|
121
|
+
}), i("should open correct URL when clicked", async () => {
|
|
122
|
+
const e = T.setup(), { container: a } = s(/* @__PURE__ */ r(c, { ad: n, image: o })), h = a.querySelector("ad-block");
|
|
123
|
+
h && (await e.click(h), t(B).toHaveBeenCalled());
|
|
124
|
+
});
|
|
125
|
+
}), u("IntersectionObserver", () => {
|
|
126
|
+
i("should create IntersectionObserver for default theme", () => {
|
|
127
|
+
const e = d.fn();
|
|
128
|
+
global.IntersectionObserver = class {
|
|
129
|
+
constructor() {
|
|
130
|
+
m(this, "observe", e);
|
|
131
|
+
m(this, "unobserve", d.fn());
|
|
132
|
+
m(this, "disconnect", d.fn());
|
|
133
|
+
}
|
|
134
|
+
}, s(/* @__PURE__ */ r(c, { ad: n, image: o, theme: "default" })), t(e).toHaveBeenCalled();
|
|
135
|
+
}), i("should not create IntersectionObserver for imageonly theme", () => {
|
|
136
|
+
const e = d.fn();
|
|
137
|
+
global.IntersectionObserver = class {
|
|
138
|
+
constructor() {
|
|
139
|
+
m(this, "observe", e);
|
|
140
|
+
m(this, "unobserve", d.fn());
|
|
141
|
+
m(this, "disconnect", d.fn());
|
|
142
|
+
}
|
|
143
|
+
}, s(/* @__PURE__ */ r(c, { ad: n, image: o, theme: "imageonly" })), t(e).not.toHaveBeenCalled();
|
|
144
|
+
}), i("should disconnect observer on unmount", () => {
|
|
145
|
+
const e = d.fn();
|
|
146
|
+
global.IntersectionObserver = class {
|
|
147
|
+
constructor() {
|
|
148
|
+
m(this, "observe", d.fn());
|
|
149
|
+
m(this, "unobserve", d.fn());
|
|
150
|
+
m(this, "disconnect", e);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
const { unmount: a } = s(/* @__PURE__ */ r(c, { ad: n, image: o }));
|
|
154
|
+
a(), t(e).toHaveBeenCalled();
|
|
155
|
+
});
|
|
156
|
+
}), u("Animation Triggers", () => {
|
|
157
|
+
i("should add animation classes when element intersects", async () => {
|
|
158
|
+
let e, a;
|
|
159
|
+
const h = d.fn();
|
|
160
|
+
global.IntersectionObserver = class {
|
|
161
|
+
constructor(b) {
|
|
162
|
+
m(this, "observe", d.fn((b) => {
|
|
163
|
+
a = b;
|
|
164
|
+
}));
|
|
165
|
+
m(this, "unobserve", h);
|
|
166
|
+
m(this, "disconnect", d.fn());
|
|
167
|
+
e = b;
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
const { container: g } = s(/* @__PURE__ */ r(c, { ad: n, image: o, theme: "default" }));
|
|
171
|
+
await y(async () => {
|
|
172
|
+
e && e(
|
|
173
|
+
[{ isIntersecting: !0, target: a }],
|
|
174
|
+
{ unobserve: h }
|
|
175
|
+
);
|
|
176
|
+
}), t(g).toBeInTheDocument(), t(h).toHaveBeenCalled();
|
|
177
|
+
}), i("should not trigger animations when not intersecting", async () => {
|
|
178
|
+
let e;
|
|
179
|
+
global.IntersectionObserver = class {
|
|
180
|
+
constructor(g) {
|
|
181
|
+
m(this, "observe", d.fn());
|
|
182
|
+
m(this, "unobserve", d.fn());
|
|
183
|
+
m(this, "disconnect", d.fn());
|
|
184
|
+
e = g;
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
const { container: a } = s(/* @__PURE__ */ r(c, { ad: n, image: o }));
|
|
188
|
+
await y(async () => {
|
|
189
|
+
e && e(
|
|
190
|
+
[{ isIntersecting: !1, target: document.createElement("div") }],
|
|
191
|
+
{}
|
|
192
|
+
);
|
|
193
|
+
}), t(a).toBeInTheDocument();
|
|
194
|
+
});
|
|
195
|
+
}), u("Image Rendering", () => {
|
|
196
|
+
i("should render image with correct src", () => {
|
|
197
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o }));
|
|
198
|
+
const e = l.getByAltText("Test Ad Image");
|
|
199
|
+
t(e).toHaveAttribute("src", o.url);
|
|
200
|
+
}), i("should render multiple images for tablotv theme", () => {
|
|
201
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o, theme: "tablotv" }));
|
|
202
|
+
const e = l.getAllByAltText("Test Ad Image");
|
|
203
|
+
t(e.length).toBe(2);
|
|
204
|
+
}), i("should wrap images in links", () => {
|
|
205
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o }));
|
|
206
|
+
const a = l.getByAltText("Test Ad Image").closest("a");
|
|
207
|
+
t(a).toBeInTheDocument(), t(a == null ? void 0 : a.href).toContain("example.com/shop");
|
|
208
|
+
});
|
|
209
|
+
}), u("Accessibility", () => {
|
|
210
|
+
i("should have screen reader text for imageonly theme", () => {
|
|
211
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o, theme: "imageonly" }));
|
|
212
|
+
const e = l.getByText("Sponsored Content");
|
|
213
|
+
t(e).toHaveClass("sr-only");
|
|
214
|
+
}), i("should have proper alt text on images", () => {
|
|
215
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o }));
|
|
216
|
+
const e = l.getByAltText("Test Ad Image");
|
|
217
|
+
t(e).toHaveAttribute("alt", "Test Ad Image");
|
|
218
|
+
}), i("should have links that are keyboard accessible", () => {
|
|
219
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o })), l.getAllByRole("link").forEach((a) => {
|
|
220
|
+
t(a).toBeInTheDocument();
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
}), u("Edge Cases", () => {
|
|
224
|
+
i("should handle missing optional image properties", () => {
|
|
225
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: {
|
|
226
|
+
url: "https://example.com/image.jpg",
|
|
227
|
+
altText: "Test",
|
|
228
|
+
text: "Sponsored"
|
|
229
|
+
} })), t(l.getByAltText("Test")).toBeInTheDocument();
|
|
230
|
+
}), i("should handle empty strings in ad properties", () => {
|
|
231
|
+
s(/* @__PURE__ */ r(c, { ad: {
|
|
232
|
+
campaign: "",
|
|
233
|
+
source: "",
|
|
234
|
+
medium: "",
|
|
235
|
+
content: "",
|
|
236
|
+
header: "Header",
|
|
237
|
+
description: "Description",
|
|
238
|
+
linkText: "Link",
|
|
239
|
+
href: "https://example.com"
|
|
240
|
+
}, image: o })), t(l.getByText("Header")).toBeInTheDocument();
|
|
241
|
+
}), i("should handle long ad descriptions", () => {
|
|
242
|
+
const e = {
|
|
243
|
+
...n,
|
|
244
|
+
description: "A".repeat(500)
|
|
245
|
+
};
|
|
246
|
+
s(/* @__PURE__ */ r(c, { ad: e, image: o })), t(l.getByText("A".repeat(500))).toBeInTheDocument();
|
|
247
|
+
}), i("should handle special characters in text", () => {
|
|
248
|
+
const e = {
|
|
249
|
+
...n,
|
|
250
|
+
header: 'Special & "Quoted" <Text>',
|
|
251
|
+
description: "It's amazing!"
|
|
252
|
+
};
|
|
253
|
+
s(/* @__PURE__ */ r(c, { ad: e, image: o })), t(l.getByText('Special & "Quoted" <Text>')).toBeInTheDocument(), t(l.getByText("It's amazing!")).toBeInTheDocument();
|
|
254
|
+
}), i("should render correctly with all themes", () => {
|
|
255
|
+
[
|
|
256
|
+
"default",
|
|
257
|
+
"round2",
|
|
258
|
+
"tablotv",
|
|
259
|
+
"imageonly"
|
|
260
|
+
].forEach((a) => {
|
|
261
|
+
const { unmount: h } = s(/* @__PURE__ */ r(c, { ad: n, image: o, theme: a })), g = l.getAllByText("Sponsored Content");
|
|
262
|
+
t(g.length).toBeGreaterThan(0), t(g[0]).toBeInTheDocument(), h();
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
}), u("Custom Elements", () => {
|
|
266
|
+
i("should render ad-block custom element", () => {
|
|
267
|
+
const { container: e } = s(/* @__PURE__ */ r(c, { ad: n, image: o }));
|
|
268
|
+
t(e.querySelector("ad-block")).toBeInTheDocument();
|
|
269
|
+
}), i("should render ad-image custom elements", () => {
|
|
270
|
+
const { container: e } = s(/* @__PURE__ */ r(c, { ad: n, image: o }));
|
|
271
|
+
t(e.querySelector("ad-image")).toBeInTheDocument();
|
|
272
|
+
}), i("should render multiple ad-image elements for tablotv theme", () => {
|
|
273
|
+
const { container: e } = s(/* @__PURE__ */ r(c, { ad: n, image: o, theme: "tablotv" })), a = e.querySelectorAll("ad-image");
|
|
274
|
+
t(a.length).toBe(2);
|
|
275
|
+
});
|
|
276
|
+
}), u("Theme-Specific Layouts", () => {
|
|
277
|
+
i("should render background-container for tablotv theme", () => {
|
|
278
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o, theme: "tablotv" })), t(l.getByText("Shop Now")).toBeInTheDocument();
|
|
279
|
+
}), i("should render cta-container__link for imageonly theme", () => {
|
|
280
|
+
const { container: e } = s(/* @__PURE__ */ r(c, { ad: n, image: o, theme: "imageonly" })), a = e.querySelector("a");
|
|
281
|
+
t(a).toBeInTheDocument(), t(a == null ? void 0 : a.href).toContain("example.com/shop");
|
|
282
|
+
}), i("should have correct structure for default theme", () => {
|
|
283
|
+
s(/* @__PURE__ */ r(c, { ad: n, image: o, theme: "default" })), t(l.getByText("Amazing Product")).toBeInTheDocument(), t(l.getByText("Get the best deals on our amazing product!")).toBeInTheDocument(), t(l.getByText("Shop Now")).toBeInTheDocument();
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
});
|