@scrippsproduct/networks-ui-library 1.1.9 → 1.1.10
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/{chevron-left-DRvpaLmK.mjs → chevron-left-D0UjbrKw.mjs} +1 -1
- package/dist/{chevron-right-C8yCnmfx.mjs → chevron-right-0ZF3LruR.mjs} +1 -1
- package/dist/components/ActionButton/ActionButton.test.js +209 -0
- package/dist/components/AdBlock/AdBlock.test.js +286 -0
- package/dist/components/AdjustableTwoColumnGrid/AdjustableTwoColumnGrid.test.js +295 -0
- package/dist/components/AirDateFormatter/AirDateFormatter.test.js +192 -0
- package/dist/components/AnchorTag/AnchorTag.test.js +463 -0
- package/dist/components/BCVideoPlayer/BCVideoPlayer.test.js +295 -0
- package/dist/components/BasicGridModule/BasicGridModule.js +41 -37
- package/dist/components/BasicGridModule/BasicGridModule.test.js +227 -0
- package/dist/components/Button/Button.test.js +434 -0
- package/dist/components/Carousel/Carousel.js +2 -2
- package/dist/components/Carousel/Carousel.test.js +705 -0
- package/dist/components/CarouselSlide/CarouselSlide.test.js +378 -0
- package/dist/components/CarouselSlide/slide-layouts/TwoColumn/TwoColumnSlide.js +1 -1
- package/dist/components/CastInfoLayout/CastInfoLayout.test.js +294 -0
- package/dist/components/ChannelSearch/ChannelSearch.test.js +565 -0
- package/dist/components/ChoicesItem/ChoicesItem.test.js +428 -0
- package/dist/components/Concat/Concat.js +1 -1
- package/dist/components/Concat/Concat.test.js +115 -0
- package/dist/components/CtaBlock/CtaBlock.js +1 -1
- package/dist/components/CtaBlock/CtaBlock.test.js +226 -0
- package/dist/components/CustomDataList/CustomDataList.js +4 -4
- package/dist/components/CustomSelect/CustomSelect.js +86 -86
- package/dist/components/CustomSelect/CustomSelect.test.js +313 -0
- package/dist/components/DateNavigation/DateNavigation.js +10 -10
- package/dist/components/DateNavigation/DateNavigation.test.js +370 -0
- package/dist/components/DatePicker/DatePicker.js +1 -1
- package/dist/components/DeviceAndPlatformLists/DeviceAndPlatformLists.test.js +288 -0
- package/dist/components/DrawerNavigation/DrawerNavigation.test.js +316 -0
- package/dist/components/EqualSizeFlexRow/EqualSizeFlexRow.test.js +337 -0
- package/dist/components/EqualSizeGrid/EqualSizeGrid.test.js +358 -0
- package/dist/components/ErrorHandler/ErrorHandler.js +2 -2
- package/dist/components/ErrorHandler/ErrorHandler.test.js +158 -0
- package/dist/components/FeaturedList/FeaturedList.test.js +353 -0
- package/dist/components/Figure/Figure.js +1 -1
- package/dist/components/Figure/Figure.test.js +198 -0
- package/dist/components/FindUs/FindUs.test.js +499 -0
- package/dist/components/FooterNavigation/FooterNavigation.test.js +310 -0
- package/dist/components/GenericList/GenericList.js +1 -1
- package/dist/components/GenericList/GenericList.test.js +288 -0
- package/dist/components/GetAirdateWrapper/GetAirdateWrapper.test.js +689 -0
- package/dist/components/GradientButton/GradientButton.d.ts +1 -1
- package/dist/components/GradientButton/GradientButton.js +33 -31
- package/dist/components/GradientButton/GradientButton.test.js +457 -0
- package/dist/components/GridList/GridList.test.js +371 -0
- package/dist/components/ImageCard/ImageCard.test.js +668 -0
- package/dist/components/ImageCard/ImageCardCore.js +28 -28
- package/dist/components/ImageCard/ImageCardCore.test.js +577 -0
- package/dist/components/ImageReplacementAnchor/ImageReplacementAnchor.test.js +379 -0
- package/dist/components/InfoPanel/InfoPanel.js +1 -1
- package/dist/components/InlineNavigation/InlineNavigation.test.js +149 -0
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/Input/Input.test.js +263 -0
- package/dist/components/InstructionsList/InstructionsList.js +11 -11
- package/dist/components/InstructionsList/InstructionsList.test.js +181 -0
- package/dist/components/LogoListItem/LogoListItem.test.js +303 -0
- package/dist/components/LogoNavigation/LogoNavigation.test.js +352 -0
- package/dist/components/ModalContainer/ModalContainer.js +2 -2
- package/dist/components/NavList/NavList.test.js +332 -0
- package/dist/components/Overlay/Overlay.js +24 -23
- package/dist/components/Overlay/Overlay.test.js +198 -0
- package/dist/components/PageHero/PageHero.test.js +241 -0
- package/dist/components/PageHero/page-hero-layouts/IONShow/IONShowHero.js +1 -1
- package/dist/components/ProgramAirdate/ProgramAirdate.js +1 -1
- package/dist/components/ProgramAirdate/ProgramAirdate.test.js +414 -0
- package/dist/components/PromotionBlock/PromotionBlock.test.js +208 -0
- package/dist/components/PromotionsRowBlock/PromotionsRowBlock.test.js +221 -0
- package/dist/components/PromotionsRowModule/PromotionsRowModule.test.js +349 -0
- package/dist/components/RescanInstructions/RescanInstructions.test.js +218 -0
- package/dist/components/ResponsiveImage/ResponsiveImage.test.js +264 -0
- package/dist/components/ResultsTable/ResultsTable.js +9 -2
- package/dist/components/ResultsTable/ResultsTable.test.js +402 -0
- package/dist/components/ResultsTableBody/ResultsTableBody.js +1 -1
- package/dist/components/ResultsTableBody/ResultsTableBody.test.js +445 -0
- package/dist/components/ResultsTableHeader/ResultsTableHeader.js +37 -15
- package/dist/components/ResultsTableHeader/ResultsTableHeader.test.js +275 -0
- package/dist/components/ScheduleLayout/ScheduleContext.js +654 -626
- package/dist/components/ScheduleLayout/ScheduleLayout.js +1 -1
- package/dist/components/ScheduleLayout/useScheduleContext.js +5 -10
- package/dist/components/ScheduleList/ScheduleList.js +1 -1
- package/dist/components/SectionedContent/SectionedContent.js +1 -1
- package/dist/components/SectionedContent/SectionedContent.test.js +341 -0
- package/dist/components/Select/Select.js +24 -24
- package/dist/components/Select/Select.test.js +367 -0
- package/dist/components/ShowAboutContent/ShowAboutContent.js +1 -1
- package/dist/components/ShowAboutContent/ShowAboutContent.test.js +535 -0
- package/dist/components/ShowAboutLayout/ShowAboutLayout.test.js +570 -0
- package/dist/components/SocialLinks/SocialLinks.js +1 -1
- package/dist/components/StringList/StringList.js +1 -1
- package/dist/components/StringList/StringList.test.js +311 -0
- package/dist/components/TabContent/TabContent.js +1 -1
- package/dist/components/TabContent/TabContent.test.js +274 -0
- package/dist/components/TabNavigation/TabNavigation.js +21 -21
- package/dist/components/TabNavigation/TabNavigation.test.js +535 -0
- package/dist/components/TabbedContent/TabbedContent.test.js +654 -0
- package/dist/components/TextArea/TextArea.js +1 -1
- package/dist/components/UpcomingList/UpcomingList.test.js +471 -0
- package/dist/{index-VjANCDXC.mjs → index-06PEPfBQ.mjs} +1 -1
- package/dist/index-BUN4jQ3m.mjs +3098 -0
- package/dist/index-BVxBrkZB.mjs +3 -0
- package/dist/{index-DC2JJV3a.mjs → index-D3kkcgee.mjs} +1 -1
- package/dist/{index-C-kn9Zhn.mjs → index-DzfYkULW.mjs} +2 -1
- package/dist/magic-string.es-uPKorP4O.mjs +663 -0
- package/dist/matchers-35e4d3bd-BBPNTlen.mjs +2404 -0
- package/dist/react.esm-DLSrfVwM.mjs +23410 -0
- package/dist/test/setupTests.d.ts +1 -0
- package/dist/test/setupTests.js +55 -0
- package/dist/{triangle-PcCcGXjr.mjs → triangle-C4z906Wf.mjs} +1 -1
- package/dist/useScheduleContext-D7FdzNxe.mjs +17 -0
- package/dist/utils/analytics.js +1 -1
- package/dist/utils/getOnNowProgram.js +10 -10
- package/dist/{x-C-QzJ-qD.mjs → x-Ck9Vk5Fo.mjs} +1 -1
- package/package.json +4 -1
- package/dist/ResultsTable.module-1zxhXaem.mjs +0 -14
- package/dist/_commonjsHelpers-C6fGbg64.mjs +0 -6
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { d, b, a as w, i as a, r, g as n, s, w as p, f as B, c as _, v as T } from "../../react.esm-DLSrfVwM.mjs";
|
|
3
|
+
import { u } from "../../index-BUN4jQ3m.mjs";
|
|
4
|
+
import "../../index-BVxBrkZB.mjs";
|
|
5
|
+
import { DrawerNavigation as i } from "./DrawerNavigation.js";
|
|
6
|
+
const h = () => [
|
|
7
|
+
{ href: "/home", label: "Home" },
|
|
8
|
+
{ href: "/about", label: "About" },
|
|
9
|
+
{ href: "/contact", label: "Contact" }
|
|
10
|
+
], y = () => [
|
|
11
|
+
{
|
|
12
|
+
href: "https://example.com/1",
|
|
13
|
+
image: { url: "/logo1.png", width: 100, height: 50, altText: "", aspectRatio: 2 },
|
|
14
|
+
altText: "",
|
|
15
|
+
title: "Partner 1"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
href: "https://example.com/2",
|
|
19
|
+
image: { url: "/logo2.png", width: 100, height: 50, altText: "", aspectRatio: 2 },
|
|
20
|
+
altText: "",
|
|
21
|
+
title: "Partner 2"
|
|
22
|
+
}
|
|
23
|
+
], v = () => ({
|
|
24
|
+
image: { url: "/main-logo.png", width: 150, height: 75, altText: "", aspectRatio: 2 },
|
|
25
|
+
href: "/",
|
|
26
|
+
baselineAdjustment: 5,
|
|
27
|
+
height: 60
|
|
28
|
+
});
|
|
29
|
+
d("DrawerNavigation", () => {
|
|
30
|
+
let g;
|
|
31
|
+
b(() => {
|
|
32
|
+
g = document.createElement("div"), g.id = "root", document.body.appendChild(g);
|
|
33
|
+
}), w(() => {
|
|
34
|
+
document.body.removeChild(g), document.body.style.overflowY = "";
|
|
35
|
+
}), d("Basic Rendering", () => {
|
|
36
|
+
a("should render navigation bar", () => {
|
|
37
|
+
const { container: t } = r(/* @__PURE__ */ o(i, {})), e = t.querySelector(".drawer-navigation__nav-bar");
|
|
38
|
+
n(e).toBeInTheDocument();
|
|
39
|
+
}), a("should render menu toggle button", () => {
|
|
40
|
+
r(/* @__PURE__ */ o(i, {}));
|
|
41
|
+
const t = s.getByRole("button", { name: /menu/i });
|
|
42
|
+
n(t).toBeInTheDocument();
|
|
43
|
+
}), a("should render primary navigation", () => {
|
|
44
|
+
const { container: t } = r(/* @__PURE__ */ o(i, {})), e = t.querySelector(".drawer-navigation__primary-navigation");
|
|
45
|
+
n(e).toBeInTheDocument();
|
|
46
|
+
}), a("should have correct id on primary navigation", () => {
|
|
47
|
+
const { container: t } = r(/* @__PURE__ */ o(i, {})), e = t.querySelector("#drawer-navigation__primary-navigation");
|
|
48
|
+
n(e).toBeInTheDocument();
|
|
49
|
+
}), a("should render hamburger icon", () => {
|
|
50
|
+
const { container: t } = r(/* @__PURE__ */ o(i, {})), e = t.querySelector(".drawer-navigation__hamburger");
|
|
51
|
+
n(e).toBeInTheDocument();
|
|
52
|
+
}), a("should have visually hidden menu text", () => {
|
|
53
|
+
const { container: t } = r(/* @__PURE__ */ o(i, {})), e = t.querySelector(".visually-hidden");
|
|
54
|
+
n(e).toHaveTextContent("Menu");
|
|
55
|
+
});
|
|
56
|
+
}), d("Menu Toggle Functionality", () => {
|
|
57
|
+
a("should start with menu closed", () => {
|
|
58
|
+
r(/* @__PURE__ */ o(i, {}));
|
|
59
|
+
const t = s.getByRole("button", { name: /menu/i });
|
|
60
|
+
n(t).toHaveAttribute("aria-expanded", "false");
|
|
61
|
+
}), a("should open menu when button clicked", async () => {
|
|
62
|
+
const t = u.setup();
|
|
63
|
+
r(/* @__PURE__ */ o(i, {}));
|
|
64
|
+
const e = s.getByRole("button", { name: /menu/i });
|
|
65
|
+
await t.click(e), n(e).toHaveAttribute("aria-expanded", "true");
|
|
66
|
+
}), a("should close menu when button clicked again", async () => {
|
|
67
|
+
const t = u.setup();
|
|
68
|
+
r(/* @__PURE__ */ o(i, {}));
|
|
69
|
+
const e = s.getByRole("button", { name: /menu/i });
|
|
70
|
+
await t.click(e), await t.click(e), n(e).toHaveAttribute("aria-expanded", "false");
|
|
71
|
+
}), a("should set body overflow hidden when menu opens", async () => {
|
|
72
|
+
const t = u.setup();
|
|
73
|
+
r(/* @__PURE__ */ o(i, {}));
|
|
74
|
+
const e = s.getByRole("button", { name: /menu/i });
|
|
75
|
+
await t.click(e), n(document.body.style.overflowY).toBe("hidden");
|
|
76
|
+
}), a("should update primary navigation data-state when opened", async () => {
|
|
77
|
+
const t = u.setup(), { container: e } = r(/* @__PURE__ */ o(i, {})), c = s.getByRole("button", { name: /menu/i });
|
|
78
|
+
await t.click(c);
|
|
79
|
+
const l = e.querySelector("#drawer-navigation__primary-navigation");
|
|
80
|
+
n(l).toHaveAttribute("data-state", "opened");
|
|
81
|
+
}), a("should update primary navigation data-state when closed", async () => {
|
|
82
|
+
const t = u.setup(), { container: e } = r(/* @__PURE__ */ o(i, {})), c = s.getByRole("button", { name: /menu/i });
|
|
83
|
+
await t.click(c), await t.click(c);
|
|
84
|
+
const l = e.querySelector("#drawer-navigation__primary-navigation");
|
|
85
|
+
n(l).toHaveAttribute("data-state", "closing");
|
|
86
|
+
});
|
|
87
|
+
}), d("Logo Rendering", () => {
|
|
88
|
+
a("should render logo when provided", () => {
|
|
89
|
+
const t = v(), { container: e } = r(/* @__PURE__ */ o(i, { logo: t })), c = e.querySelector("img");
|
|
90
|
+
n(c).toBeInTheDocument();
|
|
91
|
+
}), a("should not render logo when not provided", () => {
|
|
92
|
+
const { container: t } = r(/* @__PURE__ */ o(i, {})), e = t.querySelector("img");
|
|
93
|
+
n(e).not.toBeInTheDocument();
|
|
94
|
+
}), a("should apply with-logo class when logo provided", () => {
|
|
95
|
+
const t = v(), { container: e } = r(/* @__PURE__ */ o(i, { logo: t })), c = e.querySelector(".drawer-navigation__nav-bar");
|
|
96
|
+
n(c).toHaveClass("with-logo");
|
|
97
|
+
}), a("should not apply with-logo class when logo not provided", () => {
|
|
98
|
+
const { container: t } = r(/* @__PURE__ */ o(i, { logo: {} })), e = t.querySelector(".drawer-navigation__nav-bar");
|
|
99
|
+
n(e).not.toHaveClass("with-logo");
|
|
100
|
+
}), a("should pass correct props to ImageReplacementAnchor", () => {
|
|
101
|
+
const t = v(), { container: e } = r(/* @__PURE__ */ o(i, { logo: t })), c = e.querySelector("a");
|
|
102
|
+
n(c).toHaveAttribute("href", "/");
|
|
103
|
+
});
|
|
104
|
+
}), d("NavList Rendering", () => {
|
|
105
|
+
a("should render NavList when links provided", () => {
|
|
106
|
+
const t = h();
|
|
107
|
+
r(/* @__PURE__ */ o(i, { links: t })), n(s.getByText("Home")).toBeInTheDocument(), n(s.getByText("About")).toBeInTheDocument(), n(s.getByText("Contact")).toBeInTheDocument();
|
|
108
|
+
}), a("should not render NavList when links array is empty", () => {
|
|
109
|
+
r(/* @__PURE__ */ o(i, { links: [] })), n(s.queryByText("Home")).not.toBeInTheDocument();
|
|
110
|
+
}), a("should not render NavList when links not provided", () => {
|
|
111
|
+
const { container: t } = r(/* @__PURE__ */ o(i, {})), e = t.querySelector('[class*="nav-list"]');
|
|
112
|
+
n(e).not.toBeInTheDocument();
|
|
113
|
+
}), a("should pass classname prop to NavList", () => {
|
|
114
|
+
const t = h(), { container: e } = r(/* @__PURE__ */ o(i, { classname: "custom-class", links: t })), c = e.querySelector(".custom-class");
|
|
115
|
+
n(c).toBeInTheDocument();
|
|
116
|
+
});
|
|
117
|
+
}), d("LogoNavigation Rendering", () => {
|
|
118
|
+
a("should render LogoNavigation when items provided", () => {
|
|
119
|
+
const t = y();
|
|
120
|
+
r(/* @__PURE__ */ o(i, { items: t }));
|
|
121
|
+
const e = document.querySelector("logo-navigation");
|
|
122
|
+
n(e).toBeInTheDocument();
|
|
123
|
+
const c = e == null ? void 0 : e.querySelectorAll("img");
|
|
124
|
+
n(c == null ? void 0 : c.length).toBe(2);
|
|
125
|
+
}), a("should not render LogoNavigation when items array is empty", () => {
|
|
126
|
+
r(/* @__PURE__ */ o(i, { items: [] })), n(s.queryByAltText("Logo 1")).not.toBeInTheDocument();
|
|
127
|
+
}), a("should render separator when items provided", () => {
|
|
128
|
+
const t = y(), { container: e } = r(/* @__PURE__ */ o(i, { items: t })), c = e.querySelector(".drawer-navigation__separator");
|
|
129
|
+
n(c).toBeInTheDocument();
|
|
130
|
+
}), a("should not render separator when items not provided", () => {
|
|
131
|
+
const { container: t } = r(/* @__PURE__ */ o(i, { items: [] })), e = t.querySelector(".drawer-navigation__separator");
|
|
132
|
+
n(e).not.toBeInTheDocument();
|
|
133
|
+
});
|
|
134
|
+
}), d("Overlay Rendering", () => {
|
|
135
|
+
a("should not render overlay initially", () => {
|
|
136
|
+
r(/* @__PURE__ */ o(i, {}));
|
|
137
|
+
const t = document.querySelector("#overlay");
|
|
138
|
+
n(t).not.toBeInTheDocument();
|
|
139
|
+
}), a("should render overlay when menu is opened", async () => {
|
|
140
|
+
const t = u.setup();
|
|
141
|
+
r(/* @__PURE__ */ o(i, {}));
|
|
142
|
+
const e = s.getByRole("button", { name: /menu/i });
|
|
143
|
+
await t.click(e), await p(() => {
|
|
144
|
+
const c = document.querySelector('[class*="overlay"]');
|
|
145
|
+
n(c).toBeInTheDocument();
|
|
146
|
+
});
|
|
147
|
+
}), a("should pass appendToElement prop to Overlay", async () => {
|
|
148
|
+
const t = u.setup(), e = document.createElement("div");
|
|
149
|
+
e.id = "custom-container", document.body.appendChild(e), r(/* @__PURE__ */ o(i, { overlayAppendEl: e }));
|
|
150
|
+
const c = s.getByRole("button", { name: /menu/i });
|
|
151
|
+
await t.click(c), await p(() => {
|
|
152
|
+
const l = e.querySelector('[class*="overlay"]');
|
|
153
|
+
n(l).toBeInTheDocument();
|
|
154
|
+
}), document.body.removeChild(e);
|
|
155
|
+
});
|
|
156
|
+
}), d("Animation States", () => {
|
|
157
|
+
a("should have closed state initially", () => {
|
|
158
|
+
const { container: t } = r(/* @__PURE__ */ o(i, {})), e = t.querySelector(".drawer-navigation__nav-bar");
|
|
159
|
+
n(e == null ? void 0 : e.className).toContain("closed");
|
|
160
|
+
}), a("should have expanded state when opened", async () => {
|
|
161
|
+
const t = u.setup(), { container: e } = r(/* @__PURE__ */ o(i, {})), c = s.getByRole("button", { name: /menu/i });
|
|
162
|
+
await t.click(c);
|
|
163
|
+
const l = e.querySelector(".drawer-navigation__nav-bar");
|
|
164
|
+
n(l == null ? void 0 : l.className).toContain("expanded");
|
|
165
|
+
}), a("should have closing state when closing", async () => {
|
|
166
|
+
const t = u.setup(), { container: e } = r(/* @__PURE__ */ o(i, {})), c = s.getByRole("button", { name: /menu/i });
|
|
167
|
+
await t.click(c), await t.click(c);
|
|
168
|
+
const l = e.querySelector(".drawer-navigation__nav-bar");
|
|
169
|
+
n(l == null ? void 0 : l.className).toContain("closing");
|
|
170
|
+
}), a("should handle animationEnd event", async () => {
|
|
171
|
+
const t = u.setup(), { container: e } = r(/* @__PURE__ */ o(i, {})), c = s.getByRole("button", { name: /menu/i }), l = e.querySelector("#drawer-navigation__primary-navigation");
|
|
172
|
+
await t.click(c), await t.click(c), B.animationEnd(l);
|
|
173
|
+
const m = e.querySelector(".drawer-navigation__nav-bar");
|
|
174
|
+
n(m == null ? void 0 : m.className).toContain("closed");
|
|
175
|
+
});
|
|
176
|
+
}), d("Custom Clip Path", () => {
|
|
177
|
+
a("should use default clip path values", () => {
|
|
178
|
+
const { container: t } = r(/* @__PURE__ */ o(i, {})), e = t.querySelector("#drawer-navigation__primary-navigation");
|
|
179
|
+
n(e.style.getPropertyValue("--clip-path-start")).toBe("circle(0% at top right)"), n(e.style.getPropertyValue("--clip-path-end")).toBe("circle(250% at top right)");
|
|
180
|
+
}), a("should use custom clip path start", () => {
|
|
181
|
+
const { container: t } = r(/* @__PURE__ */ o(i, { clipPathStart: "circle(10% at center)" })), e = t.querySelector("#drawer-navigation__primary-navigation");
|
|
182
|
+
n(e.style.getPropertyValue("--clip-path-start")).toBe("circle(10% at center)");
|
|
183
|
+
}), a("should use custom clip path end", () => {
|
|
184
|
+
const { container: t } = r(/* @__PURE__ */ o(i, { clipPathEnd: "circle(300% at bottom left)" })), e = t.querySelector("#drawer-navigation__primary-navigation");
|
|
185
|
+
n(e.style.getPropertyValue("--clip-path-end")).toBe("circle(300% at bottom left)");
|
|
186
|
+
}), a("should use both custom clip paths", () => {
|
|
187
|
+
const { container: t } = r(
|
|
188
|
+
/* @__PURE__ */ o(
|
|
189
|
+
i,
|
|
190
|
+
{
|
|
191
|
+
clipPathEnd: "circle(400% at center)",
|
|
192
|
+
clipPathStart: "circle(5% at top left)"
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
), e = t.querySelector("#drawer-navigation__primary-navigation");
|
|
196
|
+
n(e.style.getPropertyValue("--clip-path-start")).toBe("circle(5% at top left)"), n(e.style.getPropertyValue("--clip-path-end")).toBe("circle(400% at center)");
|
|
197
|
+
});
|
|
198
|
+
}), d("Accessibility", () => {
|
|
199
|
+
a("should have aria-controls attribute on button", () => {
|
|
200
|
+
r(/* @__PURE__ */ o(i, {}));
|
|
201
|
+
const t = s.getByRole("button", { name: /menu/i });
|
|
202
|
+
n(t).toHaveAttribute("aria-controls", "drawer-navigation__primary-navigation");
|
|
203
|
+
}), a("should have aria-expanded false initially", () => {
|
|
204
|
+
r(/* @__PURE__ */ o(i, {}));
|
|
205
|
+
const t = s.getByRole("button", { name: /menu/i });
|
|
206
|
+
n(t).toHaveAttribute("aria-expanded", "false");
|
|
207
|
+
}), a("should update aria-expanded when toggled", async () => {
|
|
208
|
+
const t = u.setup();
|
|
209
|
+
r(/* @__PURE__ */ o(i, {}));
|
|
210
|
+
const e = s.getByRole("button", { name: /menu/i });
|
|
211
|
+
await t.click(e), n(e).toHaveAttribute("aria-expanded", "true"), await t.click(e), n(e).toHaveAttribute("aria-expanded", "false");
|
|
212
|
+
}), a("should have aria-hidden on hamburger icon", () => {
|
|
213
|
+
const { container: t } = r(/* @__PURE__ */ o(i, {})), e = t.querySelector(".drawer-navigation__hamburger");
|
|
214
|
+
n(e).toHaveAttribute("aria-hidden", "true");
|
|
215
|
+
});
|
|
216
|
+
}), d("CSS Classes", () => {
|
|
217
|
+
a("should apply drawer-navigation__nav-bar class", () => {
|
|
218
|
+
const { container: t } = r(/* @__PURE__ */ o(i, {})), e = t.querySelector(".drawer-navigation__nav-bar");
|
|
219
|
+
n(e).toBeInTheDocument();
|
|
220
|
+
}), a("should apply drawer-navigation__menu-toggle class", () => {
|
|
221
|
+
const { container: t } = r(/* @__PURE__ */ o(i, {})), e = t.querySelector(".drawer-navigation__menu-toggle");
|
|
222
|
+
n(e).toBeInTheDocument();
|
|
223
|
+
}), a("should apply drawer-navigation__hamburger class", () => {
|
|
224
|
+
const { container: t } = r(/* @__PURE__ */ o(i, {})), e = t.querySelector(".drawer-navigation__hamburger");
|
|
225
|
+
n(e).toBeInTheDocument();
|
|
226
|
+
}), a("should apply drawer-navigation__primary-navigation class", () => {
|
|
227
|
+
const { container: t } = r(/* @__PURE__ */ o(i, {})), e = t.querySelector(".drawer-navigation__primary-navigation");
|
|
228
|
+
n(e).toBeInTheDocument();
|
|
229
|
+
});
|
|
230
|
+
}), d("Event Listeners", () => {
|
|
231
|
+
a("should listen for scripps:overlay:closed event", async () => {
|
|
232
|
+
const t = u.setup();
|
|
233
|
+
r(/* @__PURE__ */ o(i, {}));
|
|
234
|
+
const e = s.getByRole("button", { name: /menu/i });
|
|
235
|
+
await t.click(e), n(e).toHaveAttribute("aria-expanded", "true");
|
|
236
|
+
const c = new CustomEvent("scripps:overlay:closed");
|
|
237
|
+
_(() => {
|
|
238
|
+
document.dispatchEvent(c);
|
|
239
|
+
}), await p(() => {
|
|
240
|
+
n(e).toHaveAttribute("aria-expanded", "false");
|
|
241
|
+
});
|
|
242
|
+
}), a("should remove event listener on unmount", () => {
|
|
243
|
+
const t = T.spyOn(document, "removeEventListener"), { unmount: e } = r(/* @__PURE__ */ o(i, {}));
|
|
244
|
+
e(), n(t).toHaveBeenCalledWith("scripps:overlay:closed", n.any(Function)), t.mockRestore();
|
|
245
|
+
});
|
|
246
|
+
}), d("Edge Cases", () => {
|
|
247
|
+
a("should handle both links and items together", () => {
|
|
248
|
+
const t = h(), e = y();
|
|
249
|
+
r(/* @__PURE__ */ o(i, { items: e, links: t })), n(s.getByText("Home")).toBeInTheDocument();
|
|
250
|
+
const c = document.querySelector("logo-navigation");
|
|
251
|
+
n(c).toBeInTheDocument();
|
|
252
|
+
const l = c == null ? void 0 : c.querySelectorAll("img");
|
|
253
|
+
n(l == null ? void 0 : l.length).toBe(2);
|
|
254
|
+
}), a("should handle undefined overlayAppendEl", async () => {
|
|
255
|
+
const t = u.setup();
|
|
256
|
+
r(/* @__PURE__ */ o(i, { overlayAppendEl: void 0 }));
|
|
257
|
+
const e = s.getByRole("button", { name: /menu/i });
|
|
258
|
+
await t.click(e), n(e).toHaveAttribute("aria-expanded", "true");
|
|
259
|
+
}), a("should handle empty logo object", () => {
|
|
260
|
+
const { container: t } = r(/* @__PURE__ */ o(i, { logo: {} })), e = t.querySelector("img");
|
|
261
|
+
n(e).not.toBeInTheDocument();
|
|
262
|
+
}), a("should handle rapid toggle clicks", async () => {
|
|
263
|
+
const t = u.setup();
|
|
264
|
+
r(/* @__PURE__ */ o(i, {}));
|
|
265
|
+
const e = s.getByRole("button", { name: /menu/i });
|
|
266
|
+
await t.click(e), await t.click(e), await t.click(e), n(e).toHaveAttribute("aria-expanded", "true");
|
|
267
|
+
}), a("should handle logo with only some properties", () => {
|
|
268
|
+
const { container: t } = r(
|
|
269
|
+
/* @__PURE__ */ o(i, { logo: { image: { url: "/logo.png", width: 100, height: 50, altText: "", aspectRatio: 2 } } })
|
|
270
|
+
), e = t.querySelector("img");
|
|
271
|
+
n(e).toBeInTheDocument();
|
|
272
|
+
}), a("should handle single link", () => {
|
|
273
|
+
r(/* @__PURE__ */ o(i, { links: [{ href: "/single", label: "Single" }] })), n(s.getByText("Single")).toBeInTheDocument();
|
|
274
|
+
}), a("should handle single item", () => {
|
|
275
|
+
r(/* @__PURE__ */ o(i, { items: [{
|
|
276
|
+
href: "https://example.com",
|
|
277
|
+
image: { url: "/logo.png", width: 100, height: 50, altText: "", aspectRatio: 2 },
|
|
278
|
+
altText: ""
|
|
279
|
+
}] }));
|
|
280
|
+
const e = document.querySelector("logo-navigation");
|
|
281
|
+
n(e).toBeInTheDocument();
|
|
282
|
+
const c = e == null ? void 0 : e.querySelectorAll("img");
|
|
283
|
+
n(c == null ? void 0 : c.length).toBe(1);
|
|
284
|
+
});
|
|
285
|
+
}), d("Integration", () => {
|
|
286
|
+
a("should close menu when clicking a hash link (triggers toggleHandler)", async () => {
|
|
287
|
+
const t = u.setup(), e = [
|
|
288
|
+
...h(),
|
|
289
|
+
{ href: "#section", label: "Section" }
|
|
290
|
+
// Hash link will trigger toggleHandler
|
|
291
|
+
];
|
|
292
|
+
r(/* @__PURE__ */ o(i, { links: e }));
|
|
293
|
+
const c = s.getByRole("button", { name: /menu/i });
|
|
294
|
+
await t.click(c), n(c).toHaveAttribute("aria-expanded", "true");
|
|
295
|
+
const l = s.getByText("Section");
|
|
296
|
+
await t.click(l), await p(() => {
|
|
297
|
+
n(c).toHaveAttribute("aria-expanded", "false");
|
|
298
|
+
});
|
|
299
|
+
}), a("should render all components together", () => {
|
|
300
|
+
const t = h(), e = y(), c = v(), { container: l } = r(
|
|
301
|
+
/* @__PURE__ */ o(
|
|
302
|
+
i,
|
|
303
|
+
{
|
|
304
|
+
classname: "custom",
|
|
305
|
+
items: e,
|
|
306
|
+
links: t,
|
|
307
|
+
logo: c
|
|
308
|
+
}
|
|
309
|
+
)
|
|
310
|
+
);
|
|
311
|
+
n(l.querySelector(".drawer-navigation__nav-bar")).toBeInTheDocument(), n(s.getByText("Home")).toBeInTheDocument();
|
|
312
|
+
const m = document.querySelector("logo-navigation");
|
|
313
|
+
n(m).toBeInTheDocument(), n(l.querySelector('img[src="/main-logo.png"]')).toBeInTheDocument();
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
});
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { d as s, b as u, a as C, i as r, r as o, g as t } from "../../react.esm-DLSrfVwM.mjs";
|
|
3
|
+
import "../../index-BVxBrkZB.mjs";
|
|
4
|
+
import { EqualSizeFlexRow as n } from "./EqualSizeFlexRow.js";
|
|
5
|
+
s("EqualSizeFlexRow", () => {
|
|
6
|
+
let h;
|
|
7
|
+
u(() => {
|
|
8
|
+
h = document.createElement("div"), h.id = "root", document.body.appendChild(h);
|
|
9
|
+
}), C(() => {
|
|
10
|
+
document.body.removeChild(h);
|
|
11
|
+
}), s("Basic Rendering", () => {
|
|
12
|
+
r("should render the custom element", () => {
|
|
13
|
+
o(/* @__PURE__ */ e(n, { children: /* @__PURE__ */ e("div", { children: "Child" }) }));
|
|
14
|
+
const l = document.querySelector("equal-size-flex-row");
|
|
15
|
+
t(l).toBeInTheDocument();
|
|
16
|
+
}), r("should render single child", () => {
|
|
17
|
+
const { container: l } = o(
|
|
18
|
+
/* @__PURE__ */ e(n, { children: /* @__PURE__ */ e("div", { children: "Child 1" }) })
|
|
19
|
+
);
|
|
20
|
+
t(l.textContent).toContain("Child 1");
|
|
21
|
+
}), r("should render multiple children", () => {
|
|
22
|
+
const { container: l } = o(
|
|
23
|
+
/* @__PURE__ */ d(n, { children: [
|
|
24
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
25
|
+
/* @__PURE__ */ e("div", { children: "Child 2" }),
|
|
26
|
+
/* @__PURE__ */ e("div", { children: "Child 3" })
|
|
27
|
+
] })
|
|
28
|
+
);
|
|
29
|
+
t(l.textContent).toContain("Child 1"), t(l.textContent).toContain("Child 2"), t(l.textContent).toContain("Child 3");
|
|
30
|
+
}), r("should wrap each child in equal-size-flex-row__item div", () => {
|
|
31
|
+
o(
|
|
32
|
+
/* @__PURE__ */ d(n, { children: [
|
|
33
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
34
|
+
/* @__PURE__ */ e("div", { children: "Child 2" })
|
|
35
|
+
] })
|
|
36
|
+
);
|
|
37
|
+
const l = document.querySelectorAll(".equal-size-flex-row__item");
|
|
38
|
+
t(l.length).toBe(2);
|
|
39
|
+
}), r("should set data-item-count attribute", () => {
|
|
40
|
+
o(
|
|
41
|
+
/* @__PURE__ */ d(n, { children: [
|
|
42
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
43
|
+
/* @__PURE__ */ e("div", { children: "Child 2" }),
|
|
44
|
+
/* @__PURE__ */ e("div", { children: "Child 3" })
|
|
45
|
+
] })
|
|
46
|
+
);
|
|
47
|
+
const l = document.querySelector("equal-size-flex-row");
|
|
48
|
+
t(l).toHaveAttribute("data-item-count", "3");
|
|
49
|
+
});
|
|
50
|
+
}), s("Single Child Special Case", () => {
|
|
51
|
+
r("should apply 50% flex for single child", () => {
|
|
52
|
+
o(
|
|
53
|
+
/* @__PURE__ */ e(n, { children: /* @__PURE__ */ e("div", { children: "Single Child" }) })
|
|
54
|
+
);
|
|
55
|
+
const i = document.querySelector("equal-size-flex-row").getAttribute("style");
|
|
56
|
+
t(i).toContain("--esfr-item-flex: 0 1 50%");
|
|
57
|
+
}), r("should set data-item-count to 1 for single child", () => {
|
|
58
|
+
o(
|
|
59
|
+
/* @__PURE__ */ e(n, { children: /* @__PURE__ */ e("div", { children: "Single Child" }) })
|
|
60
|
+
);
|
|
61
|
+
const l = document.querySelector("equal-size-flex-row");
|
|
62
|
+
t(l).toHaveAttribute("data-item-count", "1");
|
|
63
|
+
});
|
|
64
|
+
}), s("Gap Prop", () => {
|
|
65
|
+
r("should use default gap of 1.5rem", () => {
|
|
66
|
+
o(
|
|
67
|
+
/* @__PURE__ */ d(n, { children: [
|
|
68
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
69
|
+
/* @__PURE__ */ e("div", { children: "Child 2" })
|
|
70
|
+
] })
|
|
71
|
+
);
|
|
72
|
+
const i = document.querySelector("equal-size-flex-row").getAttribute("style");
|
|
73
|
+
t(i).toContain("--esfr-gap-size: 1.5rem");
|
|
74
|
+
}), r("should apply custom gap value", () => {
|
|
75
|
+
o(
|
|
76
|
+
/* @__PURE__ */ d(n, { gap: "2rem", children: [
|
|
77
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
78
|
+
/* @__PURE__ */ e("div", { children: "Child 2" })
|
|
79
|
+
] })
|
|
80
|
+
);
|
|
81
|
+
const i = document.querySelector("equal-size-flex-row").getAttribute("style");
|
|
82
|
+
t(i).toContain("--esfr-gap-size: 2rem");
|
|
83
|
+
}), r("should use gap in flex calculation", () => {
|
|
84
|
+
o(
|
|
85
|
+
/* @__PURE__ */ d(n, { gap: "3rem", maxItemsPerRow: 4, children: [
|
|
86
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
87
|
+
/* @__PURE__ */ e("div", { children: "Child 2" })
|
|
88
|
+
] })
|
|
89
|
+
);
|
|
90
|
+
const i = document.querySelector("equal-size-flex-row").getAttribute("style");
|
|
91
|
+
t(i).toContain("--esfr-item-flex: 1 1 calc(50% - 3rem)");
|
|
92
|
+
});
|
|
93
|
+
}), s("MaxItemsPerRow Prop", () => {
|
|
94
|
+
r("should use default maxItemsPerRow of 4", () => {
|
|
95
|
+
o(
|
|
96
|
+
/* @__PURE__ */ d(n, { children: [
|
|
97
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
98
|
+
/* @__PURE__ */ e("div", { children: "Child 2" }),
|
|
99
|
+
/* @__PURE__ */ e("div", { children: "Child 3" })
|
|
100
|
+
] })
|
|
101
|
+
);
|
|
102
|
+
const i = document.querySelector("equal-size-flex-row").getAttribute("style");
|
|
103
|
+
t(i).toContain("--esfr-item-flex: 1 1 calc("), t(i).toContain("% - 1.5rem)");
|
|
104
|
+
}), r("should respect custom maxItemsPerRow", () => {
|
|
105
|
+
o(
|
|
106
|
+
/* @__PURE__ */ d(n, { maxItemsPerRow: 2, children: [
|
|
107
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
108
|
+
/* @__PURE__ */ e("div", { children: "Child 2" })
|
|
109
|
+
] })
|
|
110
|
+
);
|
|
111
|
+
const i = document.querySelector("equal-size-flex-row").getAttribute("style");
|
|
112
|
+
t(i).toContain("--esfr-item-flex: 1 1 calc(50% - 1.5rem)");
|
|
113
|
+
}), r("should set nowrap when children <= maxItemsPerRow", () => {
|
|
114
|
+
o(
|
|
115
|
+
/* @__PURE__ */ d(n, { maxItemsPerRow: 4, children: [
|
|
116
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
117
|
+
/* @__PURE__ */ e("div", { children: "Child 2" }),
|
|
118
|
+
/* @__PURE__ */ e("div", { children: "Child 3" })
|
|
119
|
+
] })
|
|
120
|
+
);
|
|
121
|
+
const i = document.querySelector("equal-size-flex-row").getAttribute("style");
|
|
122
|
+
t(i).toContain("--esfr-flex-wrap: nowrap");
|
|
123
|
+
}), r("should set wrap when children > maxItemsPerRow", () => {
|
|
124
|
+
o(
|
|
125
|
+
/* @__PURE__ */ d(n, { maxItemsPerRow: 2, children: [
|
|
126
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
127
|
+
/* @__PURE__ */ e("div", { children: "Child 2" }),
|
|
128
|
+
/* @__PURE__ */ e("div", { children: "Child 3" })
|
|
129
|
+
] })
|
|
130
|
+
);
|
|
131
|
+
const i = document.querySelector("equal-size-flex-row").getAttribute("style");
|
|
132
|
+
t(i).toContain("--esfr-flex-wrap: wrap");
|
|
133
|
+
});
|
|
134
|
+
}), s("Flex Calculation", () => {
|
|
135
|
+
r("should calculate correct flex for 2 children with max 4", () => {
|
|
136
|
+
o(
|
|
137
|
+
/* @__PURE__ */ d(n, { maxItemsPerRow: 4, children: [
|
|
138
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
139
|
+
/* @__PURE__ */ e("div", { children: "Child 2" })
|
|
140
|
+
] })
|
|
141
|
+
);
|
|
142
|
+
const i = document.querySelector("equal-size-flex-row").getAttribute("style");
|
|
143
|
+
t(i).toContain("--esfr-item-flex: 1 1 calc(50% - 1.5rem)");
|
|
144
|
+
}), r("should calculate correct flex for 3 children with max 4", () => {
|
|
145
|
+
o(
|
|
146
|
+
/* @__PURE__ */ d(n, { maxItemsPerRow: 4, children: [
|
|
147
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
148
|
+
/* @__PURE__ */ e("div", { children: "Child 2" }),
|
|
149
|
+
/* @__PURE__ */ e("div", { children: "Child 3" })
|
|
150
|
+
] })
|
|
151
|
+
);
|
|
152
|
+
const i = document.querySelector("equal-size-flex-row").getAttribute("style");
|
|
153
|
+
t(i).toContain("--esfr-item-flex: 1 1 calc("), t(i).toContain("% - 1.5rem)");
|
|
154
|
+
}), r("should calculate correct flex for 4 children with max 4", () => {
|
|
155
|
+
o(
|
|
156
|
+
/* @__PURE__ */ d(n, { maxItemsPerRow: 4, children: [
|
|
157
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
158
|
+
/* @__PURE__ */ e("div", { children: "Child 2" }),
|
|
159
|
+
/* @__PURE__ */ e("div", { children: "Child 3" }),
|
|
160
|
+
/* @__PURE__ */ e("div", { children: "Child 4" })
|
|
161
|
+
] })
|
|
162
|
+
);
|
|
163
|
+
const i = document.querySelector("equal-size-flex-row").getAttribute("style");
|
|
164
|
+
t(i).toContain("--esfr-item-flex: 1 1 calc(25% - 1.5rem)");
|
|
165
|
+
}), r("should calculate correct flex for 5 children with max 4", () => {
|
|
166
|
+
o(
|
|
167
|
+
/* @__PURE__ */ d(n, { maxItemsPerRow: 4, children: [
|
|
168
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
169
|
+
/* @__PURE__ */ e("div", { children: "Child 2" }),
|
|
170
|
+
/* @__PURE__ */ e("div", { children: "Child 3" }),
|
|
171
|
+
/* @__PURE__ */ e("div", { children: "Child 4" }),
|
|
172
|
+
/* @__PURE__ */ e("div", { children: "Child 5" })
|
|
173
|
+
] })
|
|
174
|
+
);
|
|
175
|
+
const i = document.querySelector("equal-size-flex-row").getAttribute("style");
|
|
176
|
+
t(i).toContain("--esfr-item-flex: 0 1 calc(25% - 1.5rem)");
|
|
177
|
+
}), r("should use flex-grow 1 when children <= maxItemsPerRow", () => {
|
|
178
|
+
o(
|
|
179
|
+
/* @__PURE__ */ d(n, { maxItemsPerRow: 3, children: [
|
|
180
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
181
|
+
/* @__PURE__ */ e("div", { children: "Child 2" })
|
|
182
|
+
] })
|
|
183
|
+
);
|
|
184
|
+
const i = document.querySelector("equal-size-flex-row").getAttribute("style");
|
|
185
|
+
t(i).toContain("--esfr-item-flex: 1 1 calc(");
|
|
186
|
+
}), r("should use flex-grow 0 when children > maxItemsPerRow", () => {
|
|
187
|
+
o(
|
|
188
|
+
/* @__PURE__ */ d(n, { maxItemsPerRow: 2, children: [
|
|
189
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
190
|
+
/* @__PURE__ */ e("div", { children: "Child 2" }),
|
|
191
|
+
/* @__PURE__ */ e("div", { children: "Child 3" })
|
|
192
|
+
] })
|
|
193
|
+
);
|
|
194
|
+
const i = document.querySelector("equal-size-flex-row").getAttribute("style");
|
|
195
|
+
t(i).toContain("--esfr-item-flex: 0 1 calc(");
|
|
196
|
+
});
|
|
197
|
+
}), s("CSS Custom Properties", () => {
|
|
198
|
+
r("should set all three CSS custom properties", () => {
|
|
199
|
+
o(
|
|
200
|
+
/* @__PURE__ */ d(n, { gap: "2rem", maxItemsPerRow: 3, children: [
|
|
201
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
202
|
+
/* @__PURE__ */ e("div", { children: "Child 2" })
|
|
203
|
+
] })
|
|
204
|
+
);
|
|
205
|
+
const i = document.querySelector("equal-size-flex-row").getAttribute("style");
|
|
206
|
+
t(i).toContain("--esfr-gap-size"), t(i).toContain("--esfr-item-flex"), t(i).toContain("--esfr-flex-wrap");
|
|
207
|
+
}), r("should update CSS properties when props change", () => {
|
|
208
|
+
const { rerender: l } = o(
|
|
209
|
+
/* @__PURE__ */ d(n, { gap: "1rem", children: [
|
|
210
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
211
|
+
/* @__PURE__ */ e("div", { children: "Child 2" })
|
|
212
|
+
] })
|
|
213
|
+
);
|
|
214
|
+
let i = document.querySelector("equal-size-flex-row"), c = i.getAttribute("style");
|
|
215
|
+
t(c).toContain("--esfr-gap-size: 1rem"), l(
|
|
216
|
+
/* @__PURE__ */ d(n, { gap: "3rem", children: [
|
|
217
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
218
|
+
/* @__PURE__ */ e("div", { children: "Child 2" })
|
|
219
|
+
] })
|
|
220
|
+
), i = document.querySelector("equal-size-flex-row"), c = i.getAttribute("style"), t(c).toContain("--esfr-gap-size: 3rem");
|
|
221
|
+
});
|
|
222
|
+
}), s("Children Handling", () => {
|
|
223
|
+
r("should handle React elements as children", () => {
|
|
224
|
+
const { container: l } = o(
|
|
225
|
+
/* @__PURE__ */ d(n, { children: [
|
|
226
|
+
/* @__PURE__ */ e("button", { children: "Button 1" }),
|
|
227
|
+
/* @__PURE__ */ e("button", { children: "Button 2" })
|
|
228
|
+
] })
|
|
229
|
+
), i = l.querySelectorAll("button");
|
|
230
|
+
t(i.length).toBe(2);
|
|
231
|
+
}), r("should handle text nodes as children", () => {
|
|
232
|
+
const { container: l } = o(
|
|
233
|
+
/* @__PURE__ */ d(n, { children: [
|
|
234
|
+
/* @__PURE__ */ e("span", { children: "Text 1" }),
|
|
235
|
+
/* @__PURE__ */ e("span", { children: "Text 2" })
|
|
236
|
+
] })
|
|
237
|
+
);
|
|
238
|
+
t(l.textContent).toContain("Text 1"), t(l.textContent).toContain("Text 2");
|
|
239
|
+
}), r("should preserve child props when cloning", () => {
|
|
240
|
+
const { container: l } = o(
|
|
241
|
+
/* @__PURE__ */ d(n, { children: [
|
|
242
|
+
/* @__PURE__ */ e("div", { className: "custom-class", "data-testid": "child1", children: "Child 1" }),
|
|
243
|
+
/* @__PURE__ */ e("div", { className: "another-class", "data-testid": "child2", children: "Child 2" })
|
|
244
|
+
] })
|
|
245
|
+
), i = l.querySelector('[data-testid="child1"]'), c = l.querySelector('[data-testid="child2"]');
|
|
246
|
+
t(i).toHaveClass("custom-class"), t(c).toHaveClass("another-class");
|
|
247
|
+
}), r("should handle mixed content types", () => {
|
|
248
|
+
const { container: l } = o(
|
|
249
|
+
/* @__PURE__ */ d(n, { children: [
|
|
250
|
+
/* @__PURE__ */ e("div", { children: "Div element" }),
|
|
251
|
+
/* @__PURE__ */ e("button", { children: "Button element" }),
|
|
252
|
+
/* @__PURE__ */ e("span", { children: "Span element" })
|
|
253
|
+
] })
|
|
254
|
+
);
|
|
255
|
+
t(l.querySelector("div")).toBeInTheDocument(), t(l.querySelector("button")).toBeInTheDocument(), t(l.querySelector("span")).toBeInTheDocument();
|
|
256
|
+
});
|
|
257
|
+
}), s("Edge Cases", () => {
|
|
258
|
+
r("should handle zero children gracefully", () => {
|
|
259
|
+
o(/* @__PURE__ */ e(n, { children: [] }));
|
|
260
|
+
const l = document.querySelector("equal-size-flex-row");
|
|
261
|
+
t(l).toBeInTheDocument(), t(l).toHaveAttribute("data-item-count", "0");
|
|
262
|
+
}), r("should handle very large number of children", () => {
|
|
263
|
+
const l = Array.from({ length: 20 }, (a, m) => /* @__PURE__ */ d("div", { children: [
|
|
264
|
+
"Child ",
|
|
265
|
+
m + 1
|
|
266
|
+
] }, m));
|
|
267
|
+
o(
|
|
268
|
+
/* @__PURE__ */ e(n, { maxItemsPerRow: 4, children: l })
|
|
269
|
+
);
|
|
270
|
+
const i = document.querySelector("equal-size-flex-row");
|
|
271
|
+
t(i).toHaveAttribute("data-item-count", "20");
|
|
272
|
+
const c = document.querySelectorAll(".equal-size-flex-row__item");
|
|
273
|
+
t(c.length).toBe(20);
|
|
274
|
+
}), r("should handle maxItemsPerRow of 1", () => {
|
|
275
|
+
o(
|
|
276
|
+
/* @__PURE__ */ d(n, { maxItemsPerRow: 1, children: [
|
|
277
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
278
|
+
/* @__PURE__ */ e("div", { children: "Child 2" })
|
|
279
|
+
] })
|
|
280
|
+
);
|
|
281
|
+
const i = document.querySelector("equal-size-flex-row").getAttribute("style");
|
|
282
|
+
t(i).toContain("--esfr-flex-wrap: wrap"), t(i).toContain("--esfr-item-flex: 0 1 calc(100% - 1.5rem)");
|
|
283
|
+
}), r("should handle gap with different units", () => {
|
|
284
|
+
o(
|
|
285
|
+
/* @__PURE__ */ d(n, { gap: "20px", children: [
|
|
286
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
287
|
+
/* @__PURE__ */ e("div", { children: "Child 2" })
|
|
288
|
+
] })
|
|
289
|
+
);
|
|
290
|
+
const i = document.querySelector("equal-size-flex-row").getAttribute("style");
|
|
291
|
+
t(i).toContain("--esfr-gap-size: 20px"), t(i).toContain("calc(50% - 20px)");
|
|
292
|
+
}), r("should handle gap of 0", () => {
|
|
293
|
+
o(
|
|
294
|
+
/* @__PURE__ */ d(n, { gap: "0", children: [
|
|
295
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
296
|
+
/* @__PURE__ */ e("div", { children: "Child 2" })
|
|
297
|
+
] })
|
|
298
|
+
);
|
|
299
|
+
const i = document.querySelector("equal-size-flex-row").getAttribute("style");
|
|
300
|
+
t(i).toContain("--esfr-gap-size: 0"), t(i).toContain("calc(50% - 0)");
|
|
301
|
+
});
|
|
302
|
+
}), s("Integration", () => {
|
|
303
|
+
r("should correctly render with all props and multiple children", () => {
|
|
304
|
+
const { container: l } = o(
|
|
305
|
+
/* @__PURE__ */ d(n, { gap: "2.5rem", maxItemsPerRow: 3, children: [
|
|
306
|
+
/* @__PURE__ */ e("div", { className: "item-1", children: "Item 1" }),
|
|
307
|
+
/* @__PURE__ */ e("div", { className: "item-2", children: "Item 2" }),
|
|
308
|
+
/* @__PURE__ */ e("div", { className: "item-3", children: "Item 3" }),
|
|
309
|
+
/* @__PURE__ */ e("div", { className: "item-4", children: "Item 4" })
|
|
310
|
+
] })
|
|
311
|
+
), i = document.querySelector("equal-size-flex-row");
|
|
312
|
+
t(i).toHaveAttribute("data-item-count", "4");
|
|
313
|
+
const c = i.getAttribute("style");
|
|
314
|
+
t(c).toContain("--esfr-gap-size: 2.5rem"), t(c).toContain("--esfr-flex-wrap: wrap"), t(c).toContain("--esfr-item-flex: 0 1 calc(");
|
|
315
|
+
const a = l.querySelectorAll(".equal-size-flex-row__item");
|
|
316
|
+
t(a.length).toBe(4), t(l.querySelector(".item-1")).toBeInTheDocument(), t(l.querySelector(".item-2")).toBeInTheDocument(), t(l.querySelector(".item-3")).toBeInTheDocument(), t(l.querySelector(".item-4")).toBeInTheDocument();
|
|
317
|
+
}), r("should handle dynamic children updates", () => {
|
|
318
|
+
const { rerender: l, container: i } = o(
|
|
319
|
+
/* @__PURE__ */ d(n, { maxItemsPerRow: 3, children: [
|
|
320
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
321
|
+
/* @__PURE__ */ e("div", { children: "Child 2" })
|
|
322
|
+
] })
|
|
323
|
+
);
|
|
324
|
+
let c = document.querySelector("equal-size-flex-row");
|
|
325
|
+
t(c).toHaveAttribute("data-item-count", "2"), l(
|
|
326
|
+
/* @__PURE__ */ d(n, { maxItemsPerRow: 3, children: [
|
|
327
|
+
/* @__PURE__ */ e("div", { children: "Child 1" }),
|
|
328
|
+
/* @__PURE__ */ e("div", { children: "Child 2" }),
|
|
329
|
+
/* @__PURE__ */ e("div", { children: "Child 3" }),
|
|
330
|
+
/* @__PURE__ */ e("div", { children: "Child 4" })
|
|
331
|
+
] })
|
|
332
|
+
), c = document.querySelector("equal-size-flex-row"), t(c).toHaveAttribute("data-item-count", "4");
|
|
333
|
+
const a = i.querySelectorAll(".equal-size-flex-row__item");
|
|
334
|
+
t(a.length).toBe(4);
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
});
|