@scrippsproduct/networks-ui-library 1.1.9 → 1.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Form.module-Cd8qH2rj.mjs → Form.module-CarfWK5T.mjs} +1 -1
- package/dist/ResultsTable.module-wcNUQEKe.mjs +14 -0
- package/dist/_commonjsHelpers-DaMA6jEr.mjs +8 -0
- package/dist/assets/ResultsTable.css +1 -1
- package/dist/{chevron-left-DRvpaLmK.mjs → chevron-left-D0UjbrKw.mjs} +1 -1
- package/dist/{chevron-right-C8yCnmfx.mjs → chevron-right-0ZF3LruR.mjs} +1 -1
- package/dist/components/ActionButton/ActionButton.test.js +209 -0
- package/dist/components/AdBlock/AdBlock.test.js +286 -0
- package/dist/components/AdjustableTwoColumnGrid/AdjustableTwoColumnGrid.test.js +295 -0
- package/dist/components/AirDateFormatter/AirDateFormatter.test.js +192 -0
- package/dist/components/AnchorTag/AnchorTag.test.js +463 -0
- package/dist/components/BCVideoPlayer/BCVideoPlayer.test.js +295 -0
- package/dist/components/BasicGridModule/BasicGridModule.js +41 -37
- package/dist/components/BasicGridModule/BasicGridModule.test.js +227 -0
- package/dist/components/Button/Button.test.js +434 -0
- package/dist/components/Carousel/Carousel.js +2 -2
- package/dist/components/Carousel/Carousel.test.js +705 -0
- package/dist/components/CarouselSlide/CarouselSlide.test.js +378 -0
- package/dist/components/CarouselSlide/slide-layouts/TwoColumn/TwoColumnSlide.js +1 -1
- package/dist/components/CastInfoLayout/CastInfoLayout.test.js +294 -0
- package/dist/components/ChannelSearch/ChannelSearch.test.js +565 -0
- package/dist/components/ChoicesItem/ChoicesItem.test.js +428 -0
- package/dist/components/Concat/Concat.js +1 -1
- package/dist/components/Concat/Concat.test.js +115 -0
- package/dist/components/CtaBlock/CtaBlock.js +1 -1
- package/dist/components/CtaBlock/CtaBlock.test.js +226 -0
- package/dist/components/CustomDataList/CustomDataList.js +4 -4
- package/dist/components/CustomSelect/CustomSelect.js +86 -86
- package/dist/components/CustomSelect/CustomSelect.test.js +313 -0
- package/dist/components/DateNavigation/DateNavigation.js +10 -10
- package/dist/components/DateNavigation/DateNavigation.test.js +370 -0
- package/dist/components/DatePicker/DatePicker.js +1 -1
- package/dist/components/DeviceAndPlatformLists/DeviceAndPlatformLists.test.js +288 -0
- package/dist/components/DrawerNavigation/DrawerNavigation.test.js +316 -0
- package/dist/components/EqualSizeFlexRow/EqualSizeFlexRow.test.js +337 -0
- package/dist/components/EqualSizeGrid/EqualSizeGrid.test.js +358 -0
- package/dist/components/ErrorHandler/ErrorHandler.js +2 -2
- package/dist/components/ErrorHandler/ErrorHandler.test.js +158 -0
- package/dist/components/FeaturedList/FeaturedList.test.js +353 -0
- package/dist/components/Figure/Figure.js +1 -1
- package/dist/components/Figure/Figure.test.js +198 -0
- package/dist/components/FindUs/FindUs.test.js +499 -0
- package/dist/components/FooterNavigation/FooterNavigation.test.js +310 -0
- package/dist/components/GenericList/GenericList.js +1 -1
- package/dist/components/GenericList/GenericList.test.js +288 -0
- package/dist/components/GetAirdateWrapper/GetAirdateWrapper.test.js +689 -0
- package/dist/components/GradientButton/GradientButton.d.ts +1 -1
- package/dist/components/GradientButton/GradientButton.js +33 -31
- package/dist/components/GradientButton/GradientButton.test.js +457 -0
- package/dist/components/GridList/GridList.test.js +371 -0
- package/dist/components/ImageCard/ImageCard.test.js +668 -0
- package/dist/components/ImageCard/ImageCardCore.js +28 -28
- package/dist/components/ImageCard/ImageCardCore.test.js +577 -0
- package/dist/components/ImageReplacementAnchor/ImageReplacementAnchor.test.js +379 -0
- package/dist/components/InfoPanel/InfoPanel.js +1 -1
- package/dist/components/InlineNavigation/InlineNavigation.test.js +149 -0
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/Input/Input.test.js +263 -0
- package/dist/components/InstructionsList/InstructionsList.js +11 -11
- package/dist/components/InstructionsList/InstructionsList.test.js +181 -0
- package/dist/components/LogoListItem/LogoListItem.test.js +303 -0
- package/dist/components/LogoNavigation/LogoNavigation.test.js +352 -0
- package/dist/components/ModalContainer/ModalContainer.js +2 -2
- package/dist/components/NavList/NavList.test.js +332 -0
- package/dist/components/Overlay/Overlay.js +24 -23
- package/dist/components/Overlay/Overlay.test.js +198 -0
- package/dist/components/PageHero/PageHero.test.js +241 -0
- package/dist/components/PageHero/page-hero-layouts/IONShow/IONShowHero.js +1 -1
- package/dist/components/ProgramAirdate/ProgramAirdate.js +1 -1
- package/dist/components/ProgramAirdate/ProgramAirdate.test.js +414 -0
- package/dist/components/PromotionBlock/PromotionBlock.test.js +208 -0
- package/dist/components/PromotionsRowBlock/PromotionsRowBlock.test.js +221 -0
- package/dist/components/PromotionsRowModule/PromotionsRowModule.test.js +349 -0
- package/dist/components/RescanInstructions/RescanInstructions.test.js +218 -0
- package/dist/components/ResponsiveImage/ResponsiveImage.test.js +264 -0
- package/dist/components/ResultsTable/ResultsTable.js +9 -2
- package/dist/components/ResultsTable/ResultsTable.test.js +402 -0
- package/dist/components/ResultsTableBody/ResultsTableBody.js +1 -1
- package/dist/components/ResultsTableBody/ResultsTableBody.test.js +445 -0
- package/dist/components/ResultsTableHeader/ResultsTableHeader.js +37 -15
- package/dist/components/ResultsTableHeader/ResultsTableHeader.test.js +275 -0
- package/dist/components/ScheduleLayout/ScheduleContext.js +654 -626
- package/dist/components/ScheduleLayout/ScheduleLayout.js +1 -1
- package/dist/components/ScheduleLayout/useScheduleContext.js +5 -10
- package/dist/components/ScheduleList/ScheduleList.js +1 -1
- package/dist/components/SectionedContent/SectionedContent.js +1 -1
- package/dist/components/SectionedContent/SectionedContent.test.js +341 -0
- package/dist/components/Select/Select.js +24 -24
- package/dist/components/Select/Select.test.js +367 -0
- package/dist/components/ShowAboutContent/ShowAboutContent.js +1 -1
- package/dist/components/ShowAboutContent/ShowAboutContent.test.js +535 -0
- package/dist/components/ShowAboutLayout/ShowAboutLayout.test.js +570 -0
- package/dist/components/SocialLinks/SocialLinks.js +1 -1
- package/dist/components/StringList/StringList.js +1 -1
- package/dist/components/StringList/StringList.test.js +311 -0
- package/dist/components/TabContent/TabContent.js +1 -1
- package/dist/components/TabContent/TabContent.test.js +274 -0
- package/dist/components/TabNavigation/TabNavigation.js +21 -21
- package/dist/components/TabNavigation/TabNavigation.test.js +535 -0
- package/dist/components/TabbedContent/TabbedContent.test.js +654 -0
- package/dist/components/TextArea/TextArea.js +1 -1
- package/dist/components/UpcomingList/UpcomingList.test.js +471 -0
- package/dist/{index-VjANCDXC.mjs → index-06PEPfBQ.mjs} +1 -1
- package/dist/index-BUN4jQ3m.mjs +3098 -0
- package/dist/index-BVxBrkZB.mjs +3 -0
- package/dist/{index-DC2JJV3a.mjs → index-D3kkcgee.mjs} +1 -1
- package/dist/{index-C-kn9Zhn.mjs → index-DzfYkULW.mjs} +2 -1
- package/dist/magic-string.es-uPKorP4O.mjs +663 -0
- package/dist/matchers-35e4d3bd-BBPNTlen.mjs +2404 -0
- package/dist/react.esm-DLSrfVwM.mjs +23410 -0
- package/dist/test/setupTests.d.ts +1 -0
- package/dist/test/setupTests.js +55 -0
- package/dist/{triangle-PcCcGXjr.mjs → triangle-C4z906Wf.mjs} +1 -1
- package/dist/useScheduleContext-D7FdzNxe.mjs +17 -0
- package/dist/utils/analytics.js +1 -1
- package/dist/utils/getOnNowProgram.js +10 -10
- package/dist/{x-C-QzJ-qD.mjs → x-Ck9Vk5Fo.mjs} +1 -1
- package/package.json +4 -1
- package/dist/ResultsTable.module-1zxhXaem.mjs +0 -14
- package/dist/_commonjsHelpers-C6fGbg64.mjs +0 -6
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { v as w, d as r, i as n, r as c, s as m, g as o, w as h, f as d } from "../../react.esm-DLSrfVwM.mjs";
|
|
3
|
+
import { u as y } from "../../index-BUN4jQ3m.mjs";
|
|
4
|
+
import "../../index-BVxBrkZB.mjs";
|
|
5
|
+
import { CustomSelect as l } from "./CustomSelect.js";
|
|
6
|
+
Element.prototype.scrollTo = w.fn();
|
|
7
|
+
r("CustomSelect", () => {
|
|
8
|
+
const i = [
|
|
9
|
+
{ id: 1, parent_id: null, label: "Option 1", value: "opt1", subcategories: [], status: "normal" },
|
|
10
|
+
{ id: 2, parent_id: null, label: "Option 2", value: "opt2", subcategories: [], status: "normal" },
|
|
11
|
+
{ id: 3, parent_id: null, label: "Option 3", value: "opt3", subcategories: [], status: "normal" }
|
|
12
|
+
];
|
|
13
|
+
r("Basic Rendering", () => {
|
|
14
|
+
n("should render with required props", () => {
|
|
15
|
+
c(/* @__PURE__ */ s(l, { name: "test-select", options: i }));
|
|
16
|
+
const t = m.getByRole("combobox");
|
|
17
|
+
o(t).toBeInTheDocument();
|
|
18
|
+
}), n("should render label when provided", () => {
|
|
19
|
+
c(/* @__PURE__ */ s(l, { label: "Select an option", name: "test-select", options: i })), o(m.getByText("Select an option")).toBeInTheDocument();
|
|
20
|
+
}), n("should not render label when empty string", () => {
|
|
21
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { label: "", name: "test-select", options: i })), e = t.querySelector(".form-field__label");
|
|
22
|
+
o(e).not.toBeInTheDocument();
|
|
23
|
+
}), n("should render placeholder in single select mode", () => {
|
|
24
|
+
c(/* @__PURE__ */ s(l, { name: "test-select", options: i, placeholder: "Choose one" })), o(m.getByText("Choose one")).toBeInTheDocument();
|
|
25
|
+
}), n("should render placeholder in multiple select mode", () => {
|
|
26
|
+
c(/* @__PURE__ */ s(
|
|
27
|
+
l,
|
|
28
|
+
{
|
|
29
|
+
multiple: !0,
|
|
30
|
+
name: "test-select",
|
|
31
|
+
options: i,
|
|
32
|
+
placeholder: "Choose multiple"
|
|
33
|
+
}
|
|
34
|
+
)), o(m.getByText("Choose multiple")).toBeInTheDocument();
|
|
35
|
+
}), n("should render native select element", () => {
|
|
36
|
+
c(/* @__PURE__ */ s(l, { name: "test-select", options: i }));
|
|
37
|
+
const t = m.getByRole("combobox");
|
|
38
|
+
o(t).toHaveAttribute("name", "test-select");
|
|
39
|
+
}), n("should render all options in native select", () => {
|
|
40
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelectorAll("select option");
|
|
41
|
+
o(e).toHaveLength(i.length + 1);
|
|
42
|
+
});
|
|
43
|
+
}), r("Options Rendering", () => {
|
|
44
|
+
n("should render options with correct values", () => {
|
|
45
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector('option[value="opt1"]');
|
|
46
|
+
o(e).toBeInTheDocument(), o(e == null ? void 0 : e.textContent).toBe("Option 1");
|
|
47
|
+
}), n("should handle empty options array", () => {
|
|
48
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: [] })), e = t.querySelectorAll("select option");
|
|
49
|
+
o(e).toHaveLength(1);
|
|
50
|
+
}), n("should generate IDs for options without IDs", () => {
|
|
51
|
+
c(/* @__PURE__ */ s(l, { name: "test-select", options: [
|
|
52
|
+
{ id: "noid1", parent_id: null, label: "No ID 1", value: "noid1", subcategories: [], status: "normal" },
|
|
53
|
+
{ id: "noid2", parent_id: null, label: "No ID 2", value: "noid2", subcategories: [], status: "normal" }
|
|
54
|
+
] }));
|
|
55
|
+
const e = m.getByRole("combobox");
|
|
56
|
+
o(e).toBeInTheDocument();
|
|
57
|
+
}), n("should use provided IDs for options", () => {
|
|
58
|
+
c(/* @__PURE__ */ s(l, { name: "test-select", options: [
|
|
59
|
+
{ id: "custom-1", parent_id: null, label: "Custom 1", value: "c1", subcategories: [], status: "normal" },
|
|
60
|
+
{ id: "custom-2", parent_id: null, label: "Custom 2", value: "c2", subcategories: [], status: "normal" }
|
|
61
|
+
] }));
|
|
62
|
+
const e = m.getByRole("combobox");
|
|
63
|
+
o(e).toBeInTheDocument();
|
|
64
|
+
});
|
|
65
|
+
}), r("Single Selection Mode", () => {
|
|
66
|
+
n("should default to single selection mode", () => {
|
|
67
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector("select");
|
|
68
|
+
o(e).not.toHaveAttribute("multiple");
|
|
69
|
+
}), n("should show selected option", () => {
|
|
70
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector(".custom-select");
|
|
71
|
+
o(e).toBeInTheDocument(), o(t.textContent).toContain("Option 1");
|
|
72
|
+
}), n("should not show selections list in single mode", () => {
|
|
73
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector(".custom-select__selections");
|
|
74
|
+
o(e).not.toBeInTheDocument();
|
|
75
|
+
}), n("should show custom-select__selection div in single mode", () => {
|
|
76
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector(".custom-select__selection");
|
|
77
|
+
o(e).toBeInTheDocument();
|
|
78
|
+
});
|
|
79
|
+
}), r("Multiple Selection Mode", () => {
|
|
80
|
+
n("should set multiple attribute on native select", () => {
|
|
81
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { multiple: !0, name: "test-select", options: i })), e = t.querySelector("select");
|
|
82
|
+
o(e).toHaveAttribute("multiple");
|
|
83
|
+
}), n("should render selections list in multiple mode", () => {
|
|
84
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { multiple: !0, name: "test-select", options: i })), e = t.querySelector(".custom-select__selections");
|
|
85
|
+
o(e).toBeInTheDocument();
|
|
86
|
+
}), n("should allow multiple selections", () => {
|
|
87
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { multiple: !0, name: "test-select", options: i })), e = t.querySelector(".custom-select__selections");
|
|
88
|
+
o(e).toBeInTheDocument();
|
|
89
|
+
const a = t.querySelector("select");
|
|
90
|
+
o(a).toHaveAttribute("multiple");
|
|
91
|
+
}), n("should show remove button for selected items", () => {
|
|
92
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { multiple: !0, name: "test-select", options: i })), e = t.querySelector(".custom-select__selections");
|
|
93
|
+
o(e).toBeInTheDocument();
|
|
94
|
+
}), n("should remove selection when remove button clicked", async () => {
|
|
95
|
+
const t = y.setup(), { container: e } = c(/* @__PURE__ */ s(l, { multiple: !0, name: "test-select", options: i })), a = e.querySelector(".custom-select__selections");
|
|
96
|
+
a && await t.click(a);
|
|
97
|
+
const u = e.querySelectorAll(".choices-item");
|
|
98
|
+
u[0] && await t.click(u[0]), await h(async () => {
|
|
99
|
+
const p = e.querySelector(".custom-select__remove");
|
|
100
|
+
if (p) {
|
|
101
|
+
await t.click(p);
|
|
102
|
+
const b = e.querySelectorAll(".custom-select__selected");
|
|
103
|
+
o(b.length).toBe(0);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}), r("Choices List Visibility", () => {
|
|
108
|
+
n("should start with choices hidden", () => {
|
|
109
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector(".custom-select__choices-wrapper");
|
|
110
|
+
o(e).toHaveClass("custom-select__choices-wrapper--hidden");
|
|
111
|
+
}), n("should show choices when custom select is clicked", async () => {
|
|
112
|
+
const t = y.setup(), { container: e } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), a = e.querySelector(".custom-select");
|
|
113
|
+
if (a) {
|
|
114
|
+
await t.click(a);
|
|
115
|
+
const u = e.querySelector(".custom-select__choices");
|
|
116
|
+
o(u).toBeInTheDocument();
|
|
117
|
+
}
|
|
118
|
+
}), n("should hide choices after selection", async () => {
|
|
119
|
+
const t = y.setup(), { container: e } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), a = e.querySelector(".custom-select");
|
|
120
|
+
a && await t.click(a);
|
|
121
|
+
const u = e.querySelectorAll(".choices-item");
|
|
122
|
+
u[0] && await t.click(u[0]), await h(() => {
|
|
123
|
+
const p = e.querySelector(".custom-select__choices-wrapper");
|
|
124
|
+
o(p).toHaveClass("custom-select__choices-wrapper--hidden");
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
}), r("Keyboard Navigation", () => {
|
|
128
|
+
n("should open choices on Enter key", async () => {
|
|
129
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector(".custom-select");
|
|
130
|
+
e && (d.keyDown(e, { key: "Enter" }), await h(() => {
|
|
131
|
+
const a = t.querySelector(".custom-select__choices-wrapper");
|
|
132
|
+
o(a).not.toHaveClass("custom-select__choices-wrapper--hidden");
|
|
133
|
+
}));
|
|
134
|
+
}), n("should close choices on Escape key", async () => {
|
|
135
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector(".custom-select");
|
|
136
|
+
e && (d.keyDown(e, { key: "Enter" }), d.keyDown(e, { key: "Escape" }), await h(() => {
|
|
137
|
+
const a = t.querySelector(".custom-select__choices-wrapper");
|
|
138
|
+
o(a).toHaveClass("custom-select__choices-wrapper--hidden");
|
|
139
|
+
}));
|
|
140
|
+
}), n("should allow Tab key without preventing default", () => {
|
|
141
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector(".custom-select");
|
|
142
|
+
if (e) {
|
|
143
|
+
const a = new KeyboardEvent("keydown", { key: "Tab", bubbles: !0 }), u = w.spyOn(a, "preventDefault");
|
|
144
|
+
e.dispatchEvent(a), o(u).not.toHaveBeenCalled();
|
|
145
|
+
}
|
|
146
|
+
}), n("should navigate down with ArrowDown when list is open", async () => {
|
|
147
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector(".custom-select");
|
|
148
|
+
e && (d.keyDown(e, { key: "Enter" }), d.keyDown(e, { key: "ArrowDown" }), o(e).toBeInTheDocument());
|
|
149
|
+
}), n("should navigate up with ArrowUp when list is open", async () => {
|
|
150
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector(".custom-select");
|
|
151
|
+
e && (d.keyDown(e, { key: "Enter" }), d.keyDown(e, { key: "ArrowUp" }), o(e).toBeInTheDocument());
|
|
152
|
+
}), n("should allow arrow keys to scroll page when select is closed", () => {
|
|
153
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector(".custom-select");
|
|
154
|
+
if (e) {
|
|
155
|
+
const a = new KeyboardEvent("keydown", { key: "ArrowDown", bubbles: !0 }), u = w.spyOn(a, "preventDefault");
|
|
156
|
+
e.dispatchEvent(a), o(u).not.toHaveBeenCalled();
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}), r("Validation", () => {
|
|
160
|
+
n("should show validation icon when showValidation is true", () => {
|
|
161
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { showValidation: !0, name: "test-select", options: i })), e = t.querySelector(".form-field__icon");
|
|
162
|
+
o(e).toBeInTheDocument();
|
|
163
|
+
}), n("should not show validation icon when showValidation is false", () => {
|
|
164
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i, showValidation: !1 })), e = t.querySelector(".form-field__icon");
|
|
165
|
+
o(e).not.toBeInTheDocument();
|
|
166
|
+
}), n("should use custom ValidIcon when provided", () => {
|
|
167
|
+
c(/* @__PURE__ */ s(l, { ValidIcon: () => /* @__PURE__ */ s("span", { "data-testid": "custom-valid-icon", children: "✓" }), name: "test-select", options: i })), o(m.getByRole("combobox")).toBeInTheDocument();
|
|
168
|
+
}), n("should use custom InvalidIcon when provided", () => {
|
|
169
|
+
c(/* @__PURE__ */ s(l, { InvalidIcon: () => /* @__PURE__ */ s("span", { "data-testid": "custom-invalid-icon", children: "✗" }), name: "test-select", options: i })), o(m.getByRole("combobox")).toBeInTheDocument();
|
|
170
|
+
}), n("should show validation message when invalid", () => {
|
|
171
|
+
const { container: t } = c(
|
|
172
|
+
/* @__PURE__ */ s(
|
|
173
|
+
l,
|
|
174
|
+
{
|
|
175
|
+
required: !0,
|
|
176
|
+
showValidation: !0,
|
|
177
|
+
name: "test-select",
|
|
178
|
+
options: i
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
), e = t.querySelector("select");
|
|
182
|
+
o(e).toHaveAttribute("required");
|
|
183
|
+
const a = t.querySelector(".custom-select");
|
|
184
|
+
o(a).toBeInTheDocument();
|
|
185
|
+
}), n("should default to showValidation true", () => {
|
|
186
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector(".form-field__icon");
|
|
187
|
+
o(e).toBeInTheDocument();
|
|
188
|
+
});
|
|
189
|
+
}), r("Width Options", () => {
|
|
190
|
+
n("should apply default width of 100", () => {
|
|
191
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector("label");
|
|
192
|
+
o(e).toHaveClass("input-width--100");
|
|
193
|
+
}), n("should apply width of 25", () => {
|
|
194
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i, width: 25 })), e = t.querySelector("label");
|
|
195
|
+
o(e).toHaveClass("input-width--25");
|
|
196
|
+
}), n("should apply width of 50", () => {
|
|
197
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i, width: 50 })), e = t.querySelector("label");
|
|
198
|
+
o(e).toHaveClass("input-width--50");
|
|
199
|
+
}), n("should apply width of 75", () => {
|
|
200
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i, width: 75 })), e = t.querySelector("label");
|
|
201
|
+
o(e).toHaveClass("input-width--75");
|
|
202
|
+
});
|
|
203
|
+
}), r("Expand Icon Types", () => {
|
|
204
|
+
n("should render default triangle icon", () => {
|
|
205
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector(".custom-select__icon");
|
|
206
|
+
o(e).toBeInTheDocument(), o(e).not.toHaveClass("custom-select__icon--chevron");
|
|
207
|
+
}), n("should render chevron icon when expandIconType is chevron", () => {
|
|
208
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { expandIconType: "chevron", name: "test-select", options: i })), e = t.querySelector(".custom-select__icon--chevron");
|
|
209
|
+
o(e).toBeInTheDocument();
|
|
210
|
+
}), n("should default to triangle icon", () => {
|
|
211
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { expandIconType: "default", name: "test-select", options: i })), e = t.querySelector(".custom-select__icon");
|
|
212
|
+
o(e).toBeInTheDocument();
|
|
213
|
+
});
|
|
214
|
+
}), r("CSS Classes", () => {
|
|
215
|
+
n("should apply form-field class", () => {
|
|
216
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector(".form-field");
|
|
217
|
+
o(e).toBeInTheDocument();
|
|
218
|
+
}), n("should apply custom-select class", () => {
|
|
219
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector(".custom-select");
|
|
220
|
+
o(e).toBeInTheDocument();
|
|
221
|
+
}), n("should apply custom-select__choices class", () => {
|
|
222
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector(".custom-select__choices");
|
|
223
|
+
o(e).toBeInTheDocument();
|
|
224
|
+
}), n("should apply placeholder class when no selection", () => {
|
|
225
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i, placeholder: "Test" })), e = t.querySelector(".custom-select__placeholder");
|
|
226
|
+
o(e).toBeInTheDocument();
|
|
227
|
+
});
|
|
228
|
+
}), r("Native Select Integration", () => {
|
|
229
|
+
n("should set tabIndex to -1 on native select", () => {
|
|
230
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector("select");
|
|
231
|
+
o(e).toHaveAttribute("tabindex", "-1");
|
|
232
|
+
}), n("should set name attribute on native select", () => {
|
|
233
|
+
c(/* @__PURE__ */ s(l, { name: "my-select", options: i }));
|
|
234
|
+
const t = m.getByRole("combobox");
|
|
235
|
+
o(t).toHaveAttribute("name", "my-select");
|
|
236
|
+
}), n("should include empty option in native select", () => {
|
|
237
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i })), e = t.querySelector('option[value=""]');
|
|
238
|
+
o(e).toBeInTheDocument();
|
|
239
|
+
}), n("should mark selected options in native select", () => {
|
|
240
|
+
const t = [
|
|
241
|
+
{ id: 1, parent_id: null, label: "Option 1", value: "opt1", subcategories: [], status: "normal", selected: !0 },
|
|
242
|
+
{ id: 2, parent_id: null, label: "Option 2", value: "opt2", subcategories: [], status: "normal" }
|
|
243
|
+
], { container: e } = c(/* @__PURE__ */ s(l, { name: "test-select", options: t })), a = e.querySelector('option[value="opt1"]');
|
|
244
|
+
o(a).toHaveProperty("selected", !0);
|
|
245
|
+
});
|
|
246
|
+
}), r("Additional Props", () => {
|
|
247
|
+
n("should pass additional attributes to select element", () => {
|
|
248
|
+
const { container: t } = c(
|
|
249
|
+
/* @__PURE__ */ s(
|
|
250
|
+
l,
|
|
251
|
+
{
|
|
252
|
+
required: !0,
|
|
253
|
+
"data-testid": "custom-attr",
|
|
254
|
+
name: "test-select",
|
|
255
|
+
options: i
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
), e = t.querySelector("select");
|
|
259
|
+
o(e).toHaveAttribute("required"), o(e).toHaveAttribute("data-testid", "custom-attr");
|
|
260
|
+
}), n("should handle aria attributes", () => {
|
|
261
|
+
const { container: t } = c(
|
|
262
|
+
/* @__PURE__ */ s(
|
|
263
|
+
l,
|
|
264
|
+
{
|
|
265
|
+
"aria-label": "Test Select",
|
|
266
|
+
name: "test-select",
|
|
267
|
+
options: i
|
|
268
|
+
}
|
|
269
|
+
)
|
|
270
|
+
), e = t.querySelector("select");
|
|
271
|
+
o(e).toHaveAttribute("aria-label", "Test Select");
|
|
272
|
+
});
|
|
273
|
+
}), r("Label Behavior", () => {
|
|
274
|
+
n("should associate label with select using htmlFor", () => {
|
|
275
|
+
const { container: t } = c(
|
|
276
|
+
/* @__PURE__ */ s(l, { label: "Test Label", name: "test-select", options: i })
|
|
277
|
+
), e = t.querySelector("label");
|
|
278
|
+
o(e).toHaveAttribute("for", "test-select");
|
|
279
|
+
}), n("should adjust icon position when no label", () => {
|
|
280
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { label: "", name: "test-select", options: i })), e = t.querySelector(".form-field__icon");
|
|
281
|
+
o(e).toHaveStyle({ top: "0.4em" });
|
|
282
|
+
});
|
|
283
|
+
}), r("Edge Cases", () => {
|
|
284
|
+
n("should handle options with subcategories", () => {
|
|
285
|
+
c(/* @__PURE__ */ s(l, { name: "test-select", options: [
|
|
286
|
+
{
|
|
287
|
+
id: 1,
|
|
288
|
+
parent_id: null,
|
|
289
|
+
label: "Parent",
|
|
290
|
+
value: "parent",
|
|
291
|
+
subcategories: [
|
|
292
|
+
{ id: 2, parent_id: 1, label: "Child", value: "child", subcategories: [], status: "normal" }
|
|
293
|
+
],
|
|
294
|
+
status: "normal"
|
|
295
|
+
}
|
|
296
|
+
] })), o(m.getByRole("combobox")).toBeInTheDocument();
|
|
297
|
+
}), n("should handle empty placeholder", () => {
|
|
298
|
+
const { container: t } = c(/* @__PURE__ */ s(l, { name: "test-select", options: i, placeholder: "" })), e = t.querySelector(".custom-select__placeholder");
|
|
299
|
+
o(e).not.toBeInTheDocument();
|
|
300
|
+
}), n("should handle selection and deselection in multiple mode", async () => {
|
|
301
|
+
const t = y.setup(), { container: e } = c(/* @__PURE__ */ s(l, { multiple: !0, name: "test-select", options: i })), a = e.querySelector(".custom-select__selections");
|
|
302
|
+
if (a) {
|
|
303
|
+
await t.click(a);
|
|
304
|
+
const u = e.querySelectorAll(".choices-item");
|
|
305
|
+
u[0] && (await t.click(u[0]), await h(async () => {
|
|
306
|
+
const p = e.querySelector(".custom-select__remove");
|
|
307
|
+
p && await t.click(p);
|
|
308
|
+
}));
|
|
309
|
+
}
|
|
310
|
+
o(e.querySelector(".custom-select")).toBeInTheDocument();
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs as _, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useState as g, useReducer as I, useRef as m, useCallback as M, useEffect as p } from "react";
|
|
3
|
-
import { f as
|
|
3
|
+
import { f as s } from "../../format-YhWt2D8M.mjs";
|
|
4
4
|
import { classes as o } from "../../utils/helpers.js";
|
|
5
|
-
import {
|
|
6
|
-
import { C as W } from "../../chevron-left-
|
|
7
|
-
import { C as w } from "../../chevron-right-
|
|
5
|
+
import { u as S } from "../../useScheduleContext-D7FdzNxe.mjs";
|
|
6
|
+
import { C as W } from "../../chevron-left-D0UjbrKw.mjs";
|
|
7
|
+
import { C as w } from "../../chevron-right-0ZF3LruR.mjs";
|
|
8
8
|
import '../../assets/DateNavigation.css';const a = {
|
|
9
9
|
"date-navigation__list": "_date-navigation__list_1jjng_1",
|
|
10
10
|
"date-navigation__control": "_date-navigation__control_1jjng_72",
|
|
@@ -27,10 +27,10 @@ function A(n, i) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
function V() {
|
|
30
|
-
const { weeks: n, setCurrentDate: i } = S(), [r, j] = g(0), [x, b] = g(n[0]), [
|
|
30
|
+
const { weeks: n, setCurrentDate: i } = S(), [r, j] = g(0), [x, b] = g(n[0]), [l, y] = g(n[0][0]), [C, h] = I(A, "idle"), d = m(null), N = m(0), f = m(s(new Date(l.fullDateStr), "yyyy-MM-dd")), k = (t) => {
|
|
31
31
|
h({ type: "NAVIGATE_TO_WEEK", currentWeekIndex: r, targetWeekIndex: t }), j(t);
|
|
32
32
|
}, D = (t) => {
|
|
33
|
-
|
|
33
|
+
s(t.date, "yyyy-MM-dd") !== f.current && (f.current = s(t.date, "yyyy-MM-dd"), y(t), i(t.date));
|
|
34
34
|
}, c = M(() => {
|
|
35
35
|
if (d.current === null) return;
|
|
36
36
|
const t = d.current;
|
|
@@ -42,14 +42,14 @@ function V() {
|
|
|
42
42
|
d.current !== null && (d.current.removeEventListener("animationend", c), d.current.addEventListener("animationend", c, { once: !0 }));
|
|
43
43
|
}, [c]), p(() => {
|
|
44
44
|
b(n[r]);
|
|
45
|
-
const t = r ? 0 : 1, E = l
|
|
46
|
-
(v) =>
|
|
45
|
+
const t = r ? 0 : 1, E = s(l.date, "yyyy-MM-dd"), u = n[t].findIndex(
|
|
46
|
+
(v) => s(v.date, "yyyy-MM-dd") === E
|
|
47
47
|
);
|
|
48
48
|
if (u !== -1 && n[r][u]) {
|
|
49
49
|
const v = n[r][u];
|
|
50
50
|
N.current = u, y(v), i(v.date);
|
|
51
51
|
}
|
|
52
|
-
}, [r, n, i,
|
|
52
|
+
}, [r, n, i, l]), /* @__PURE__ */ _("date-navigation", { "data-state": C, children: [
|
|
53
53
|
/* @__PURE__ */ _("date-navigation-controls", { children: [
|
|
54
54
|
/* @__PURE__ */ _(
|
|
55
55
|
"button",
|
|
@@ -108,7 +108,7 @@ function V() {
|
|
|
108
108
|
"button",
|
|
109
109
|
{
|
|
110
110
|
"aria-controls": `${t.fullDateStr}`,
|
|
111
|
-
"aria-selected":
|
|
111
|
+
"aria-selected": l.fullDateStr === t.fullDateStr,
|
|
112
112
|
className: o([a["date-navigation__day"], "date-navigation__day"]),
|
|
113
113
|
role: "tab",
|
|
114
114
|
type: "button",
|