@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
|
@@ -4,7 +4,7 @@ import { f as S } from "../../format-YhWt2D8M.mjs";
|
|
|
4
4
|
import { l as g } from "../../logger-C0N7U0YY.mjs";
|
|
5
5
|
import { classes as L } from "../../utils/helpers.js";
|
|
6
6
|
import { ScheduleProvider as E } from "./ScheduleContext.js";
|
|
7
|
-
import {
|
|
7
|
+
import { u as q } from "../../useScheduleContext-D7FdzNxe.mjs";
|
|
8
8
|
import { DateNavigation as T } from "../DateNavigation/DateNavigation.js";
|
|
9
9
|
import { ScheduleList as k } from "../ScheduleList/ScheduleList.js";
|
|
10
10
|
g.setComponent("ScheduleLayout");
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const e = t(o);
|
|
5
|
-
if (e === void 0)
|
|
6
|
-
throw new Error("useScheduleContext must be used within a ScheduleProvider");
|
|
7
|
-
return e;
|
|
8
|
-
}
|
|
1
|
+
import "react";
|
|
2
|
+
import "./ScheduleContext.js";
|
|
3
|
+
import { u as r, u as a } from "../../useScheduleContext-D7FdzNxe.mjs";
|
|
9
4
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
r as default,
|
|
6
|
+
a as useScheduleContext
|
|
12
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as n, jsxs as v } from "react/jsx-runtime";
|
|
2
2
|
import { useReducer as A, useState as x, useRef as u, useCallback as C, useEffect as c } from "react";
|
|
3
3
|
import { classes as S, getMinutesFromStr as D } from "../../utils/helpers.js";
|
|
4
|
-
import {
|
|
4
|
+
import { u as M } from "../../useScheduleContext-D7FdzNxe.mjs";
|
|
5
5
|
import { Loading as O } from "../Loading/Loading.js";
|
|
6
6
|
import { SportsItem as P } from "./schedule-list-items/SportsItem.js";
|
|
7
7
|
import { SeriesItem as k } from "./schedule-list-items/SeriesItem.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as t, jsxs as d, Fragment as s } from "react/jsx-runtime";
|
|
2
|
-
import { p as a } from "../../index-
|
|
2
|
+
import { p as a } from "../../index-06PEPfBQ.mjs";
|
|
3
3
|
import { classes as o } from "../../utils/helpers.js";
|
|
4
4
|
import '../../assets/SectionedContent.css';const i = "_h2_16wib_6", l = "_h3_16wib_6", r = {
|
|
5
5
|
"sectioned-content__content": "_sectioned-content__content_16wib_1",
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { v as y, d, b as m, i as s, r as i, g as t } from "../../react.esm-DLSrfVwM.mjs";
|
|
3
|
+
import "../../index-BVxBrkZB.mjs";
|
|
4
|
+
import { SectionedContent as r } from "./SectionedContent.js";
|
|
5
|
+
const h = y.fn((o) => o.join(" "));
|
|
6
|
+
y.mock("../../utils/helpers", () => ({
|
|
7
|
+
classes: (o) => h(o)
|
|
8
|
+
}));
|
|
9
|
+
const l = y.fn((o) => o);
|
|
10
|
+
y.mock("html-react-parser", () => ({
|
|
11
|
+
default: (o) => l(o)
|
|
12
|
+
}));
|
|
13
|
+
d("SectionedContent", () => {
|
|
14
|
+
m(() => {
|
|
15
|
+
y.clearAllMocks();
|
|
16
|
+
});
|
|
17
|
+
const o = (e) => ({
|
|
18
|
+
header: {
|
|
19
|
+
type: "primary",
|
|
20
|
+
title: "Test Header"
|
|
21
|
+
},
|
|
22
|
+
content: "<p>Test content</p>",
|
|
23
|
+
...e
|
|
24
|
+
});
|
|
25
|
+
d("Basic Rendering", () => {
|
|
26
|
+
s("should render sectioned-content element", () => {
|
|
27
|
+
const e = [o()], { container: n } = i(/* @__PURE__ */ c(r, { sections: e })), a = n.querySelector("sectioned-content");
|
|
28
|
+
t(a).toBeInTheDocument();
|
|
29
|
+
}), s("should render empty sectioned-content when sections array is empty", () => {
|
|
30
|
+
const { container: e } = i(/* @__PURE__ */ c(r, { sections: [] })), n = e.querySelector("sectioned-content");
|
|
31
|
+
t(n).toBeInTheDocument(), t(n == null ? void 0 : n.children).toHaveLength(0);
|
|
32
|
+
}), s("should render empty sectioned-content when sections is undefined", () => {
|
|
33
|
+
const { container: e } = i(/* @__PURE__ */ c(r, {})), n = e.querySelector("sectioned-content");
|
|
34
|
+
t(n).toBeInTheDocument(), t(n == null ? void 0 : n.children).toHaveLength(0);
|
|
35
|
+
}), s("should render correct number of sections", () => {
|
|
36
|
+
const e = [
|
|
37
|
+
o({ header: { type: "primary", title: "Section 1" } }),
|
|
38
|
+
o({ header: { type: "secondary", title: "Section 2" } }),
|
|
39
|
+
o({ header: { type: "primary", title: "Section 3" } })
|
|
40
|
+
], { container: n } = i(/* @__PURE__ */ c(r, { sections: e })), a = n.querySelectorAll(".sectioned-content__content");
|
|
41
|
+
t(a).toHaveLength(3);
|
|
42
|
+
});
|
|
43
|
+
}), d("Header Types", () => {
|
|
44
|
+
s("should render primary header as h1 with h2 class", () => {
|
|
45
|
+
const e = [o({
|
|
46
|
+
header: { type: "primary", title: "Primary Header" }
|
|
47
|
+
})];
|
|
48
|
+
i(/* @__PURE__ */ c(r, { sections: e })), t(l).toHaveBeenCalledWith(
|
|
49
|
+
t.stringContaining('<h1 class="h2')
|
|
50
|
+
), t(l).toHaveBeenCalledWith(
|
|
51
|
+
t.stringContaining("Primary Header</h1>")
|
|
52
|
+
);
|
|
53
|
+
}), s("should render secondary header as h2 with h3 class", () => {
|
|
54
|
+
const e = [o({
|
|
55
|
+
header: { type: "secondary", title: "Secondary Header" }
|
|
56
|
+
})];
|
|
57
|
+
i(/* @__PURE__ */ c(r, { sections: e })), t(l).toHaveBeenCalledWith(
|
|
58
|
+
t.stringContaining('<h2 class="h3')
|
|
59
|
+
), t(l).toHaveBeenCalledWith(
|
|
60
|
+
t.stringContaining("Secondary Header</h2>")
|
|
61
|
+
);
|
|
62
|
+
}), s("should call classes helper for primary header", () => {
|
|
63
|
+
const e = [o({ header: { type: "primary", title: "Test" } })];
|
|
64
|
+
i(/* @__PURE__ */ c(r, { sections: e })), t(h).toHaveBeenCalledWith(
|
|
65
|
+
t.arrayContaining(["h2"])
|
|
66
|
+
);
|
|
67
|
+
}), s("should call classes helper for secondary header", () => {
|
|
68
|
+
const e = [o({ header: { type: "secondary", title: "Test" } })];
|
|
69
|
+
i(/* @__PURE__ */ c(r, { sections: e })), t(h).toHaveBeenCalledWith(
|
|
70
|
+
t.arrayContaining(["h3"])
|
|
71
|
+
);
|
|
72
|
+
}), s("should handle both header types in same component", () => {
|
|
73
|
+
const e = [
|
|
74
|
+
o({ header: { type: "primary", title: "Primary" } }),
|
|
75
|
+
o({ header: { type: "secondary", title: "Secondary" } })
|
|
76
|
+
];
|
|
77
|
+
i(/* @__PURE__ */ c(r, { sections: e })), t(l).toHaveBeenCalledWith(
|
|
78
|
+
t.stringContaining("<h1")
|
|
79
|
+
), t(l).toHaveBeenCalledWith(
|
|
80
|
+
t.stringContaining("<h2")
|
|
81
|
+
);
|
|
82
|
+
});
|
|
83
|
+
}), d("Content Rendering", () => {
|
|
84
|
+
s("should parse string content with html-react-parser", () => {
|
|
85
|
+
const e = [o({
|
|
86
|
+
content: "<p>HTML content</p>"
|
|
87
|
+
})];
|
|
88
|
+
i(/* @__PURE__ */ c(r, { sections: e })), t(l).toHaveBeenCalledWith("<p>HTML content</p>");
|
|
89
|
+
}), s("should render JSX.Element content directly", () => {
|
|
90
|
+
const e = [o({
|
|
91
|
+
content: /* @__PURE__ */ c("div", { "data-testid": "jsx-content", children: "JSX Content" })
|
|
92
|
+
})], { getByTestId: n } = i(/* @__PURE__ */ c(r, { sections: e }));
|
|
93
|
+
t(n("jsx-content")).toBeInTheDocument(), t(n("jsx-content")).toHaveTextContent("JSX Content");
|
|
94
|
+
}), s("should wrap content in div with correct classes", () => {
|
|
95
|
+
const e = [o()], { container: n } = i(/* @__PURE__ */ c(r, { sections: e })), a = n.querySelector(".sectioned-content__content");
|
|
96
|
+
t(a).toBeInTheDocument();
|
|
97
|
+
}), s("should call classes helper for content div", () => {
|
|
98
|
+
const e = [o()];
|
|
99
|
+
i(/* @__PURE__ */ c(r, { sections: e })), t(h).toHaveBeenCalledWith(
|
|
100
|
+
t.arrayContaining(["sectioned-content__content"])
|
|
101
|
+
);
|
|
102
|
+
}), s("should handle complex HTML strings", () => {
|
|
103
|
+
const e = "<div><p>Paragraph 1</p><ul><li>Item 1</li><li>Item 2</li></ul></div>", n = [o({ content: e })];
|
|
104
|
+
i(/* @__PURE__ */ c(r, { sections: n })), t(l).toHaveBeenCalledWith(e);
|
|
105
|
+
}), s("should handle multiple JSX elements", () => {
|
|
106
|
+
const e = [
|
|
107
|
+
o({
|
|
108
|
+
header: { type: "primary", title: "Section 1" },
|
|
109
|
+
content: /* @__PURE__ */ c("div", { "data-testid": "jsx-1", children: "Content 1" })
|
|
110
|
+
}),
|
|
111
|
+
o({
|
|
112
|
+
header: { type: "secondary", title: "Section 2" },
|
|
113
|
+
content: /* @__PURE__ */ c("div", { "data-testid": "jsx-2", children: "Content 2" })
|
|
114
|
+
})
|
|
115
|
+
], { getByTestId: n } = i(/* @__PURE__ */ c(r, { sections: e }));
|
|
116
|
+
t(n("jsx-1")).toBeInTheDocument(), t(n("jsx-2")).toBeInTheDocument();
|
|
117
|
+
});
|
|
118
|
+
}), d("Conditional Rendering", () => {
|
|
119
|
+
s("should not render section when content is undefined", () => {
|
|
120
|
+
const e = [o({
|
|
121
|
+
content: void 0
|
|
122
|
+
})], { container: n } = i(/* @__PURE__ */ c(r, { sections: e })), a = n.querySelectorAll(".sectioned-content__content");
|
|
123
|
+
t(a).toHaveLength(0);
|
|
124
|
+
}), s("should not render section when content is empty string", () => {
|
|
125
|
+
const e = [o({ content: "" })], { container: n } = i(/* @__PURE__ */ c(r, { sections: e })), a = n.querySelectorAll(".sectioned-content__content");
|
|
126
|
+
t(a).toHaveLength(0);
|
|
127
|
+
}), s("should not render section when header is undefined", () => {
|
|
128
|
+
const e = [o({
|
|
129
|
+
header: void 0
|
|
130
|
+
})], { container: n } = i(/* @__PURE__ */ c(r, { sections: e })), a = n.querySelectorAll(".sectioned-content__content");
|
|
131
|
+
t(a).toHaveLength(0);
|
|
132
|
+
}), s("should render valid sections and skip invalid ones", () => {
|
|
133
|
+
const e = [
|
|
134
|
+
o({ header: { type: "primary", title: "Valid 1" } }),
|
|
135
|
+
o({ content: "" }),
|
|
136
|
+
o({ header: { type: "secondary", title: "Valid 2" } }),
|
|
137
|
+
o({ content: void 0 })
|
|
138
|
+
], { container: n } = i(/* @__PURE__ */ c(r, { sections: e })), a = n.querySelectorAll(".sectioned-content__content");
|
|
139
|
+
t(a).toHaveLength(2);
|
|
140
|
+
}), s("should render empty Fragment for invalid sections", () => {
|
|
141
|
+
const e = [
|
|
142
|
+
o({ content: "" })
|
|
143
|
+
], { container: n } = i(/* @__PURE__ */ c(r, { sections: e })), a = n.querySelector("sectioned-content");
|
|
144
|
+
t(a).toBeInTheDocument();
|
|
145
|
+
const p = n.querySelectorAll(".sectioned-content__content");
|
|
146
|
+
t(p).toHaveLength(0);
|
|
147
|
+
});
|
|
148
|
+
}), d("Fragment Keys", () => {
|
|
149
|
+
s("should use header title and index for valid section keys", () => {
|
|
150
|
+
const e = [
|
|
151
|
+
o({ header: { type: "primary", title: "About Us" } })
|
|
152
|
+
], { container: n } = i(/* @__PURE__ */ c(r, { sections: e })), a = n.querySelectorAll(".sectioned-content__content");
|
|
153
|
+
t(a).toHaveLength(1);
|
|
154
|
+
}), s("should use index-only key for invalid sections", () => {
|
|
155
|
+
const e = [
|
|
156
|
+
o({ content: "" })
|
|
157
|
+
], { container: n } = i(/* @__PURE__ */ c(r, { sections: e })), a = n.querySelectorAll(".sectioned-content__content");
|
|
158
|
+
t(a).toHaveLength(0);
|
|
159
|
+
}), s("should handle duplicate header titles with different indices", () => {
|
|
160
|
+
const e = [
|
|
161
|
+
o({ header: { type: "primary", title: "Duplicate" } }),
|
|
162
|
+
o({ header: { type: "secondary", title: "Duplicate" } })
|
|
163
|
+
], { container: n } = i(/* @__PURE__ */ c(r, { sections: e })), a = n.querySelectorAll(".sectioned-content__content");
|
|
164
|
+
t(a).toHaveLength(2);
|
|
165
|
+
});
|
|
166
|
+
}), d("Edge Cases", () => {
|
|
167
|
+
s("should handle section with special characters in title", () => {
|
|
168
|
+
const e = [o({
|
|
169
|
+
header: { type: "primary", title: 'Title with <special> & "characters"' }
|
|
170
|
+
})];
|
|
171
|
+
i(/* @__PURE__ */ c(r, { sections: e })), t(l).toHaveBeenCalledWith(
|
|
172
|
+
t.stringContaining('Title with <special> & "characters"')
|
|
173
|
+
);
|
|
174
|
+
}), s("should handle section with very long title", () => {
|
|
175
|
+
const e = "A".repeat(500), n = [o({
|
|
176
|
+
header: { type: "primary", title: e }
|
|
177
|
+
})];
|
|
178
|
+
i(/* @__PURE__ */ c(r, { sections: n })), t(l).toHaveBeenCalledWith(
|
|
179
|
+
t.stringContaining(e)
|
|
180
|
+
);
|
|
181
|
+
}), s("should handle section with very long HTML content", () => {
|
|
182
|
+
const e = "<p>" + "Content ".repeat(1e3) + "</p>", n = [o({ content: e })];
|
|
183
|
+
i(/* @__PURE__ */ c(r, { sections: n })), t(l).toHaveBeenCalledWith(e);
|
|
184
|
+
}), s("should handle empty title string", () => {
|
|
185
|
+
const e = [o({
|
|
186
|
+
header: { type: "primary", title: "" }
|
|
187
|
+
})], { container: n } = i(/* @__PURE__ */ c(r, { sections: e })), a = n.querySelectorAll(".sectioned-content__content");
|
|
188
|
+
t(a).toHaveLength(1);
|
|
189
|
+
}), s("should handle whitespace-only content", () => {
|
|
190
|
+
const e = [o({ content: " " })], { container: n } = i(/* @__PURE__ */ c(r, { sections: e })), a = n.querySelectorAll(".sectioned-content__content");
|
|
191
|
+
t(a).toHaveLength(1);
|
|
192
|
+
}), s("should handle large number of sections", () => {
|
|
193
|
+
const e = Array.from(
|
|
194
|
+
{ length: 50 },
|
|
195
|
+
(p, u) => o({
|
|
196
|
+
header: { type: u % 2 === 0 ? "primary" : "secondary", title: `Section ${u}` }
|
|
197
|
+
})
|
|
198
|
+
), { container: n } = i(/* @__PURE__ */ c(r, { sections: e })), a = n.querySelectorAll(".sectioned-content__content");
|
|
199
|
+
t(a).toHaveLength(50);
|
|
200
|
+
}), s("should handle mixed valid and invalid sections", () => {
|
|
201
|
+
const e = [
|
|
202
|
+
o({ header: { type: "primary", title: "Valid" } }),
|
|
203
|
+
o({ content: "" }),
|
|
204
|
+
o({ header: void 0 }),
|
|
205
|
+
o({ header: { type: "secondary", title: "Also Valid" } }),
|
|
206
|
+
o({ content: void 0 })
|
|
207
|
+
], { container: n } = i(/* @__PURE__ */ c(r, { sections: e })), a = n.querySelectorAll(".sectioned-content__content");
|
|
208
|
+
t(a).toHaveLength(2);
|
|
209
|
+
}), s("should handle section with HTML entities in content", () => {
|
|
210
|
+
const e = "<p><div> & "test"</p>", n = [o({ content: e })];
|
|
211
|
+
i(/* @__PURE__ */ c(r, { sections: n })), t(l).toHaveBeenCalledWith(e);
|
|
212
|
+
}), s("should handle section with unicode characters", () => {
|
|
213
|
+
const e = [o({
|
|
214
|
+
header: { type: "primary", title: "🎉 Unicode Title 你好" },
|
|
215
|
+
content: "<p>Content with émojis 🌟</p>"
|
|
216
|
+
})];
|
|
217
|
+
i(/* @__PURE__ */ c(r, { sections: e })), t(l).toHaveBeenCalledWith(
|
|
218
|
+
t.stringContaining("🎉 Unicode Title 你好")
|
|
219
|
+
);
|
|
220
|
+
});
|
|
221
|
+
}), d("Type Safety", () => {
|
|
222
|
+
s("should accept valid Section array", () => {
|
|
223
|
+
const e = [
|
|
224
|
+
{
|
|
225
|
+
header: { type: "primary", title: "Title" },
|
|
226
|
+
content: "<p>Content</p>"
|
|
227
|
+
}
|
|
228
|
+
], { container: n } = i(/* @__PURE__ */ c(r, { sections: e }));
|
|
229
|
+
t(n.querySelector("sectioned-content")).toBeInTheDocument();
|
|
230
|
+
}), s("should accept sections with JSX.Element content", () => {
|
|
231
|
+
const e = [
|
|
232
|
+
{
|
|
233
|
+
header: { type: "secondary", title: "Title" },
|
|
234
|
+
content: /* @__PURE__ */ c("div", { children: "JSX Content" })
|
|
235
|
+
}
|
|
236
|
+
], { container: n } = i(/* @__PURE__ */ c(r, { sections: e }));
|
|
237
|
+
t(n.querySelector("sectioned-content")).toBeInTheDocument();
|
|
238
|
+
}), s("should accept both header types", () => {
|
|
239
|
+
const e = [
|
|
240
|
+
{ header: { type: "primary", title: "Primary" }, content: "Content" },
|
|
241
|
+
{ header: { type: "secondary", title: "Secondary" }, content: "Content" }
|
|
242
|
+
], { container: n } = i(/* @__PURE__ */ c(r, { sections: e })), a = n.querySelectorAll(".sectioned-content__content");
|
|
243
|
+
t(a).toHaveLength(2);
|
|
244
|
+
});
|
|
245
|
+
}), d("Integration Tests", () => {
|
|
246
|
+
s("should render complete component with all features", () => {
|
|
247
|
+
const e = [
|
|
248
|
+
{
|
|
249
|
+
header: { type: "primary", title: "About Us" },
|
|
250
|
+
content: "<p>We are a company dedicated to excellence.</p>"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
header: { type: "secondary", title: "Our Mission" },
|
|
254
|
+
content: /* @__PURE__ */ c("div", { "data-testid": "mission", children: "To serve our customers" })
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
header: { type: "primary", title: "Contact" },
|
|
258
|
+
content: "<p>Email: test@example.com</p>"
|
|
259
|
+
}
|
|
260
|
+
], { container: n, getByTestId: a } = i(/* @__PURE__ */ c(r, { sections: e }));
|
|
261
|
+
t(n.querySelector("sectioned-content")).toBeInTheDocument();
|
|
262
|
+
const p = n.querySelectorAll(".sectioned-content__content");
|
|
263
|
+
t(p).toHaveLength(3), t(a("mission")).toBeInTheDocument();
|
|
264
|
+
}), s("should properly coordinate header parsing and content rendering", () => {
|
|
265
|
+
const e = [o()];
|
|
266
|
+
i(/* @__PURE__ */ c(r, { sections: e })), t(l).toHaveBeenCalledWith(
|
|
267
|
+
t.stringContaining("<h1")
|
|
268
|
+
), t(l).toHaveBeenCalledWith(
|
|
269
|
+
t.stringContaining("<p>Test content</p>")
|
|
270
|
+
);
|
|
271
|
+
}), s("should handle alternating string and JSX content", () => {
|
|
272
|
+
const e = [
|
|
273
|
+
o({
|
|
274
|
+
header: { type: "primary", title: "String Section" },
|
|
275
|
+
content: "<p>String content</p>"
|
|
276
|
+
}),
|
|
277
|
+
o({
|
|
278
|
+
header: { type: "secondary", title: "JSX Section" },
|
|
279
|
+
content: /* @__PURE__ */ c("div", { "data-testid": "jsx", children: "JSX content" })
|
|
280
|
+
}),
|
|
281
|
+
o({
|
|
282
|
+
header: { type: "primary", title: "Another String" },
|
|
283
|
+
content: "<p>More string content</p>"
|
|
284
|
+
})
|
|
285
|
+
], { container: n, getByTestId: a } = i(/* @__PURE__ */ c(r, { sections: e })), p = n.querySelectorAll(".sectioned-content__content");
|
|
286
|
+
t(p).toHaveLength(3), t(a("jsx")).toBeInTheDocument(), t(l).toHaveBeenCalledWith("<p>String content</p>"), t(l).toHaveBeenCalledWith("<p>More string content</p>");
|
|
287
|
+
});
|
|
288
|
+
}), d("Default Props", () => {
|
|
289
|
+
s("should use empty array as default for sections prop", () => {
|
|
290
|
+
const { container: e } = i(/* @__PURE__ */ c(r, {})), n = e.querySelector("sectioned-content");
|
|
291
|
+
t(n).toBeInTheDocument(), t(n == null ? void 0 : n.children).toHaveLength(0);
|
|
292
|
+
});
|
|
293
|
+
}), d("HTML Parser Integration", () => {
|
|
294
|
+
s("should call parse for each header", () => {
|
|
295
|
+
const e = [
|
|
296
|
+
o({ header: { type: "primary", title: "Title 1" } }),
|
|
297
|
+
o({ header: { type: "secondary", title: "Title 2" } })
|
|
298
|
+
];
|
|
299
|
+
l.mockClear(), i(/* @__PURE__ */ c(r, { sections: e })), t(l).toHaveBeenCalledTimes(4);
|
|
300
|
+
}), s("should not parse JSX.Element content", () => {
|
|
301
|
+
const e = [
|
|
302
|
+
o({
|
|
303
|
+
content: /* @__PURE__ */ c("div", { children: "JSX Content" })
|
|
304
|
+
})
|
|
305
|
+
];
|
|
306
|
+
l.mockClear(), i(/* @__PURE__ */ c(r, { sections: e })), t(l).toHaveBeenCalledTimes(1), t(l).toHaveBeenCalledWith(
|
|
307
|
+
t.stringContaining("<h1")
|
|
308
|
+
);
|
|
309
|
+
}), s("should parse header with combined classes markup", () => {
|
|
310
|
+
const e = [o({ header: { type: "primary", title: "Test" } })];
|
|
311
|
+
i(/* @__PURE__ */ c(r, { sections: e })), t(l).toHaveBeenCalledWith(
|
|
312
|
+
t.stringMatching(/<h1 class=".*">Test<\/h1>/)
|
|
313
|
+
);
|
|
314
|
+
});
|
|
315
|
+
}), d("CSS Classes Application", () => {
|
|
316
|
+
s("should apply classes helper to content divs", () => {
|
|
317
|
+
const e = [
|
|
318
|
+
o(),
|
|
319
|
+
o({ header: { type: "secondary", title: "Section 2" } })
|
|
320
|
+
];
|
|
321
|
+
h.mockClear(), i(/* @__PURE__ */ c(r, { sections: e })), t(h).toHaveBeenCalled();
|
|
322
|
+
}), s("should pass correct class arrays to classes helper", () => {
|
|
323
|
+
const e = [o()];
|
|
324
|
+
h.mockClear(), i(/* @__PURE__ */ c(r, { sections: e })), t(h).toHaveBeenCalledWith(
|
|
325
|
+
t.arrayContaining(["sectioned-content__content"])
|
|
326
|
+
);
|
|
327
|
+
});
|
|
328
|
+
}), d("Map Usage", () => {
|
|
329
|
+
s("should use Map to determine header markup for primary type", () => {
|
|
330
|
+
const e = [o({ header: { type: "primary", title: "Primary" } })];
|
|
331
|
+
i(/* @__PURE__ */ c(r, { sections: e })), t(l).toHaveBeenCalledWith(
|
|
332
|
+
t.stringMatching(/^<h1.*<\/h1>$/)
|
|
333
|
+
);
|
|
334
|
+
}), s("should use Map to determine header markup for secondary type", () => {
|
|
335
|
+
const e = [o({ header: { type: "secondary", title: "Secondary" } })];
|
|
336
|
+
i(/* @__PURE__ */ c(r, { sections: e })), t(l).toHaveBeenCalledWith(
|
|
337
|
+
t.stringMatching(/^<h2.*<\/h2>$/)
|
|
338
|
+
);
|
|
339
|
+
});
|
|
340
|
+
});
|
|
341
|
+
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as c, useRef as
|
|
3
|
-
import { s as e, C as
|
|
4
|
-
function
|
|
1
|
+
import { jsxs as r, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useState as c, useRef as k } from "react";
|
|
3
|
+
import { s as e, C as x, A as I } from "../../Form.module-CarfWK5T.mjs";
|
|
4
|
+
function O({
|
|
5
5
|
name: i,
|
|
6
6
|
label: _,
|
|
7
7
|
helpText: v,
|
|
8
|
-
multiple:
|
|
8
|
+
multiple: t = !1,
|
|
9
9
|
options: N,
|
|
10
10
|
width: s,
|
|
11
11
|
initValue: b = "",
|
|
@@ -13,11 +13,11 @@ function B({
|
|
|
13
13
|
...C
|
|
14
14
|
}) {
|
|
15
15
|
var m, h, p;
|
|
16
|
-
const [g
|
|
17
|
-
|
|
16
|
+
const [$, g] = c(`${e["form-field__input"]}`), l = k(null), [d, u] = c(""), [f, y] = c("clean"), S = `input-width--${s}`, V = () => {
|
|
17
|
+
y("touched"), l.current && (g(`${e["form-field__input"]} ${e["input--touched"]}`), l.current.checkValidity() ? u("") : u(l.current.validationMessage));
|
|
18
18
|
};
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
-
o && /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ r("label", { className: [e["form-field"], e[S], e["form-field--select"]].join(" "), htmlFor: i, children: [
|
|
20
|
+
o && /* @__PURE__ */ r(
|
|
21
21
|
"i",
|
|
22
22
|
{
|
|
23
23
|
className: [
|
|
@@ -25,40 +25,40 @@ function B({
|
|
|
25
25
|
(m = l.current) != null && m.validity.valid ? "" : e["form-field__icon--invalid"]
|
|
26
26
|
].join(" "),
|
|
27
27
|
children: [
|
|
28
|
-
((h = l.current) == null ? void 0 : h.checkValidity()) && f === "touched" && /* @__PURE__ */
|
|
29
|
-
!((p = l.current) != null && p.checkValidity()) && f === "touched" && /* @__PURE__ */
|
|
28
|
+
((h = l.current) == null ? void 0 : h.checkValidity()) && f === "touched" && /* @__PURE__ */ a(x, {}),
|
|
29
|
+
!((p = l.current) != null && p.checkValidity()) && f === "touched" && /* @__PURE__ */ a(I, {})
|
|
30
30
|
]
|
|
31
31
|
}
|
|
32
32
|
),
|
|
33
|
-
/* @__PURE__ */
|
|
33
|
+
/* @__PURE__ */ r("span", { className: e["form-field__label"], children: [
|
|
34
34
|
_,
|
|
35
35
|
" ",
|
|
36
|
-
/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */ a("span", { className: e["form-field__label-help"], children: v })
|
|
37
37
|
] }),
|
|
38
|
-
/* @__PURE__ */
|
|
38
|
+
/* @__PURE__ */ r(
|
|
39
39
|
"select",
|
|
40
40
|
{
|
|
41
|
-
className:
|
|
42
|
-
defaultValue: b,
|
|
41
|
+
className: $,
|
|
42
|
+
defaultValue: t ? [] : b,
|
|
43
43
|
id: i,
|
|
44
|
-
multiple:
|
|
44
|
+
multiple: t,
|
|
45
45
|
name: i,
|
|
46
46
|
ref: l,
|
|
47
47
|
onBlur: () => {
|
|
48
|
-
|
|
48
|
+
V();
|
|
49
49
|
},
|
|
50
50
|
...C,
|
|
51
51
|
children: [
|
|
52
|
-
!
|
|
53
|
-
!
|
|
54
|
-
N.map((n) => /* @__PURE__ */
|
|
52
|
+
!t && Number.parseInt(s, 10) > 20 && /* @__PURE__ */ a("option", { value: "", children: "-- Select One --" }),
|
|
53
|
+
!t && Number.parseInt(s, 10) <= 20 && /* @__PURE__ */ a("option", { value: "" }),
|
|
54
|
+
N.map((n, j) => /* @__PURE__ */ a("option", { value: n.value, children: n.label }, `option-${j}-${n.value}`))
|
|
55
55
|
]
|
|
56
56
|
}
|
|
57
57
|
),
|
|
58
|
-
|
|
58
|
+
d !== "" && o && /* @__PURE__ */ a("div", { className: e["form-field__error-message"], children: d })
|
|
59
59
|
] });
|
|
60
60
|
}
|
|
61
61
|
export {
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
O as Select,
|
|
63
|
+
O as default
|
|
64
64
|
};
|