@scrippsproduct/networks-ui-library 1.1.8 → 1.1.10-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Form.module-Cd8qH2rj.mjs → Form.module-CarfWK5T.mjs} +1 -1
- package/dist/ResultsTable.module-wcNUQEKe.mjs +14 -0
- package/dist/_commonjsHelpers-DaMA6jEr.mjs +8 -0
- package/dist/assets/ResultsTable.css +1 -1
- package/dist/assets/ScheduleLayout.css +1 -1
- package/dist/{chevron-left-DRvpaLmK.mjs → chevron-left-D0UjbrKw.mjs} +1 -1
- package/dist/{chevron-right-C8yCnmfx.mjs → chevron-right-0ZF3LruR.mjs} +1 -1
- package/dist/components/ActionButton/ActionButton.test.js +209 -0
- package/dist/components/AdBlock/AdBlock.test.js +286 -0
- package/dist/components/AdjustableTwoColumnGrid/AdjustableTwoColumnGrid.test.js +295 -0
- package/dist/components/AirDateFormatter/AirDateFormatter.test.js +192 -0
- package/dist/components/AnchorTag/AnchorTag.test.js +463 -0
- package/dist/components/BCVideoPlayer/BCVideoPlayer.test.js +295 -0
- package/dist/components/BasicGridModule/BasicGridModule.js +41 -37
- package/dist/components/BasicGridModule/BasicGridModule.test.js +227 -0
- package/dist/components/Button/Button.test.js +434 -0
- package/dist/components/Carousel/Carousel.js +2 -2
- package/dist/components/Carousel/Carousel.test.js +705 -0
- package/dist/components/CarouselSlide/CarouselSlide.test.js +378 -0
- package/dist/components/CarouselSlide/slide-layouts/TwoColumn/TwoColumnSlide.js +1 -1
- package/dist/components/CastInfoLayout/CastInfoLayout.test.js +294 -0
- package/dist/components/ChannelSearch/ChannelSearch.test.js +565 -0
- package/dist/components/ChoicesItem/ChoicesItem.test.js +428 -0
- package/dist/components/Concat/Concat.js +1 -1
- package/dist/components/Concat/Concat.test.js +115 -0
- package/dist/components/CtaBlock/CtaBlock.js +1 -1
- package/dist/components/CtaBlock/CtaBlock.test.js +226 -0
- package/dist/components/CustomDataList/CustomDataList.js +4 -4
- package/dist/components/CustomSelect/CustomSelect.js +86 -86
- package/dist/components/CustomSelect/CustomSelect.test.js +313 -0
- package/dist/components/DateNavigation/DateNavigation.js +10 -10
- package/dist/components/DateNavigation/DateNavigation.test.js +370 -0
- package/dist/components/DatePicker/DatePicker.js +1 -1
- package/dist/components/DeviceAndPlatformLists/DeviceAndPlatformLists.test.js +288 -0
- package/dist/components/DrawerNavigation/DrawerNavigation.test.js +316 -0
- package/dist/components/EqualSizeFlexRow/EqualSizeFlexRow.test.js +337 -0
- package/dist/components/EqualSizeGrid/EqualSizeGrid.test.js +358 -0
- package/dist/components/ErrorHandler/ErrorHandler.js +2 -2
- package/dist/components/ErrorHandler/ErrorHandler.test.js +158 -0
- package/dist/components/FeaturedList/FeaturedList.test.js +353 -0
- package/dist/components/Figure/Figure.js +1 -1
- package/dist/components/Figure/Figure.test.js +198 -0
- package/dist/components/FindUs/FindUs.test.js +499 -0
- package/dist/components/FooterNavigation/FooterNavigation.test.js +310 -0
- package/dist/components/GenericList/GenericList.js +1 -1
- package/dist/components/GenericList/GenericList.test.js +288 -0
- package/dist/components/GetAirdateWrapper/GetAirdateWrapper.test.js +689 -0
- package/dist/components/GradientButton/GradientButton.d.ts +1 -1
- package/dist/components/GradientButton/GradientButton.js +33 -31
- package/dist/components/GradientButton/GradientButton.test.js +457 -0
- package/dist/components/GridList/GridList.test.js +371 -0
- package/dist/components/ImageCard/ImageCard.test.js +668 -0
- package/dist/components/ImageCard/ImageCardCore.js +28 -28
- package/dist/components/ImageCard/ImageCardCore.test.js +577 -0
- package/dist/components/ImageReplacementAnchor/ImageReplacementAnchor.test.js +379 -0
- package/dist/components/InfoPanel/InfoPanel.js +1 -1
- package/dist/components/InlineNavigation/InlineNavigation.test.js +149 -0
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/Input/Input.test.js +263 -0
- package/dist/components/InstructionsList/InstructionsList.js +11 -11
- package/dist/components/InstructionsList/InstructionsList.test.js +181 -0
- package/dist/components/LogoListItem/LogoListItem.test.js +303 -0
- package/dist/components/LogoNavigation/LogoNavigation.test.js +352 -0
- package/dist/components/ModalContainer/ModalContainer.js +2 -2
- package/dist/components/NavList/NavList.test.js +332 -0
- package/dist/components/Overlay/Overlay.js +24 -23
- package/dist/components/Overlay/Overlay.test.js +198 -0
- package/dist/components/PageHero/PageHero.test.js +241 -0
- package/dist/components/PageHero/page-hero-layouts/IONShow/IONShowHero.js +1 -1
- package/dist/components/ProgramAirdate/ProgramAirdate.js +1 -1
- package/dist/components/ProgramAirdate/ProgramAirdate.test.js +414 -0
- package/dist/components/PromotionBlock/PromotionBlock.test.js +208 -0
- package/dist/components/PromotionsRowBlock/PromotionsRowBlock.test.js +221 -0
- package/dist/components/PromotionsRowModule/PromotionsRowModule.test.js +349 -0
- package/dist/components/RescanInstructions/RescanInstructions.test.js +218 -0
- package/dist/components/ResponsiveImage/ResponsiveImage.test.js +264 -0
- package/dist/components/ResultsTable/ResultsTable.js +9 -2
- package/dist/components/ResultsTable/ResultsTable.test.js +402 -0
- package/dist/components/ResultsTableBody/ResultsTableBody.js +1 -1
- package/dist/components/ResultsTableBody/ResultsTableBody.test.js +445 -0
- package/dist/components/ResultsTableHeader/ResultsTableHeader.js +37 -15
- package/dist/components/ResultsTableHeader/ResultsTableHeader.test.js +275 -0
- package/dist/components/ScheduleLayout/ScheduleContext.js +654 -626
- package/dist/components/ScheduleLayout/ScheduleLayout.js +1 -1
- package/dist/components/ScheduleLayout/useScheduleContext.js +5 -10
- package/dist/components/ScheduleList/ScheduleList.js +1 -1
- package/dist/components/SectionedContent/SectionedContent.js +1 -1
- package/dist/components/SectionedContent/SectionedContent.test.js +341 -0
- package/dist/components/Select/Select.js +24 -24
- package/dist/components/Select/Select.test.js +367 -0
- package/dist/components/ShowAboutContent/ShowAboutContent.js +1 -1
- package/dist/components/ShowAboutContent/ShowAboutContent.test.js +535 -0
- package/dist/components/ShowAboutLayout/ShowAboutLayout.test.js +570 -0
- package/dist/components/SocialLinks/SocialLinks.js +1 -1
- package/dist/components/StringList/StringList.js +1 -1
- package/dist/components/StringList/StringList.test.js +311 -0
- package/dist/components/TabContent/TabContent.js +1 -1
- package/dist/components/TabContent/TabContent.test.js +274 -0
- package/dist/components/TabNavigation/TabNavigation.js +21 -21
- package/dist/components/TabNavigation/TabNavigation.test.js +535 -0
- package/dist/components/TabbedContent/TabbedContent.test.js +654 -0
- package/dist/components/TextArea/TextArea.js +1 -1
- package/dist/components/UpcomingList/UpcomingList.test.js +471 -0
- package/dist/{index-VjANCDXC.mjs → index-06PEPfBQ.mjs} +1 -1
- package/dist/index-BUN4jQ3m.mjs +3098 -0
- package/dist/index-BVxBrkZB.mjs +3 -0
- package/dist/{index-DC2JJV3a.mjs → index-D3kkcgee.mjs} +1 -1
- package/dist/{index-C-kn9Zhn.mjs → index-DzfYkULW.mjs} +2 -1
- package/dist/magic-string.es-uPKorP4O.mjs +663 -0
- package/dist/matchers-35e4d3bd-BBPNTlen.mjs +2404 -0
- package/dist/react.esm-DLSrfVwM.mjs +23410 -0
- package/dist/test/setupTests.d.ts +1 -0
- package/dist/test/setupTests.js +55 -0
- package/dist/{triangle-PcCcGXjr.mjs → triangle-C4z906Wf.mjs} +1 -1
- package/dist/useScheduleContext-D7FdzNxe.mjs +17 -0
- package/dist/utils/analytics.js +1 -1
- package/dist/utils/getOnNowProgram.js +10 -10
- package/dist/{x-C-QzJ-qD.mjs → x-Ck9Vk5Fo.mjs} +1 -1
- package/package.json +4 -1
- package/dist/ResultsTable.module-1zxhXaem.mjs +0 -14
- package/dist/_commonjsHelpers-C6fGbg64.mjs +0 -6
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { v as p, d, b, i as a, r as n, g as o, s as r, f as u } from "../../react.esm-DLSrfVwM.mjs";
|
|
3
|
+
import "../../index-BVxBrkZB.mjs";
|
|
4
|
+
import { Select as s } from "./Select.js";
|
|
5
|
+
p.mock("react-feather", () => ({
|
|
6
|
+
CheckCircle: () => /* @__PURE__ */ l("div", { "data-testid": "check-circle", children: "CheckCircle" }),
|
|
7
|
+
AlertTriangle: () => /* @__PURE__ */ l("div", { "data-testid": "alert-triangle", children: "AlertTriangle" })
|
|
8
|
+
}));
|
|
9
|
+
d("Select", () => {
|
|
10
|
+
const m = (e = 3) => Array.from({ length: e }, (t, i) => ({
|
|
11
|
+
label: `Option ${i + 1}`,
|
|
12
|
+
value: `value${i + 1}`
|
|
13
|
+
})), c = {
|
|
14
|
+
name: "testSelect",
|
|
15
|
+
label: "Test Label",
|
|
16
|
+
options: m(),
|
|
17
|
+
width: "50"
|
|
18
|
+
};
|
|
19
|
+
b(() => {
|
|
20
|
+
p.clearAllMocks();
|
|
21
|
+
}), d("Basic Rendering", () => {
|
|
22
|
+
a("should render label element", () => {
|
|
23
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c })), t = e.querySelector("label");
|
|
24
|
+
o(t).toBeInTheDocument();
|
|
25
|
+
}), a("should render select element", () => {
|
|
26
|
+
n(/* @__PURE__ */ l(s, { ...c }));
|
|
27
|
+
const e = r.getByRole("combobox");
|
|
28
|
+
o(e).toBeInTheDocument();
|
|
29
|
+
}), a("should render label text", () => {
|
|
30
|
+
n(/* @__PURE__ */ l(s, { ...c, label: "My Label" })), o(r.getByText("My Label")).toBeInTheDocument();
|
|
31
|
+
}), a("should render all options", () => {
|
|
32
|
+
const e = [
|
|
33
|
+
{ label: "First", value: "first" },
|
|
34
|
+
{ label: "Second", value: "second" },
|
|
35
|
+
{ label: "Third", value: "third" }
|
|
36
|
+
], { container: t } = n(/* @__PURE__ */ l(s, { ...c, options: e })), i = t.querySelectorAll("option");
|
|
37
|
+
o(i).toHaveLength(4);
|
|
38
|
+
}), a("should set name attribute on select", () => {
|
|
39
|
+
n(/* @__PURE__ */ l(s, { ...c, name: "mySelect" }));
|
|
40
|
+
const e = r.getByRole("combobox");
|
|
41
|
+
o(e).toHaveAttribute("name", "mySelect");
|
|
42
|
+
}), a("should set id attribute on select", () => {
|
|
43
|
+
n(/* @__PURE__ */ l(s, { ...c, name: "mySelect" }));
|
|
44
|
+
const e = r.getByRole("combobox");
|
|
45
|
+
o(e).toHaveAttribute("id", "mySelect");
|
|
46
|
+
}), a("should link label to select via htmlFor", () => {
|
|
47
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, name: "mySelect" })), t = e.querySelector("label");
|
|
48
|
+
o(t).toHaveAttribute("for", "mySelect");
|
|
49
|
+
});
|
|
50
|
+
}), d("Width Classes", () => {
|
|
51
|
+
a("should apply width class based on width prop", () => {
|
|
52
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, width: "30" })), t = e.querySelector("label");
|
|
53
|
+
o(t).toHaveClass("input-width--30");
|
|
54
|
+
}), a("should apply different width classes", () => {
|
|
55
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, width: "50" })), { container: t } = n(/* @__PURE__ */ l(s, { ...c, width: "100" })), i = e.querySelector("label"), h = t.querySelector("label");
|
|
56
|
+
o(i).toHaveClass("input-width--50"), o(h).toHaveClass("input-width--100");
|
|
57
|
+
}), a("should apply form-field and form-field--select classes", () => {
|
|
58
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c })), t = e.querySelector("label");
|
|
59
|
+
o(t == null ? void 0 : t.className).toContain("form-field"), o(t == null ? void 0 : t.className).toContain("form-field--select");
|
|
60
|
+
});
|
|
61
|
+
}), d("Options Rendering", () => {
|
|
62
|
+
a("should render option with correct label", () => {
|
|
63
|
+
n(/* @__PURE__ */ l(s, { ...c, options: [{ label: "Custom Label", value: "custom" }] })), o(r.getByText("Custom Label")).toBeInTheDocument();
|
|
64
|
+
}), a("should render option with correct value", () => {
|
|
65
|
+
const e = [{ label: "Label", value: "customValue" }], { container: t } = n(/* @__PURE__ */ l(s, { ...c, options: e })), i = t.querySelector('option[value="customValue"]');
|
|
66
|
+
o(i).toBeInTheDocument();
|
|
67
|
+
}), a("should render option with numeric value", () => {
|
|
68
|
+
const e = [{ label: "Number", value: 123 }], { container: t } = n(/* @__PURE__ */ l(s, { ...c, options: e })), i = t.querySelector('option[value="123"]');
|
|
69
|
+
o(i).toBeInTheDocument();
|
|
70
|
+
}), a("should generate unique keys for options", () => {
|
|
71
|
+
n(/* @__PURE__ */ l(s, { ...c, options: [
|
|
72
|
+
{ label: "First", value: "val1" },
|
|
73
|
+
{ label: "Second", value: "val2" }
|
|
74
|
+
] })), o(r.getByText("First")).toBeInTheDocument(), o(r.getByText("Second")).toBeInTheDocument();
|
|
75
|
+
}), a("should handle empty options array", () => {
|
|
76
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, options: [] })), t = e.querySelectorAll("option");
|
|
77
|
+
o(t).toHaveLength(1);
|
|
78
|
+
});
|
|
79
|
+
}), d("Default First Option", () => {
|
|
80
|
+
a('should render "-- Select One --" when width > 20 and not multiple', () => {
|
|
81
|
+
n(/* @__PURE__ */ l(s, { ...c, multiple: !1, width: "30" })), o(r.getByText("-- Select One --")).toBeInTheDocument();
|
|
82
|
+
}), a("should render empty option when width <= 20 and not multiple", () => {
|
|
83
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, multiple: !1, width: "20" })), t = e.querySelector('option[value=""]');
|
|
84
|
+
o(t).toBeInTheDocument(), o(t == null ? void 0 : t.textContent).toBe("");
|
|
85
|
+
}), a("should not render default option when multiple is true", () => {
|
|
86
|
+
n(/* @__PURE__ */ l(s, { ...c, multiple: !0, width: "50" })), o(r.queryByText("-- Select One --")).not.toBeInTheDocument();
|
|
87
|
+
}), a("should handle width boundary at 20", () => {
|
|
88
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, width: "20" })), t = e.querySelector('option[value=""]');
|
|
89
|
+
o(t == null ? void 0 : t.textContent).toBe("");
|
|
90
|
+
});
|
|
91
|
+
}), d("Multiple Select", () => {
|
|
92
|
+
a("should set multiple attribute when multiple is true", () => {
|
|
93
|
+
n(/* @__PURE__ */ l(s, { ...c, multiple: !0 }));
|
|
94
|
+
const e = r.getByRole("listbox");
|
|
95
|
+
o(e).toHaveAttribute("multiple");
|
|
96
|
+
}), a("should not set multiple attribute when multiple is false", () => {
|
|
97
|
+
n(/* @__PURE__ */ l(s, { ...c, multiple: !1 }));
|
|
98
|
+
const e = r.getByRole("combobox");
|
|
99
|
+
o(e).not.toHaveAttribute("multiple");
|
|
100
|
+
}), a("should use false as default for multiple", () => {
|
|
101
|
+
n(/* @__PURE__ */ l(s, { ...c }));
|
|
102
|
+
const e = r.getByRole("combobox");
|
|
103
|
+
o(e).not.toHaveAttribute("multiple");
|
|
104
|
+
});
|
|
105
|
+
}), d("Initial Value", () => {
|
|
106
|
+
a("should set defaultValue to initValue", () => {
|
|
107
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, initValue: "value2" })), t = e.querySelector("select");
|
|
108
|
+
o(t.value).toBe("value2");
|
|
109
|
+
}), a("should use empty string as default initValue", () => {
|
|
110
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c })), t = e.querySelector("select");
|
|
111
|
+
o(t.value).toBe("");
|
|
112
|
+
}), a("should handle numeric initValue", () => {
|
|
113
|
+
const e = [{ label: "Number", value: 123 }], { container: t } = n(/* @__PURE__ */ l(s, { ...c, initValue: "123", options: e })), i = t.querySelector("select");
|
|
114
|
+
o(i.value).toBe("123");
|
|
115
|
+
});
|
|
116
|
+
}), d("Help Text", () => {
|
|
117
|
+
a("should render help text when provided", () => {
|
|
118
|
+
n(/* @__PURE__ */ l(s, { ...c, helpText: "This is help text" })), o(r.getByText("This is help text")).toBeInTheDocument();
|
|
119
|
+
}), a("should not render help text when not provided", () => {
|
|
120
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c })), t = e.querySelector(".form-field__label-help");
|
|
121
|
+
o(t).toBeInTheDocument(), o(t == null ? void 0 : t.textContent).toBe("");
|
|
122
|
+
}), a("should wrap help text in correct class", () => {
|
|
123
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, helpText: "Help" })), t = e.querySelector(".form-field__label-help");
|
|
124
|
+
o(t).toHaveTextContent("Help");
|
|
125
|
+
});
|
|
126
|
+
}), d("Validation States", () => {
|
|
127
|
+
a("should start with clean validation status", () => {
|
|
128
|
+
n(/* @__PURE__ */ l(s, { ...c })), o(r.queryByTestId("check-circle")).not.toBeInTheDocument(), o(r.queryByTestId("alert-triangle")).not.toBeInTheDocument();
|
|
129
|
+
}), a("should change to touched state on blur", () => {
|
|
130
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, required: !0 })), t = r.getByRole("combobox");
|
|
131
|
+
u.blur(t);
|
|
132
|
+
const i = e.querySelector("select");
|
|
133
|
+
o(i).toHaveClass("input--touched");
|
|
134
|
+
}), a("should show validation icon after blur", () => {
|
|
135
|
+
n(/* @__PURE__ */ l(s, { ...c, required: !0 }));
|
|
136
|
+
const e = r.getByRole("combobox");
|
|
137
|
+
o(r.queryByTestId("check-circle")).not.toBeInTheDocument(), u.blur(e);
|
|
138
|
+
const t = r.queryByTestId("check-circle") || r.queryByTestId("alert-triangle");
|
|
139
|
+
o(t).toBeInTheDocument();
|
|
140
|
+
});
|
|
141
|
+
}), d("Validation Icons", () => {
|
|
142
|
+
a("should show CheckCircle when valid and touched", () => {
|
|
143
|
+
n(/* @__PURE__ */ l(s, { ...c, required: !0, options: [{ label: "Valid", value: "valid" }] }));
|
|
144
|
+
const t = r.getByRole("combobox");
|
|
145
|
+
u.change(t, { target: { value: "valid" } }), u.blur(t), o(r.getByTestId("check-circle")).toBeInTheDocument();
|
|
146
|
+
}), a("should show AlertTriangle when invalid and touched", () => {
|
|
147
|
+
n(/* @__PURE__ */ l(s, { ...c, required: !0 }));
|
|
148
|
+
const e = r.getByRole("combobox");
|
|
149
|
+
u.blur(e), o(r.getByTestId("alert-triangle")).toBeInTheDocument();
|
|
150
|
+
}), a("should not show validation icons when showValidation is false", () => {
|
|
151
|
+
n(/* @__PURE__ */ l(s, { ...c, required: !0, showValidation: !1 }));
|
|
152
|
+
const e = r.getByRole("combobox");
|
|
153
|
+
u.blur(e), o(r.queryByTestId("check-circle")).not.toBeInTheDocument(), o(r.queryByTestId("alert-triangle")).not.toBeInTheDocument();
|
|
154
|
+
}), a("should apply invalid icon class when invalid", () => {
|
|
155
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, required: !0 })), t = r.getByRole("combobox");
|
|
156
|
+
u.blur(t);
|
|
157
|
+
const i = e.querySelector(".form-field__icon--invalid");
|
|
158
|
+
o(i).toBeInTheDocument();
|
|
159
|
+
}), a("should show validation icons by default (showValidation=true)", () => {
|
|
160
|
+
n(/* @__PURE__ */ l(s, { ...c, required: !0, options: [{ label: "Valid", value: "valid" }] }));
|
|
161
|
+
const t = r.getByRole("combobox");
|
|
162
|
+
u.change(t, { target: { value: "valid" } }), u.blur(t), o(r.getByTestId("check-circle")).toBeInTheDocument();
|
|
163
|
+
});
|
|
164
|
+
}), d("Validation Messages", () => {
|
|
165
|
+
a("should show validation message when invalid and touched", () => {
|
|
166
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, required: !0 })), t = r.getByRole("combobox");
|
|
167
|
+
u.blur(t);
|
|
168
|
+
const i = e.querySelector(".form-field__error-message");
|
|
169
|
+
o(i).toBeInTheDocument(), o(i == null ? void 0 : i.textContent).toBeTruthy();
|
|
170
|
+
}), a("should not show validation message when valid", () => {
|
|
171
|
+
const e = [{ label: "Valid", value: "valid" }], { container: t } = n(/* @__PURE__ */ l(s, { ...c, required: !0, options: e })), i = r.getByRole("combobox");
|
|
172
|
+
u.change(i, { target: { value: "valid" } }), u.blur(i);
|
|
173
|
+
const h = t.querySelector(".form-field__error-message");
|
|
174
|
+
o(h).not.toBeInTheDocument();
|
|
175
|
+
}), a("should not show validation message when showValidation is false", () => {
|
|
176
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, required: !0, showValidation: !1 })), t = r.getByRole("combobox");
|
|
177
|
+
u.blur(t);
|
|
178
|
+
const i = e.querySelector(".form-field__error-message");
|
|
179
|
+
o(i).not.toBeInTheDocument();
|
|
180
|
+
}), a("should clear validation message when field becomes valid", () => {
|
|
181
|
+
const e = [{ label: "Valid", value: "valid" }], { container: t } = n(/* @__PURE__ */ l(s, { ...c, required: !0, options: e })), i = r.getByRole("combobox");
|
|
182
|
+
u.blur(i);
|
|
183
|
+
let h = t.querySelector(".form-field__error-message");
|
|
184
|
+
o(h).toBeInTheDocument(), u.change(i, { target: { value: "valid" } }), u.blur(i), h = t.querySelector(".form-field__error-message"), o(h).not.toBeInTheDocument();
|
|
185
|
+
});
|
|
186
|
+
}), d("Spread Attributes", () => {
|
|
187
|
+
a("should pass required attribute", () => {
|
|
188
|
+
n(/* @__PURE__ */ l(s, { ...c, required: !0 }));
|
|
189
|
+
const e = r.getByRole("combobox");
|
|
190
|
+
o(e).toBeRequired();
|
|
191
|
+
}), a("should pass disabled attribute", () => {
|
|
192
|
+
n(/* @__PURE__ */ l(s, { ...c, disabled: !0 }));
|
|
193
|
+
const e = r.getByRole("combobox");
|
|
194
|
+
o(e).toBeDisabled();
|
|
195
|
+
}), a("should pass custom data attributes", () => {
|
|
196
|
+
n(/* @__PURE__ */ l(s, { ...c, "data-testid": "custom-select" }));
|
|
197
|
+
const e = r.getByTestId("custom-select");
|
|
198
|
+
o(e).toBeInTheDocument();
|
|
199
|
+
}), a("should pass aria attributes", () => {
|
|
200
|
+
n(/* @__PURE__ */ l(s, { ...c, "aria-label": "Custom aria label" }));
|
|
201
|
+
const e = r.getByRole("combobox");
|
|
202
|
+
o(e).toHaveAttribute("aria-label", "Custom aria label");
|
|
203
|
+
}), a("should pass className attribute", () => {
|
|
204
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, className: "custom-class" })), t = e.querySelector("select");
|
|
205
|
+
o(t).toHaveClass("custom-class");
|
|
206
|
+
});
|
|
207
|
+
}), d("Edge Cases", () => {
|
|
208
|
+
a("should handle very long label text", () => {
|
|
209
|
+
const e = "A".repeat(500);
|
|
210
|
+
n(/* @__PURE__ */ l(s, { ...c, label: e })), o(r.getByText(e)).toBeInTheDocument();
|
|
211
|
+
}), a("should handle special characters in label", () => {
|
|
212
|
+
n(/* @__PURE__ */ l(s, { ...c, label: 'Label with <special> & "characters"' })), o(r.getByText('Label with <special> & "characters"')).toBeInTheDocument();
|
|
213
|
+
}), a("should handle unicode in option labels", () => {
|
|
214
|
+
n(/* @__PURE__ */ l(s, { ...c, options: [
|
|
215
|
+
{ label: "🎉 Emoji Option", value: "emoji" },
|
|
216
|
+
{ label: "你好 Chinese", value: "chinese" }
|
|
217
|
+
] })), o(r.getByText("🎉 Emoji Option")).toBeInTheDocument(), o(r.getByText("你好 Chinese")).toBeInTheDocument();
|
|
218
|
+
}), a("should handle very large number of options", () => {
|
|
219
|
+
const e = m(100), { container: t } = n(/* @__PURE__ */ l(s, { ...c, options: e })), i = t.querySelectorAll("option");
|
|
220
|
+
o(i).toHaveLength(101);
|
|
221
|
+
}), a("should handle empty string values", () => {
|
|
222
|
+
const e = [{ label: "Empty", value: "" }], { container: t } = n(/* @__PURE__ */ l(s, { ...c, options: e })), i = t.querySelector('option[value=""]');
|
|
223
|
+
o(i).toBeInTheDocument();
|
|
224
|
+
}), a("should handle duplicate values", () => {
|
|
225
|
+
const e = [
|
|
226
|
+
{ label: "First", value: "duplicate" },
|
|
227
|
+
{ label: "Second", value: "duplicate" }
|
|
228
|
+
], { container: t } = n(/* @__PURE__ */ l(s, { ...c, options: e })), i = t.querySelectorAll('option[value="duplicate"]');
|
|
229
|
+
o(i.length).toBeGreaterThan(0);
|
|
230
|
+
}), a("should handle width as string with non-numeric characters", () => {
|
|
231
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, width: "50px" })), t = e.querySelector("label");
|
|
232
|
+
o(t).toHaveClass("input-width--50px");
|
|
233
|
+
}), a("should handle very small width values", () => {
|
|
234
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, width: "5" })), t = e.querySelector("label");
|
|
235
|
+
o(t).toHaveClass("input-width--5");
|
|
236
|
+
const i = e.querySelector('option[value=""]');
|
|
237
|
+
o(i == null ? void 0 : i.textContent).toBe("");
|
|
238
|
+
}), a("should handle very large width values", () => {
|
|
239
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, width: "500" })), t = e.querySelector("label");
|
|
240
|
+
o(t).toHaveClass("input-width--500"), o(r.getByText("-- Select One --")).toBeInTheDocument();
|
|
241
|
+
});
|
|
242
|
+
}), d("Type Safety", () => {
|
|
243
|
+
a("should accept valid SelectOption array", () => {
|
|
244
|
+
const e = [
|
|
245
|
+
{ label: "Option 1", value: "val1" },
|
|
246
|
+
{ label: "Option 2", value: 123 }
|
|
247
|
+
], { container: t } = n(/* @__PURE__ */ l(s, { ...c, options: e }));
|
|
248
|
+
o(t.querySelector("select")).toBeInTheDocument();
|
|
249
|
+
}), a("should accept string values in SelectOption", () => {
|
|
250
|
+
n(/* @__PURE__ */ l(s, { ...c, options: [
|
|
251
|
+
{ label: "String", value: "stringValue" }
|
|
252
|
+
] })), o(r.getByText("String")).toBeInTheDocument();
|
|
253
|
+
}), a("should accept number values in SelectOption", () => {
|
|
254
|
+
n(/* @__PURE__ */ l(s, { ...c, options: [
|
|
255
|
+
{ label: "Number", value: 42 }
|
|
256
|
+
] })), o(r.getByText("Number")).toBeInTheDocument();
|
|
257
|
+
}), a("should accept all required props", () => {
|
|
258
|
+
const e = [{ label: "Test", value: "test" }], { container: t } = n(
|
|
259
|
+
/* @__PURE__ */ l(
|
|
260
|
+
s,
|
|
261
|
+
{
|
|
262
|
+
label: "Test Label",
|
|
263
|
+
name: "test",
|
|
264
|
+
options: e,
|
|
265
|
+
width: "50"
|
|
266
|
+
}
|
|
267
|
+
)
|
|
268
|
+
);
|
|
269
|
+
o(t.querySelector("select")).toBeInTheDocument();
|
|
270
|
+
}), a("should accept all optional props", () => {
|
|
271
|
+
const e = [{ label: "Test", value: "test" }], { container: t } = n(
|
|
272
|
+
/* @__PURE__ */ l(
|
|
273
|
+
s,
|
|
274
|
+
{
|
|
275
|
+
disabled: !0,
|
|
276
|
+
multiple: !0,
|
|
277
|
+
required: !0,
|
|
278
|
+
helpText: "Help",
|
|
279
|
+
label: "Test Label",
|
|
280
|
+
name: "test",
|
|
281
|
+
options: e,
|
|
282
|
+
showValidation: !1,
|
|
283
|
+
width: "50"
|
|
284
|
+
}
|
|
285
|
+
)
|
|
286
|
+
);
|
|
287
|
+
o(t.querySelector("select")).toBeInTheDocument();
|
|
288
|
+
});
|
|
289
|
+
}), d("Integration Tests", () => {
|
|
290
|
+
a("should render complete component with all features", () => {
|
|
291
|
+
const e = [
|
|
292
|
+
{ label: "Option A", value: "a" },
|
|
293
|
+
{ label: "Option B", value: "b" }
|
|
294
|
+
], { container: t } = n(
|
|
295
|
+
/* @__PURE__ */ l(
|
|
296
|
+
s,
|
|
297
|
+
{
|
|
298
|
+
required: !0,
|
|
299
|
+
helpText: "Choose an option",
|
|
300
|
+
initValue: "a",
|
|
301
|
+
label: "Integration Test Label",
|
|
302
|
+
name: "integrationTest",
|
|
303
|
+
options: e,
|
|
304
|
+
width: "75"
|
|
305
|
+
}
|
|
306
|
+
)
|
|
307
|
+
);
|
|
308
|
+
o(r.getByText("Integration Test Label")).toBeInTheDocument(), o(r.getByText("Choose an option")).toBeInTheDocument(), o(r.getByText("Option A")).toBeInTheDocument(), o(r.getByText("Option B")).toBeInTheDocument(), o(t.querySelector("select")).toBeRequired();
|
|
309
|
+
}), a("should coordinate validation state with UI elements", () => {
|
|
310
|
+
const e = [{ label: "Valid", value: "valid" }], { container: t } = n(
|
|
311
|
+
/* @__PURE__ */ l(
|
|
312
|
+
s,
|
|
313
|
+
{
|
|
314
|
+
...c,
|
|
315
|
+
required: !0,
|
|
316
|
+
options: e
|
|
317
|
+
}
|
|
318
|
+
)
|
|
319
|
+
), i = r.getByRole("combobox");
|
|
320
|
+
o(r.queryByTestId("check-circle")).not.toBeInTheDocument(), o(r.queryByTestId("alert-triangle")).not.toBeInTheDocument(), u.blur(i), o(r.getByTestId("alert-triangle")).toBeInTheDocument(), o(t.querySelector(".form-field__error-message")).toBeInTheDocument(), u.change(i, { target: { value: "valid" } }), u.blur(i), o(r.getByTestId("check-circle")).toBeInTheDocument(), o(t.querySelector(".form-field__error-message")).not.toBeInTheDocument();
|
|
321
|
+
}), a("should handle multiple blur events correctly", () => {
|
|
322
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, required: !0 })), t = r.getByRole("combobox");
|
|
323
|
+
u.blur(t), u.blur(t), u.blur(t), o(r.getByTestId("alert-triangle")).toBeInTheDocument(), o(e.querySelector(".input--touched")).toBeInTheDocument();
|
|
324
|
+
}), a("should maintain state through multiple interactions", () => {
|
|
325
|
+
n(/* @__PURE__ */ l(s, { ...c, required: !0, options: [
|
|
326
|
+
{ label: "Option 1", value: "1" },
|
|
327
|
+
{ label: "Option 2", value: "2" }
|
|
328
|
+
] }));
|
|
329
|
+
const t = r.getByRole("combobox");
|
|
330
|
+
u.change(t, { target: { value: "1" } }), u.blur(t), o(r.getByTestId("check-circle")).toBeInTheDocument(), u.change(t, { target: { value: "2" } }), u.blur(t), o(r.getByTestId("check-circle")).toBeInTheDocument(), u.change(t, { target: { value: "" } }), u.blur(t), o(r.getByTestId("alert-triangle")).toBeInTheDocument();
|
|
331
|
+
});
|
|
332
|
+
}), d("Conditional First Option Logic", () => {
|
|
333
|
+
a('should render "-- Select One --" for width 21', () => {
|
|
334
|
+
n(/* @__PURE__ */ l(s, { ...c, multiple: !1, width: "21" })), o(r.getByText("-- Select One --")).toBeInTheDocument();
|
|
335
|
+
}), a("should render empty option for width 19", () => {
|
|
336
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, multiple: !1, width: "19" })), t = e.querySelector('option[value=""]');
|
|
337
|
+
o(t == null ? void 0 : t.textContent).toBe("");
|
|
338
|
+
}), a("should handle width with decimal parsing", () => {
|
|
339
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, multiple: !1, width: "20.5" })), t = e.querySelector('option[value=""]');
|
|
340
|
+
o(t == null ? void 0 : t.textContent).toBe("");
|
|
341
|
+
}), a("should handle non-numeric width gracefully", () => {
|
|
342
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, multiple: !1, width: "abc" })), t = e.querySelectorAll("option");
|
|
343
|
+
o(t).toHaveLength(3);
|
|
344
|
+
});
|
|
345
|
+
}), d("CSS Class Management", () => {
|
|
346
|
+
a("should apply initial input class", () => {
|
|
347
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c })), t = e.querySelector("select");
|
|
348
|
+
o(t).toHaveClass("form-field__input");
|
|
349
|
+
}), a("should add touched class on blur", () => {
|
|
350
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c })), t = r.getByRole("combobox");
|
|
351
|
+
u.blur(t);
|
|
352
|
+
const i = e.querySelector("select");
|
|
353
|
+
o(i).toHaveClass("form-field__input"), o(i).toHaveClass("input--touched");
|
|
354
|
+
}), a("should apply label span class", () => {
|
|
355
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c })), t = e.querySelector(".form-field__label");
|
|
356
|
+
o(t).toBeInTheDocument();
|
|
357
|
+
}), a("should apply help text span class", () => {
|
|
358
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, helpText: "Help" })), t = e.querySelector(".form-field__label-help");
|
|
359
|
+
o(t).toBeInTheDocument();
|
|
360
|
+
}), a("should apply validation icon classes", () => {
|
|
361
|
+
const { container: e } = n(/* @__PURE__ */ l(s, { ...c, required: !0 })), t = r.getByRole("combobox");
|
|
362
|
+
u.blur(t);
|
|
363
|
+
const i = e.querySelector(".form-field__icon");
|
|
364
|
+
o(i).toBeInTheDocument();
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as a, Fragment as d, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { p as l } from "../../index-
|
|
2
|
+
import { p as l } from "../../index-06PEPfBQ.mjs";
|
|
3
3
|
import { classes as p } from "../../utils/helpers.js";
|
|
4
4
|
import { SectionedContent as m } from "../SectionedContent/SectionedContent.js";
|
|
5
5
|
import { GenericList as u } from "../GenericList/GenericList.js";
|