@scrippsproduct/networks-ui-library 1.1.9 → 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/{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,263 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { v as c, d as r, b as m, i as s, r as n, s as t, g as a } from "../../react.esm-DLSrfVwM.mjs";
|
|
3
|
+
import { u } from "../../index-BUN4jQ3m.mjs";
|
|
4
|
+
import { Input as i } from "./Input.js";
|
|
5
|
+
c.mock("react-feather", () => ({
|
|
6
|
+
CheckCircle: () => /* @__PURE__ */ l("span", { "data-testid": "check-circle", children: "✓" }),
|
|
7
|
+
AlertTriangle: () => /* @__PURE__ */ l("span", { "data-testid": "alert-triangle", children: "⚠" })
|
|
8
|
+
}));
|
|
9
|
+
c.mock("../../utils/helpers", () => ({
|
|
10
|
+
areaCodePhoneNumberMask: (e) => {
|
|
11
|
+
const o = e.replace(/\D/g, "");
|
|
12
|
+
return o.length === 10 ? `(${o.slice(0, 3)}) ${o.slice(3, 6)}-${o.slice(6)}` : e;
|
|
13
|
+
},
|
|
14
|
+
classes: (e) => e.filter(Boolean).join(" ")
|
|
15
|
+
}));
|
|
16
|
+
c.mock("./../CustomDataList/Form.module.scss", () => ({
|
|
17
|
+
default: {
|
|
18
|
+
"form-field": "form-field-module",
|
|
19
|
+
"form-field__input": "form-field-input-module",
|
|
20
|
+
"form-field__label": "form-field-label-module",
|
|
21
|
+
"form-field__label-help": "form-field-label-help-module",
|
|
22
|
+
"form-field__icon": "form-field-icon-module",
|
|
23
|
+
"form-field__icon--invalid": "form-field-icon-invalid-module",
|
|
24
|
+
"form-field__error-message": "form-field-error-message-module",
|
|
25
|
+
"input--touched": "input-touched-module",
|
|
26
|
+
"input-width--100": "input-width-100-module",
|
|
27
|
+
"input-width--50": "input-width-50-module",
|
|
28
|
+
"input-width--75": "input-width-75-module"
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
r("Input", () => {
|
|
32
|
+
m(() => {
|
|
33
|
+
c.clearAllMocks();
|
|
34
|
+
}), r("Basic Rendering", () => {
|
|
35
|
+
s("should render label element", () => {
|
|
36
|
+
n(/* @__PURE__ */ l(i, { name: "test" }));
|
|
37
|
+
const e = t.getByRole("textbox").closest("label");
|
|
38
|
+
a(e).toBeInTheDocument();
|
|
39
|
+
}), s("should render input with correct name", () => {
|
|
40
|
+
n(/* @__PURE__ */ l(i, { name: "test-input" }));
|
|
41
|
+
const e = t.getByRole("textbox");
|
|
42
|
+
a(e).toHaveAttribute("name", "test-input"), a(e).toHaveAttribute("id", "test-input");
|
|
43
|
+
}), s("should apply module classes", () => {
|
|
44
|
+
n(/* @__PURE__ */ l(i, { name: "test" }));
|
|
45
|
+
const e = t.getByRole("textbox").closest("label");
|
|
46
|
+
a(e).toHaveClass("form-field-module");
|
|
47
|
+
}), s("should default to text type", () => {
|
|
48
|
+
n(/* @__PURE__ */ l(i, { name: "test" }));
|
|
49
|
+
const e = t.getByRole("textbox");
|
|
50
|
+
a(e).toHaveAttribute("type", "text");
|
|
51
|
+
});
|
|
52
|
+
}), r("Label and Help Text", () => {
|
|
53
|
+
s("should render without label by default", () => {
|
|
54
|
+
n(/* @__PURE__ */ l(i, { name: "test" }));
|
|
55
|
+
const e = document.querySelector(".form-field-label-module");
|
|
56
|
+
a(e).toHaveTextContent("");
|
|
57
|
+
}), s("should render custom label", () => {
|
|
58
|
+
n(/* @__PURE__ */ l(i, { label: "Username", name: "test" })), a(t.getByText("Username")).toBeInTheDocument();
|
|
59
|
+
}), s("should render help text", () => {
|
|
60
|
+
n(/* @__PURE__ */ l(i, { helpText: "(required)", label: "Email", name: "test" })), a(t.getByText("(required)")).toBeInTheDocument();
|
|
61
|
+
}), s("should render label and help text together", () => {
|
|
62
|
+
n(/* @__PURE__ */ l(i, { helpText: "min 8 chars", label: "Password", name: "test" })), a(t.getByText("Password")).toBeInTheDocument(), a(t.getByText("min 8 chars")).toBeInTheDocument();
|
|
63
|
+
}), s("should apply help text class", () => {
|
|
64
|
+
n(/* @__PURE__ */ l(i, { helpText: "helper", name: "test" }));
|
|
65
|
+
const e = t.getByText("helper");
|
|
66
|
+
a(e).toHaveClass("form-field-label-help-module");
|
|
67
|
+
});
|
|
68
|
+
}), r("Input Types", () => {
|
|
69
|
+
s("should render email type", () => {
|
|
70
|
+
n(/* @__PURE__ */ l(i, { name: "test", type: "email" }));
|
|
71
|
+
const e = t.getByRole("textbox");
|
|
72
|
+
a(e).toHaveAttribute("type", "email");
|
|
73
|
+
}), s("should render tel type", () => {
|
|
74
|
+
n(/* @__PURE__ */ l(i, { name: "test", type: "tel" }));
|
|
75
|
+
const e = t.getByRole("textbox");
|
|
76
|
+
a(e).toHaveAttribute("type", "tel");
|
|
77
|
+
}), s("should render password type", () => {
|
|
78
|
+
n(/* @__PURE__ */ l(i, { name: "test", type: "password" }));
|
|
79
|
+
const e = document.querySelector('input[type="password"]');
|
|
80
|
+
a(e).toBeInTheDocument();
|
|
81
|
+
});
|
|
82
|
+
}), r("Width Prop", () => {
|
|
83
|
+
s("should default to width 100", () => {
|
|
84
|
+
n(/* @__PURE__ */ l(i, { name: "test" }));
|
|
85
|
+
const e = t.getByRole("textbox").closest("label");
|
|
86
|
+
a(e).toHaveClass("input-width-100-module");
|
|
87
|
+
}), s("should apply width 50", () => {
|
|
88
|
+
n(/* @__PURE__ */ l(i, { name: "test", width: 50 }));
|
|
89
|
+
const e = t.getByRole("textbox").closest("label");
|
|
90
|
+
a(e).toHaveClass("input-width-50-module");
|
|
91
|
+
}), s("should apply width 75", () => {
|
|
92
|
+
n(/* @__PURE__ */ l(i, { name: "test", width: 75 }));
|
|
93
|
+
const e = t.getByRole("textbox").closest("label");
|
|
94
|
+
a(e).toHaveClass("input-width-75-module");
|
|
95
|
+
});
|
|
96
|
+
}), r("Validation - Clean State", () => {
|
|
97
|
+
s("should not show validation icons initially", () => {
|
|
98
|
+
n(/* @__PURE__ */ l(i, { name: "test" })), a(t.queryByTestId("check-circle")).not.toBeInTheDocument(), a(t.queryByTestId("alert-triangle")).not.toBeInTheDocument();
|
|
99
|
+
}), s("should not show error message initially", () => {
|
|
100
|
+
n(/* @__PURE__ */ l(i, { required: !0, name: "test" }));
|
|
101
|
+
const e = document.querySelector(".form-field-error-message-module");
|
|
102
|
+
a(e).not.toBeInTheDocument();
|
|
103
|
+
});
|
|
104
|
+
}), r("Validation - On Blur (Required Field)", () => {
|
|
105
|
+
s("should show error on blur when required field is empty", async () => {
|
|
106
|
+
const e = u.setup();
|
|
107
|
+
n(/* @__PURE__ */ l(i, { required: !0, name: "test" }));
|
|
108
|
+
const o = t.getByRole("textbox");
|
|
109
|
+
await e.click(o), await e.tab(), a(t.getByTestId("alert-triangle")).toBeInTheDocument();
|
|
110
|
+
}), s("should add touched class on blur", async () => {
|
|
111
|
+
const e = u.setup();
|
|
112
|
+
n(/* @__PURE__ */ l(i, { name: "test" }));
|
|
113
|
+
const o = t.getByRole("textbox");
|
|
114
|
+
await e.click(o), await e.tab(), a(o).toHaveClass("input-touched-module");
|
|
115
|
+
}), s("should show check icon when valid", async () => {
|
|
116
|
+
const e = u.setup();
|
|
117
|
+
n(/* @__PURE__ */ l(i, { required: !0, name: "test" }));
|
|
118
|
+
const o = t.getByRole("textbox");
|
|
119
|
+
await e.type(o, "valid input"), await e.tab(), a(t.getByTestId("check-circle")).toBeInTheDocument();
|
|
120
|
+
}), s("should clear validation message when field becomes valid", async () => {
|
|
121
|
+
const e = u.setup();
|
|
122
|
+
n(/* @__PURE__ */ l(i, { required: !0, name: "test" }));
|
|
123
|
+
const o = t.getByRole("textbox");
|
|
124
|
+
await e.click(o), await e.tab(), await e.click(o), await e.type(o, "valid"), await e.tab();
|
|
125
|
+
const d = document.querySelector(".form-field-error-message-module");
|
|
126
|
+
a(d).not.toBeInTheDocument();
|
|
127
|
+
});
|
|
128
|
+
}), r("Email Validation", () => {
|
|
129
|
+
s("should show custom email error message", async () => {
|
|
130
|
+
const e = u.setup();
|
|
131
|
+
n(/* @__PURE__ */ l(i, { name: "test", type: "email" }));
|
|
132
|
+
const o = t.getByRole("textbox");
|
|
133
|
+
await e.type(o, "invalid-email"), await e.tab(), a(t.getByText("Please enter a vaild email.")).toBeInTheDocument();
|
|
134
|
+
}), s("should not show error for valid email", async () => {
|
|
135
|
+
const e = u.setup();
|
|
136
|
+
n(/* @__PURE__ */ l(i, { name: "test", type: "email" }));
|
|
137
|
+
const o = t.getByRole("textbox");
|
|
138
|
+
await e.type(o, "test@example.com"), await e.tab(), a(t.queryByText("Please enter a vaild email.")).not.toBeInTheDocument(), a(t.getByTestId("check-circle")).toBeInTheDocument();
|
|
139
|
+
});
|
|
140
|
+
}), r("Phone Number Validation and Masking", () => {
|
|
141
|
+
s("should apply phone mask on blur", async () => {
|
|
142
|
+
const e = u.setup();
|
|
143
|
+
n(/* @__PURE__ */ l(i, { name: "test", type: "tel" }));
|
|
144
|
+
const o = t.getByRole("textbox");
|
|
145
|
+
await e.type(o, "1234567890"), await e.tab(), a(o.value).toBe("(123) 456-7890");
|
|
146
|
+
}), s("should show custom tel error message for invalid format", async () => {
|
|
147
|
+
const e = u.setup();
|
|
148
|
+
n(/* @__PURE__ */ l(i, { name: "test", pattern: "\\\\(\\\\d{3}\\\\) \\\\d{3}-\\\\d{4}", type: "tel" }));
|
|
149
|
+
const o = t.getByRole("textbox");
|
|
150
|
+
await e.type(o, "123"), await e.tab(), a(t.getByText("Please match the requested format: (xxx) xxx-xxxx")).toBeInTheDocument();
|
|
151
|
+
}), s("should not mask incomplete phone numbers", async () => {
|
|
152
|
+
const e = u.setup();
|
|
153
|
+
n(/* @__PURE__ */ l(i, { name: "test", type: "tel" }));
|
|
154
|
+
const o = t.getByRole("textbox");
|
|
155
|
+
await e.type(o, "123456"), await e.tab(), a(o.value).toBe("123456");
|
|
156
|
+
});
|
|
157
|
+
}), r("Show Validation Prop", () => {
|
|
158
|
+
s("should hide validation icons when showValidation is false", async () => {
|
|
159
|
+
const e = u.setup();
|
|
160
|
+
n(/* @__PURE__ */ l(i, { required: !0, name: "test", showValidation: !1 }));
|
|
161
|
+
const o = t.getByRole("textbox");
|
|
162
|
+
await e.type(o, "test"), await e.tab(), a(t.queryByTestId("check-circle")).not.toBeInTheDocument();
|
|
163
|
+
}), s("should hide error messages when showValidation is false", async () => {
|
|
164
|
+
const e = u.setup();
|
|
165
|
+
n(/* @__PURE__ */ l(i, { required: !0, name: "test", showValidation: !1 }));
|
|
166
|
+
const o = t.getByRole("textbox");
|
|
167
|
+
await e.click(o), await e.tab();
|
|
168
|
+
const d = document.querySelector(".form-field-error-message-module");
|
|
169
|
+
a(d).not.toBeInTheDocument();
|
|
170
|
+
}), s("should show validation by default", async () => {
|
|
171
|
+
const e = u.setup();
|
|
172
|
+
n(/* @__PURE__ */ l(i, { required: !0, name: "test" }));
|
|
173
|
+
const o = t.getByRole("textbox");
|
|
174
|
+
await e.type(o, "test"), await e.tab(), a(t.getByTestId("check-circle")).toBeInTheDocument();
|
|
175
|
+
});
|
|
176
|
+
}), r("Custom HTML Attributes", () => {
|
|
177
|
+
s("should pass through placeholder attribute", () => {
|
|
178
|
+
n(/* @__PURE__ */ l(i, { name: "test", placeholder: "Enter text" }));
|
|
179
|
+
const e = t.getByPlaceholderText("Enter text");
|
|
180
|
+
a(e).toBeInTheDocument();
|
|
181
|
+
}), s("should pass through required attribute", () => {
|
|
182
|
+
n(/* @__PURE__ */ l(i, { required: !0, name: "test" }));
|
|
183
|
+
const e = t.getByRole("textbox");
|
|
184
|
+
a(e).toBeRequired();
|
|
185
|
+
}), s("should pass through disabled attribute", () => {
|
|
186
|
+
n(/* @__PURE__ */ l(i, { disabled: !0, name: "test" }));
|
|
187
|
+
const e = t.getByRole("textbox");
|
|
188
|
+
a(e).toBeDisabled();
|
|
189
|
+
}), s("should pass through maxLength attribute", () => {
|
|
190
|
+
n(/* @__PURE__ */ l(i, { maxLength: 10, name: "test" }));
|
|
191
|
+
const e = t.getByRole("textbox");
|
|
192
|
+
a(e).toHaveAttribute("maxLength", "10");
|
|
193
|
+
}), s("should pass through pattern attribute", () => {
|
|
194
|
+
n(/* @__PURE__ */ l(i, { name: "test", pattern: "[A-Za-z]+" }));
|
|
195
|
+
const e = t.getByRole("textbox");
|
|
196
|
+
a(e).toHaveAttribute("pattern", "[A-Za-z]+");
|
|
197
|
+
}), s("should pass through value attribute", () => {
|
|
198
|
+
n(/* @__PURE__ */ l(i, { name: "test", value: "initial", onChange: () => {
|
|
199
|
+
} }));
|
|
200
|
+
const e = t.getByRole("textbox");
|
|
201
|
+
a(e.value).toBe("initial");
|
|
202
|
+
});
|
|
203
|
+
}), r("Integration", () => {
|
|
204
|
+
s("should render complete form field with all features", async () => {
|
|
205
|
+
const e = u.setup();
|
|
206
|
+
n(
|
|
207
|
+
/* @__PURE__ */ l(
|
|
208
|
+
i,
|
|
209
|
+
{
|
|
210
|
+
required: !0,
|
|
211
|
+
helpText: "(required)",
|
|
212
|
+
label: "Email Address",
|
|
213
|
+
name: "email",
|
|
214
|
+
placeholder: "you@example.com",
|
|
215
|
+
type: "email",
|
|
216
|
+
width: 75
|
|
217
|
+
}
|
|
218
|
+
)
|
|
219
|
+
), a(t.getByText("Email Address")).toBeInTheDocument(), a(t.getByText("(required)")).toBeInTheDocument();
|
|
220
|
+
const o = t.getByPlaceholderText("you@example.com");
|
|
221
|
+
a(o).toHaveAttribute("type", "email"), a(o).toBeRequired();
|
|
222
|
+
const d = o.closest("label");
|
|
223
|
+
a(d).toHaveClass("input-width-75-module"), await e.type(o, "test@example.com"), await e.tab(), a(t.getByTestId("check-circle")).toBeInTheDocument();
|
|
224
|
+
}), s("should handle complete phone number workflow", async () => {
|
|
225
|
+
const e = u.setup();
|
|
226
|
+
n(
|
|
227
|
+
/* @__PURE__ */ l(
|
|
228
|
+
i,
|
|
229
|
+
{
|
|
230
|
+
label: "Phone",
|
|
231
|
+
name: "phone",
|
|
232
|
+
type: "tel"
|
|
233
|
+
}
|
|
234
|
+
)
|
|
235
|
+
);
|
|
236
|
+
const o = t.getByRole("textbox");
|
|
237
|
+
await e.type(o, "5551234567"), await e.tab(), a(o.value).toBe("(555) 123-4567");
|
|
238
|
+
});
|
|
239
|
+
}), r("Edge Cases", () => {
|
|
240
|
+
s("should handle empty name gracefully", () => {
|
|
241
|
+
n(/* @__PURE__ */ l(i, { name: "" }));
|
|
242
|
+
const e = t.getByRole("textbox");
|
|
243
|
+
a(e).toHaveAttribute("name", "");
|
|
244
|
+
}), s("should handle blur without input ref", async () => {
|
|
245
|
+
const e = u.setup();
|
|
246
|
+
n(/* @__PURE__ */ l(i, { name: "test" }));
|
|
247
|
+
const o = t.getByRole("textbox");
|
|
248
|
+
await e.click(o), await e.tab(), a(o).toBeInTheDocument();
|
|
249
|
+
}), s("should handle multiple blur events", async () => {
|
|
250
|
+
const e = u.setup();
|
|
251
|
+
n(/* @__PURE__ */ l(i, { required: !0, name: "test" }));
|
|
252
|
+
const o = t.getByRole("textbox");
|
|
253
|
+
await e.click(o), await e.tab(), await e.click(o), await e.tab(), a(t.getByTestId("alert-triangle")).toBeInTheDocument();
|
|
254
|
+
}), s("should handle rapid focus/blur cycles", async () => {
|
|
255
|
+
const e = u.setup();
|
|
256
|
+
n(/* @__PURE__ */ l(i, { name: "test" }));
|
|
257
|
+
const o = t.getByRole("textbox");
|
|
258
|
+
for (let d = 0; d < 5; d++)
|
|
259
|
+
await e.click(o), await e.tab();
|
|
260
|
+
a(o).toHaveClass("input-touched-module");
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
});
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { p as r } from "../../index-
|
|
1
|
+
import { jsxs as o, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { p as r } from "../../index-06PEPfBQ.mjs";
|
|
3
3
|
import { classes as s } from "../../utils/helpers.js";
|
|
4
|
-
import '../../assets/InstructionsList.css';const
|
|
4
|
+
import '../../assets/InstructionsList.css';const i = {
|
|
5
5
|
"instructions-list__list": "_instructions-list__list_suf45_1",
|
|
6
6
|
"instructions-list__item": "_instructions-list__item_suf45_5"
|
|
7
7
|
};
|
|
8
|
-
function
|
|
8
|
+
function m({
|
|
9
9
|
headerHtml: n = "",
|
|
10
10
|
instructions: l = []
|
|
11
11
|
}) {
|
|
12
|
-
return /* @__PURE__ */
|
|
13
|
-
n !== "" && /* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */
|
|
12
|
+
return /* @__PURE__ */ o("div", { className: s([i["instructions-list"], "instructions-list"]), children: [
|
|
13
|
+
n !== "" && /* @__PURE__ */ t("h3", { className: s([i["instructions-list__header"], "instructions-list__header"]), children: r(n) }),
|
|
14
|
+
/* @__PURE__ */ t("ol", { className: s([i["instructions-list__list"], "instructions-list__list"]), children: l.map((_, c) => /* @__PURE__ */ t(
|
|
15
15
|
"li",
|
|
16
16
|
{
|
|
17
|
-
className: s([
|
|
17
|
+
className: s([i["instructions-list__item"], "instructions-list__item"]),
|
|
18
18
|
children: r(_)
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
`ili-${c + 1}`
|
|
21
21
|
)) })
|
|
22
22
|
] });
|
|
23
23
|
}
|
|
24
24
|
export {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
m as InstructionsList,
|
|
26
|
+
m as default
|
|
27
27
|
};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { v as d, d as a, i, r as l, g as t, s as n } from "../../react.esm-DLSrfVwM.mjs";
|
|
3
|
+
import { InstructionsList as r } from "./InstructionsList.js";
|
|
4
|
+
d.mock("html-react-parser", () => ({
|
|
5
|
+
default: (e) => e
|
|
6
|
+
}));
|
|
7
|
+
d.mock("../../utils/helpers", () => ({
|
|
8
|
+
classes: (e) => e.filter(Boolean).join(" ")
|
|
9
|
+
}));
|
|
10
|
+
d.mock("./InstructionsList.module.scss", () => ({
|
|
11
|
+
default: {
|
|
12
|
+
"instructions-list": "instructions-list-module",
|
|
13
|
+
"instructions-list__header": "instructions-list__header-module",
|
|
14
|
+
"instructions-list__list": "instructions-list__list-module",
|
|
15
|
+
"instructions-list__item": "instructions-list__item-module"
|
|
16
|
+
}
|
|
17
|
+
}));
|
|
18
|
+
a("InstructionsList", () => {
|
|
19
|
+
a("Basic Rendering", () => {
|
|
20
|
+
i("should render container div with correct classes", () => {
|
|
21
|
+
const { container: e } = l(/* @__PURE__ */ o(r, {})), s = e.firstChild;
|
|
22
|
+
t(s).toBeInTheDocument(), t(s.tagName).toBe("DIV"), t(s).toHaveClass("instructions-list-module"), t(s).toHaveClass("instructions-list");
|
|
23
|
+
}), i("should render ordered list element", () => {
|
|
24
|
+
l(/* @__PURE__ */ o(r, {}));
|
|
25
|
+
const e = n.getByRole("list");
|
|
26
|
+
t(e).toBeInTheDocument(), t(e.tagName).toBe("OL");
|
|
27
|
+
}), i("should apply list classes", () => {
|
|
28
|
+
l(/* @__PURE__ */ o(r, {}));
|
|
29
|
+
const e = n.getByRole("list");
|
|
30
|
+
t(e).toHaveClass("instructions-list__list-module"), t(e).toHaveClass("instructions-list__list");
|
|
31
|
+
}), i("should render with default empty props", () => {
|
|
32
|
+
const { container: e } = l(/* @__PURE__ */ o(r, {}));
|
|
33
|
+
t(e.firstChild).toBeInTheDocument(), t(n.queryByRole("heading")).not.toBeInTheDocument(), t(n.queryAllByRole("listitem")).toHaveLength(0);
|
|
34
|
+
});
|
|
35
|
+
}), a("Header Rendering", () => {
|
|
36
|
+
i("should not render header when headerHtml is empty string", () => {
|
|
37
|
+
l(/* @__PURE__ */ o(r, { headerHtml: "" })), t(n.queryByRole("heading")).not.toBeInTheDocument();
|
|
38
|
+
}), i("should not render header when headerHtml is not provided", () => {
|
|
39
|
+
l(/* @__PURE__ */ o(r, {})), t(n.queryByRole("heading")).not.toBeInTheDocument();
|
|
40
|
+
}), i("should render header when headerHtml is provided", () => {
|
|
41
|
+
l(/* @__PURE__ */ o(r, { headerHtml: "Test Header" }));
|
|
42
|
+
const e = n.getByRole("heading", { level: 3 });
|
|
43
|
+
t(e).toBeInTheDocument(), t(e).toHaveTextContent("Test Header");
|
|
44
|
+
}), i("should apply header classes", () => {
|
|
45
|
+
l(/* @__PURE__ */ o(r, { headerHtml: "Header" }));
|
|
46
|
+
const e = n.getByRole("heading");
|
|
47
|
+
t(e).toHaveClass("instructions-list__header-module"), t(e).toHaveClass("instructions-list__header");
|
|
48
|
+
}), i("should parse HTML in header", () => {
|
|
49
|
+
l(/* @__PURE__ */ o(r, { headerHtml: "<strong>Bold</strong> Header" }));
|
|
50
|
+
const e = n.getByRole("heading");
|
|
51
|
+
t(e).toHaveTextContent("<strong>Bold</strong> Header");
|
|
52
|
+
}), i("should render header with special characters", () => {
|
|
53
|
+
l(/* @__PURE__ */ o(r, { headerHtml: "Header & Title" }));
|
|
54
|
+
const e = n.getByRole("heading");
|
|
55
|
+
t(e).toHaveTextContent("Header & Title");
|
|
56
|
+
});
|
|
57
|
+
}), a("Instructions List Rendering", () => {
|
|
58
|
+
i("should render empty list when instructions array is empty", () => {
|
|
59
|
+
l(/* @__PURE__ */ o(r, { instructions: [] }));
|
|
60
|
+
const e = n.getByRole("list");
|
|
61
|
+
t(e).toBeInTheDocument(), t(n.queryAllByRole("listitem")).toHaveLength(0);
|
|
62
|
+
}), i("should render single instruction", () => {
|
|
63
|
+
l(/* @__PURE__ */ o(r, { instructions: ["First instruction"] }));
|
|
64
|
+
const e = n.getAllByRole("listitem");
|
|
65
|
+
t(e).toHaveLength(1), t(e[0]).toHaveTextContent("First instruction");
|
|
66
|
+
}), i("should render multiple instructions", () => {
|
|
67
|
+
l(/* @__PURE__ */ o(r, { instructions: [
|
|
68
|
+
"First instruction",
|
|
69
|
+
"Second instruction",
|
|
70
|
+
"Third instruction"
|
|
71
|
+
] }));
|
|
72
|
+
const s = n.getAllByRole("listitem");
|
|
73
|
+
t(s).toHaveLength(3), t(s[0]).toHaveTextContent("First instruction"), t(s[1]).toHaveTextContent("Second instruction"), t(s[2]).toHaveTextContent("Third instruction");
|
|
74
|
+
}), i("should apply item classes to each list item", () => {
|
|
75
|
+
l(/* @__PURE__ */ o(r, { instructions: ["Test"] }));
|
|
76
|
+
const e = n.getByRole("listitem");
|
|
77
|
+
t(e).toHaveClass("instructions-list__item-module"), t(e).toHaveClass("instructions-list__item");
|
|
78
|
+
}), i("should render instructions in order", () => {
|
|
79
|
+
const e = ["Step 1", "Step 2", "Step 3", "Step 4", "Step 5"];
|
|
80
|
+
l(/* @__PURE__ */ o(r, { instructions: e }));
|
|
81
|
+
const s = n.getAllByRole("listitem");
|
|
82
|
+
e.forEach((c, u) => {
|
|
83
|
+
t(s[u]).toHaveTextContent(c);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
}), a("HTML Parsing in Instructions", () => {
|
|
87
|
+
i("should parse HTML in single instruction", () => {
|
|
88
|
+
l(/* @__PURE__ */ o(r, { instructions: ["<em>Italicized</em> text"] }));
|
|
89
|
+
const e = n.getByRole("listitem");
|
|
90
|
+
t(e).toHaveTextContent("<em>Italicized</em> text");
|
|
91
|
+
}), i("should parse HTML in multiple instructions", () => {
|
|
92
|
+
l(/* @__PURE__ */ o(r, { instructions: [
|
|
93
|
+
"<strong>Bold</strong> instruction",
|
|
94
|
+
"Normal <em>italic</em> text",
|
|
95
|
+
"<u>Underlined</u> content"
|
|
96
|
+
] }));
|
|
97
|
+
const s = n.getAllByRole("listitem");
|
|
98
|
+
t(s[0]).toHaveTextContent("<strong>Bold</strong> instruction"), t(s[1]).toHaveTextContent("Normal <em>italic</em> text"), t(s[2]).toHaveTextContent("<u>Underlined</u> content");
|
|
99
|
+
}), i("should handle complex HTML structures", () => {
|
|
100
|
+
l(/* @__PURE__ */ o(r, { instructions: [
|
|
101
|
+
'<a href="/link">Click here</a> for more info',
|
|
102
|
+
'<span class="highlight">Important</span> note'
|
|
103
|
+
] }));
|
|
104
|
+
const s = n.getAllByRole("listitem");
|
|
105
|
+
t(s[0]).toHaveTextContent('<a href="/link">Click here</a> for more info'), t(s[1]).toHaveTextContent('<span class="highlight">Important</span> note');
|
|
106
|
+
});
|
|
107
|
+
}), a("Complete Component", () => {
|
|
108
|
+
i("should render header and instructions together", () => {
|
|
109
|
+
l(
|
|
110
|
+
/* @__PURE__ */ o(
|
|
111
|
+
r,
|
|
112
|
+
{
|
|
113
|
+
headerHtml: "Instructions Header",
|
|
114
|
+
instructions: ["Step 1", "Step 2", "Step 3"]
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
);
|
|
118
|
+
const s = n.getByRole("heading"), c = n.getAllByRole("listitem");
|
|
119
|
+
t(s).toHaveTextContent("Instructions Header"), t(c).toHaveLength(3);
|
|
120
|
+
}), i("should render full example with HTML parsing", () => {
|
|
121
|
+
l(
|
|
122
|
+
/* @__PURE__ */ o(
|
|
123
|
+
r,
|
|
124
|
+
{
|
|
125
|
+
headerHtml: "<strong>Setup Instructions</strong>",
|
|
126
|
+
instructions: [
|
|
127
|
+
"Turn on your <strong>TV</strong>",
|
|
128
|
+
"Navigate to <em>Settings</em>",
|
|
129
|
+
"Select <u>Channel Scan</u>"
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
), t(n.getByRole("heading")).toHaveTextContent("<strong>Setup Instructions</strong>"), t(n.getAllByRole("listitem")).toHaveLength(3);
|
|
134
|
+
});
|
|
135
|
+
}), a("Edge Cases", () => {
|
|
136
|
+
i("should handle empty string in instructions array", () => {
|
|
137
|
+
l(/* @__PURE__ */ o(r, { instructions: [""] }));
|
|
138
|
+
const e = n.getAllByRole("listitem");
|
|
139
|
+
t(e).toHaveLength(1), t(e[0]).toHaveTextContent("");
|
|
140
|
+
}), i("should handle whitespace-only strings", () => {
|
|
141
|
+
l(/* @__PURE__ */ o(r, { instructions: [" "] }));
|
|
142
|
+
const e = n.getAllByRole("listitem");
|
|
143
|
+
t(e).toHaveLength(1);
|
|
144
|
+
}), i("should handle very long instruction text", () => {
|
|
145
|
+
const e = "A".repeat(500);
|
|
146
|
+
l(/* @__PURE__ */ o(r, { instructions: [e] }));
|
|
147
|
+
const s = n.getByRole("listitem");
|
|
148
|
+
t(s).toHaveTextContent(e);
|
|
149
|
+
}), i("should handle special characters in instructions", () => {
|
|
150
|
+
l(/* @__PURE__ */ o(r, { instructions: [
|
|
151
|
+
"Step with & ampersand",
|
|
152
|
+
"Step with < less than",
|
|
153
|
+
"Step with > greater than",
|
|
154
|
+
'Step with "quotes"'
|
|
155
|
+
] }));
|
|
156
|
+
const s = n.getAllByRole("listitem");
|
|
157
|
+
t(s).toHaveLength(4), t(s[0]).toHaveTextContent("Step with & ampersand");
|
|
158
|
+
}), i("should handle mixed empty and populated instructions", () => {
|
|
159
|
+
l(/* @__PURE__ */ o(r, { instructions: ["", "Valid step", "", "Another step", ""] }));
|
|
160
|
+
const s = n.getAllByRole("listitem");
|
|
161
|
+
t(s).toHaveLength(5), t(s[1]).toHaveTextContent("Valid step"), t(s[3]).toHaveTextContent("Another step");
|
|
162
|
+
}), i("should handle large number of instructions", () => {
|
|
163
|
+
const e = Array.from({ length: 50 }, (c, u) => `Step ${u + 1}`);
|
|
164
|
+
l(/* @__PURE__ */ o(r, { instructions: e }));
|
|
165
|
+
const s = n.getAllByRole("listitem");
|
|
166
|
+
t(s).toHaveLength(50), t(s[0]).toHaveTextContent("Step 1"), t(s[49]).toHaveTextContent("Step 50");
|
|
167
|
+
});
|
|
168
|
+
}), a("Props Defaults", () => {
|
|
169
|
+
i("should use empty string as default for headerHtml", () => {
|
|
170
|
+
l(/* @__PURE__ */ o(r, {})), t(n.queryByRole("heading")).not.toBeInTheDocument();
|
|
171
|
+
}), i("should use empty array as default for instructions", () => {
|
|
172
|
+
l(/* @__PURE__ */ o(r, {}));
|
|
173
|
+
const e = n.queryAllByRole("listitem");
|
|
174
|
+
t(e).toHaveLength(0);
|
|
175
|
+
}), i("should handle partial props", () => {
|
|
176
|
+
l(/* @__PURE__ */ o(r, { headerHtml: "Only Header" })), t(n.getByRole("heading")).toHaveTextContent("Only Header"), t(n.queryAllByRole("listitem")).toHaveLength(0);
|
|
177
|
+
}), i("should handle only instructions prop", () => {
|
|
178
|
+
l(/* @__PURE__ */ o(r, { instructions: ["Only instructions"] })), t(n.queryByRole("heading")).not.toBeInTheDocument(), t(n.getAllByRole("listitem")).toHaveLength(1);
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
});
|