@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,565 @@
|
|
|
1
|
+
import { jsx as a, jsxs as w } from "react/jsx-runtime";
|
|
2
|
+
import { v as y, d as k, b as B, a as T, i as r, r as i, g as c, s as e, f as l, w as h } from "../../react.esm-DLSrfVwM.mjs";
|
|
3
|
+
import "../../index-BVxBrkZB.mjs";
|
|
4
|
+
import { ChannelSearch as u } from "./ChannelSearch.js";
|
|
5
|
+
y.mock("../Input", () => ({
|
|
6
|
+
default: ({ name: o, placeholder: s }) => /* @__PURE__ */ a("input", { "data-testid": `input-${o}`, name: o, placeholder: s })
|
|
7
|
+
}));
|
|
8
|
+
y.mock("../CustomDataList", () => ({
|
|
9
|
+
default: ({ name: o, placeholder: s, options: p }) => /* @__PURE__ */ w("select", { "data-testid": `datalist-${o}`, name: o, title: "{ name }", children: [
|
|
10
|
+
/* @__PURE__ */ a("option", { value: "", children: s }),
|
|
11
|
+
p.map(
|
|
12
|
+
(d) => /* @__PURE__ */ a("option", { value: d.id, children: d.label }, d.id)
|
|
13
|
+
)
|
|
14
|
+
] })
|
|
15
|
+
}));
|
|
16
|
+
y.mock("../ActionButton", () => ({
|
|
17
|
+
default: ({ label: o, onClick: s, classname: p }) => /* @__PURE__ */ a("button", { className: p, "data-testid": "action-button", onClick: s, children: o })
|
|
18
|
+
}));
|
|
19
|
+
y.mock("../ResultsTable", () => ({
|
|
20
|
+
default: ({ columns: o, results: s, noResultsMsg: p, compactLayout: d }) => /* @__PURE__ */ a("div", { "data-compact": d, "data-testid": "results-table", children: s.length === 0 ? /* @__PURE__ */ a("div", { "data-testid": "no-results", children: p }) : /* @__PURE__ */ w("table", { children: [
|
|
21
|
+
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a("tr", { children: o.map(
|
|
22
|
+
(b) => /* @__PURE__ */ a("th", { children: b.title }, b.resultKey)
|
|
23
|
+
) }) }),
|
|
24
|
+
/* @__PURE__ */ a("tbody", { children: s.map(
|
|
25
|
+
(b, t) => /* @__PURE__ */ a("tr", { "data-testid": "result-row", children: o.map(
|
|
26
|
+
(n) => /* @__PURE__ */ a("td", { children: b[n.resultKey] }, n.resultKey)
|
|
27
|
+
) }, t)
|
|
28
|
+
) })
|
|
29
|
+
] }) })
|
|
30
|
+
}));
|
|
31
|
+
y.mock("../AdBlock", () => ({
|
|
32
|
+
default: ({ ad: o, image: s, theme: p }) => /* @__PURE__ */ w("div", { "data-testid": "ad-block", "data-theme": p, children: [
|
|
33
|
+
/* @__PURE__ */ a("div", { "data-testid": "ad-header", children: o.header }),
|
|
34
|
+
/* @__PURE__ */ a("div", { "data-testid": "ad-description", children: o.description }),
|
|
35
|
+
/* @__PURE__ */ a("a", { "data-testid": "ad-link", href: o.href, children: o.linkText }),
|
|
36
|
+
/* @__PURE__ */ a("img", { alt: s.altText, "data-testid": "ad-image", src: s.url })
|
|
37
|
+
] })
|
|
38
|
+
}));
|
|
39
|
+
y.mock("../../utils/helpers", () => ({
|
|
40
|
+
classes: (o) => o.filter(Boolean).join(" ")
|
|
41
|
+
}));
|
|
42
|
+
y.mock("../../utils/events", () => ({
|
|
43
|
+
publish: y.fn()
|
|
44
|
+
}));
|
|
45
|
+
y.mock("../../data-resources/FakeDataResource.js", () => ({
|
|
46
|
+
statesForCustomList: [
|
|
47
|
+
{ id: 1, label: "California", value: "CA" },
|
|
48
|
+
{ id: 2, label: "New York", value: "NY" },
|
|
49
|
+
{ id: 3, label: "Texas", value: "TX" }
|
|
50
|
+
]
|
|
51
|
+
}));
|
|
52
|
+
k("ChannelSearch", () => {
|
|
53
|
+
const o = {
|
|
54
|
+
brand_name: "Test Network",
|
|
55
|
+
slug: "test-network"
|
|
56
|
+
}, s = "https://api.example.com/channels", p = [
|
|
57
|
+
{
|
|
58
|
+
city: "Los Angeles",
|
|
59
|
+
state: "ca",
|
|
60
|
+
call_letters: "KABC",
|
|
61
|
+
ota: "7.1",
|
|
62
|
+
cable: "7",
|
|
63
|
+
satellite: "7",
|
|
64
|
+
provider: ""
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
city: "San Francisco",
|
|
68
|
+
state: "ca",
|
|
69
|
+
call_letters: "KGO",
|
|
70
|
+
ota: "7.1",
|
|
71
|
+
cable: "7",
|
|
72
|
+
satellite: "",
|
|
73
|
+
provider: ""
|
|
74
|
+
}
|
|
75
|
+
];
|
|
76
|
+
let d, b;
|
|
77
|
+
B(() => {
|
|
78
|
+
y.clearAllMocks(), d = y.fn(), global.fetch = d, b = y.fn(), window.scroll = b, window.pageYOffset = 0, Element.prototype.getBoundingClientRect = y.fn(() => ({
|
|
79
|
+
y: 500,
|
|
80
|
+
x: 0,
|
|
81
|
+
width: 0,
|
|
82
|
+
height: 0,
|
|
83
|
+
top: 500,
|
|
84
|
+
right: 0,
|
|
85
|
+
bottom: 0,
|
|
86
|
+
left: 0,
|
|
87
|
+
toJSON: () => {
|
|
88
|
+
}
|
|
89
|
+
}));
|
|
90
|
+
}), T(() => {
|
|
91
|
+
y.restoreAllMocks();
|
|
92
|
+
}), k("Basic Rendering", () => {
|
|
93
|
+
r("should render with required props", () => {
|
|
94
|
+
i(/* @__PURE__ */ a(u, { baseApiUrl: s, network: o })), c(e.getByText(/Test Network Channel Search:/)).toBeInTheDocument();
|
|
95
|
+
}), r("should render form element", () => {
|
|
96
|
+
const { container: t } = i(
|
|
97
|
+
/* @__PURE__ */ a(u, { baseApiUrl: s, network: o })
|
|
98
|
+
), n = t.querySelector("#channel-search");
|
|
99
|
+
c(n).toBeInTheDocument();
|
|
100
|
+
}), r("should render submit button", () => {
|
|
101
|
+
i(/* @__PURE__ */ a(u, { baseApiUrl: s, network: o }));
|
|
102
|
+
const t = e.getByTestId("action-button");
|
|
103
|
+
c(t).toBeInTheDocument(), c(t).toHaveTextContent("Submit");
|
|
104
|
+
});
|
|
105
|
+
}), k("Search Options Rendering", () => {
|
|
106
|
+
r("should render zipcode input when allowZipcodeSearch is true", () => {
|
|
107
|
+
i(
|
|
108
|
+
/* @__PURE__ */ a(
|
|
109
|
+
u,
|
|
110
|
+
{
|
|
111
|
+
allowZipcodeSearch: !0,
|
|
112
|
+
baseApiUrl: s,
|
|
113
|
+
network: o
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
), c(e.getByTestId("input-zipcode")).toBeInTheDocument();
|
|
117
|
+
}), r("should not render zipcode input when allowZipcodeSearch is false", () => {
|
|
118
|
+
i(
|
|
119
|
+
/* @__PURE__ */ a(
|
|
120
|
+
u,
|
|
121
|
+
{
|
|
122
|
+
allowZipcodeSearch: !1,
|
|
123
|
+
baseApiUrl: s,
|
|
124
|
+
network: o
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
), c(e.queryByTestId("input-zipcode")).not.toBeInTheDocument();
|
|
128
|
+
}), r("should render state select when allowStateSearch is true", () => {
|
|
129
|
+
i(
|
|
130
|
+
/* @__PURE__ */ a(
|
|
131
|
+
u,
|
|
132
|
+
{
|
|
133
|
+
allowStateSearch: !0,
|
|
134
|
+
baseApiUrl: s,
|
|
135
|
+
network: o
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
), c(e.getByTestId("datalist-state")).toBeInTheDocument();
|
|
139
|
+
}), r("should not render state select when allowStateSearch is false", () => {
|
|
140
|
+
i(
|
|
141
|
+
/* @__PURE__ */ a(
|
|
142
|
+
u,
|
|
143
|
+
{
|
|
144
|
+
allowStateSearch: !1,
|
|
145
|
+
baseApiUrl: s,
|
|
146
|
+
network: o
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
), c(e.queryByTestId("datalist-state")).not.toBeInTheDocument();
|
|
150
|
+
}), r('should render "or" text when both search options are enabled', () => {
|
|
151
|
+
const { container: t } = i(
|
|
152
|
+
/* @__PURE__ */ a(
|
|
153
|
+
u,
|
|
154
|
+
{
|
|
155
|
+
allowStateSearch: !0,
|
|
156
|
+
allowZipcodeSearch: !0,
|
|
157
|
+
baseApiUrl: s,
|
|
158
|
+
network: o
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
);
|
|
162
|
+
c(t.textContent).toContain("or");
|
|
163
|
+
}), r('should not render "or" text when only zipcode search is enabled', () => {
|
|
164
|
+
i(
|
|
165
|
+
/* @__PURE__ */ a(
|
|
166
|
+
u,
|
|
167
|
+
{
|
|
168
|
+
allowZipcodeSearch: !0,
|
|
169
|
+
allowStateSearch: !1,
|
|
170
|
+
baseApiUrl: s,
|
|
171
|
+
network: o
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
);
|
|
175
|
+
const t = document.querySelector("#channel-search");
|
|
176
|
+
c(t == null ? void 0 : t.textContent).not.toMatch(/\bor\b/);
|
|
177
|
+
}), r('should not render "or" text when only state search is enabled', () => {
|
|
178
|
+
i(
|
|
179
|
+
/* @__PURE__ */ a(
|
|
180
|
+
u,
|
|
181
|
+
{
|
|
182
|
+
allowStateSearch: !0,
|
|
183
|
+
allowZipcodeSearch: !1,
|
|
184
|
+
baseApiUrl: s,
|
|
185
|
+
network: o
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
);
|
|
189
|
+
const t = document.querySelector("#channel-search");
|
|
190
|
+
c(t == null ? void 0 : t.textContent).not.toMatch(/\bor\b/);
|
|
191
|
+
});
|
|
192
|
+
}), k("Zipcode Search", () => {
|
|
193
|
+
r("should fetch results when submitting with zipcode", async () => {
|
|
194
|
+
d.mockResolvedValueOnce({
|
|
195
|
+
ok: !0,
|
|
196
|
+
json: async () => p
|
|
197
|
+
}), i(/* @__PURE__ */ a(u, { baseApiUrl: s, network: o }));
|
|
198
|
+
const t = e.getByTestId("input-zipcode"), n = e.getByTestId("action-button");
|
|
199
|
+
l.change(t, { target: { value: "90210" } }), l.click(n), await h(() => {
|
|
200
|
+
c(d).toHaveBeenCalledWith(
|
|
201
|
+
"https://api.example.com/channels/test-network?zip=90210"
|
|
202
|
+
);
|
|
203
|
+
});
|
|
204
|
+
}), r("should display results after successful zipcode search", async () => {
|
|
205
|
+
d.mockResolvedValueOnce({
|
|
206
|
+
ok: !0,
|
|
207
|
+
json: async () => p
|
|
208
|
+
}), i(/* @__PURE__ */ a(u, { baseApiUrl: s, network: o }));
|
|
209
|
+
const t = e.getByTestId("input-zipcode"), n = e.getByTestId("action-button");
|
|
210
|
+
l.change(t, { target: { value: "90210" } }), l.click(n), await h(() => {
|
|
211
|
+
c(e.getByTestId("results-table")).toBeInTheDocument();
|
|
212
|
+
}), c(e.getAllByTestId("result-row")).toHaveLength(2);
|
|
213
|
+
}), r("should format city and state correctly in results", async () => {
|
|
214
|
+
d.mockResolvedValueOnce({
|
|
215
|
+
ok: !0,
|
|
216
|
+
json: async () => p
|
|
217
|
+
}), i(/* @__PURE__ */ a(u, { baseApiUrl: s, network: o }));
|
|
218
|
+
const t = e.getByTestId("input-zipcode"), n = e.getByTestId("action-button");
|
|
219
|
+
l.change(t, { target: { value: "90210" } }), l.click(n), await h(() => {
|
|
220
|
+
c(e.getByText("Los Angeles, CA")).toBeInTheDocument();
|
|
221
|
+
});
|
|
222
|
+
}), r("should handle empty zipcode search results", async () => {
|
|
223
|
+
d.mockResolvedValueOnce({
|
|
224
|
+
ok: !0,
|
|
225
|
+
json: async () => []
|
|
226
|
+
}), i(/* @__PURE__ */ a(u, { baseApiUrl: s, network: o }));
|
|
227
|
+
const t = e.getByTestId("input-zipcode"), n = e.getByTestId("action-button");
|
|
228
|
+
l.change(t, { target: { value: "00000" } }), l.click(n), await h(() => {
|
|
229
|
+
c(e.getByTestId("no-results")).toBeInTheDocument();
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
}), k("State Search", () => {
|
|
233
|
+
r("should fetch results when submitting with state", async () => {
|
|
234
|
+
d.mockResolvedValueOnce({
|
|
235
|
+
ok: !0,
|
|
236
|
+
json: async () => p
|
|
237
|
+
}), i(/* @__PURE__ */ a(u, { baseApiUrl: s, network: o }));
|
|
238
|
+
const t = e.getByTestId("datalist-state"), n = e.getByTestId("action-button");
|
|
239
|
+
l.change(t, { target: { value: "1" } }), l.click(n), await h(() => {
|
|
240
|
+
c(d).toHaveBeenCalledWith(
|
|
241
|
+
"https://api.example.com/channels/test-network?state=CA"
|
|
242
|
+
);
|
|
243
|
+
});
|
|
244
|
+
}), r("should display results after successful state search", async () => {
|
|
245
|
+
d.mockResolvedValueOnce({
|
|
246
|
+
ok: !0,
|
|
247
|
+
json: async () => p
|
|
248
|
+
}), i(/* @__PURE__ */ a(u, { baseApiUrl: s, network: o }));
|
|
249
|
+
const t = e.getByTestId("datalist-state"), n = e.getByTestId("action-button");
|
|
250
|
+
l.change(t, { target: { value: "2" } }), l.click(n), await h(() => {
|
|
251
|
+
c(e.getByTestId("results-table")).toBeInTheDocument();
|
|
252
|
+
});
|
|
253
|
+
}), r("should display state name in results header when only state search is enabled", async () => {
|
|
254
|
+
d.mockResolvedValueOnce({
|
|
255
|
+
ok: !0,
|
|
256
|
+
json: async () => p
|
|
257
|
+
}), i(
|
|
258
|
+
/* @__PURE__ */ a(
|
|
259
|
+
u,
|
|
260
|
+
{
|
|
261
|
+
allowStateSearch: !0,
|
|
262
|
+
allowZipcodeSearch: !1,
|
|
263
|
+
baseApiUrl: s,
|
|
264
|
+
network: o
|
|
265
|
+
}
|
|
266
|
+
)
|
|
267
|
+
);
|
|
268
|
+
const t = e.getByTestId("datalist-state"), n = e.getByTestId("action-button");
|
|
269
|
+
l.change(t, { target: { value: "1" } }), l.click(n), await h(() => {
|
|
270
|
+
c(e.getByText(/California Test Network Channels/)).toBeInTheDocument();
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
}), k("Error Handling", () => {
|
|
274
|
+
r("should handle fetch error gracefully", async () => {
|
|
275
|
+
const t = y.spyOn(console, "error").mockImplementation(() => {
|
|
276
|
+
});
|
|
277
|
+
d.mockRejectedValueOnce(new Error("Network error")), i(/* @__PURE__ */ a(u, { baseApiUrl: s, network: o }));
|
|
278
|
+
const n = e.getByTestId("input-zipcode"), m = e.getByTestId("action-button");
|
|
279
|
+
l.change(n, { target: { value: "90210" } }), l.click(m), await h(() => {
|
|
280
|
+
c(e.getByTestId("no-results")).toBeInTheDocument();
|
|
281
|
+
}), t.mockRestore();
|
|
282
|
+
}), r("should handle non-OK response", async () => {
|
|
283
|
+
const t = y.spyOn(console, "log").mockImplementation(() => {
|
|
284
|
+
}), n = y.spyOn(console, "error").mockImplementation(() => {
|
|
285
|
+
});
|
|
286
|
+
d.mockResolvedValueOnce({
|
|
287
|
+
ok: !1,
|
|
288
|
+
json: async () => ({})
|
|
289
|
+
}), i(/* @__PURE__ */ a(u, { baseApiUrl: s, network: o }));
|
|
290
|
+
const m = e.getByTestId("input-zipcode"), g = e.getByTestId("action-button");
|
|
291
|
+
l.change(m, { target: { value: "90210" } }), l.click(g), await h(() => {
|
|
292
|
+
c(e.getByTestId("no-results")).toBeInTheDocument();
|
|
293
|
+
}), t.mockRestore(), n.mockRestore();
|
|
294
|
+
});
|
|
295
|
+
}), k("Provider Field", () => {
|
|
296
|
+
r("should use cable when available", async () => {
|
|
297
|
+
const t = [
|
|
298
|
+
{
|
|
299
|
+
city: "Test City",
|
|
300
|
+
state: "ca",
|
|
301
|
+
call_letters: "TEST",
|
|
302
|
+
ota: "7.1",
|
|
303
|
+
cable: "Comcast 123",
|
|
304
|
+
satellite: "DirectTV 456",
|
|
305
|
+
provider: ""
|
|
306
|
+
}
|
|
307
|
+
];
|
|
308
|
+
d.mockResolvedValueOnce({
|
|
309
|
+
ok: !0,
|
|
310
|
+
json: async () => t
|
|
311
|
+
}), i(/* @__PURE__ */ a(u, { baseApiUrl: s, network: o }));
|
|
312
|
+
const n = e.getByTestId("input-zipcode"), m = e.getByTestId("action-button");
|
|
313
|
+
l.change(n, { target: { value: "90210" } }), l.click(m), await h(() => {
|
|
314
|
+
c(e.getByText("Comcast 123")).toBeInTheDocument();
|
|
315
|
+
});
|
|
316
|
+
}), r("should use satellite when cable is null", async () => {
|
|
317
|
+
const t = [
|
|
318
|
+
{
|
|
319
|
+
city: "Test City",
|
|
320
|
+
state: "ca",
|
|
321
|
+
call_letters: "TEST",
|
|
322
|
+
ota: "7.1",
|
|
323
|
+
cable: null,
|
|
324
|
+
satellite: "DirectTV 456",
|
|
325
|
+
provider: ""
|
|
326
|
+
}
|
|
327
|
+
];
|
|
328
|
+
d.mockResolvedValueOnce({
|
|
329
|
+
ok: !0,
|
|
330
|
+
json: async () => t
|
|
331
|
+
}), i(/* @__PURE__ */ a(u, { baseApiUrl: s, network: o }));
|
|
332
|
+
const n = e.getByTestId("input-zipcode"), m = e.getByTestId("action-button");
|
|
333
|
+
l.change(n, { target: { value: "90210" } }), l.click(m), await h(() => {
|
|
334
|
+
c(e.getByText("DirectTV 456")).toBeInTheDocument();
|
|
335
|
+
});
|
|
336
|
+
}), r("should use satellite when cable is empty string", async () => {
|
|
337
|
+
const t = [
|
|
338
|
+
{
|
|
339
|
+
city: "Test City",
|
|
340
|
+
state: "ca",
|
|
341
|
+
call_letters: "TEST",
|
|
342
|
+
ota: "7.1",
|
|
343
|
+
cable: "",
|
|
344
|
+
satellite: "DirectTV 456",
|
|
345
|
+
provider: ""
|
|
346
|
+
}
|
|
347
|
+
];
|
|
348
|
+
d.mockResolvedValueOnce({
|
|
349
|
+
ok: !0,
|
|
350
|
+
json: async () => t
|
|
351
|
+
}), i(/* @__PURE__ */ a(u, { baseApiUrl: s, network: o }));
|
|
352
|
+
const n = e.getByTestId("input-zipcode"), m = e.getByTestId("action-button");
|
|
353
|
+
l.change(n, { target: { value: "90210" } }), l.click(m), await h(() => {
|
|
354
|
+
c(e.getByText("DirectTV 456")).toBeInTheDocument();
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
}), k("Auto-scroll Behavior", () => {
|
|
358
|
+
r("should scroll to results when allowAutoScroll is true", async () => {
|
|
359
|
+
d.mockResolvedValueOnce({
|
|
360
|
+
ok: !0,
|
|
361
|
+
json: async () => p
|
|
362
|
+
}), i(
|
|
363
|
+
/* @__PURE__ */ a(
|
|
364
|
+
u,
|
|
365
|
+
{
|
|
366
|
+
allowAutoScroll: !0,
|
|
367
|
+
baseApiUrl: s,
|
|
368
|
+
network: o
|
|
369
|
+
}
|
|
370
|
+
)
|
|
371
|
+
);
|
|
372
|
+
const t = e.getByTestId("input-zipcode"), n = e.getByTestId("action-button");
|
|
373
|
+
l.change(t, { target: { value: "90210" } }), l.click(n), await h(() => {
|
|
374
|
+
c(e.getByTestId("results-table")).toBeInTheDocument();
|
|
375
|
+
}), await h(() => {
|
|
376
|
+
c(b).toHaveBeenCalledWith({
|
|
377
|
+
left: 0,
|
|
378
|
+
top: 475,
|
|
379
|
+
// 500 - 25 (default offset)
|
|
380
|
+
behavior: "smooth"
|
|
381
|
+
});
|
|
382
|
+
});
|
|
383
|
+
}), r("should not scroll when allowAutoScroll is false", async () => {
|
|
384
|
+
d.mockResolvedValueOnce({
|
|
385
|
+
ok: !0,
|
|
386
|
+
json: async () => p
|
|
387
|
+
}), i(
|
|
388
|
+
/* @__PURE__ */ a(
|
|
389
|
+
u,
|
|
390
|
+
{
|
|
391
|
+
allowAutoScroll: !1,
|
|
392
|
+
baseApiUrl: s,
|
|
393
|
+
network: o
|
|
394
|
+
}
|
|
395
|
+
)
|
|
396
|
+
);
|
|
397
|
+
const t = e.getByTestId("input-zipcode"), n = e.getByTestId("action-button");
|
|
398
|
+
l.change(t, { target: { value: "90210" } }), l.click(n), await h(() => {
|
|
399
|
+
c(e.getByTestId("results-table")).toBeInTheDocument();
|
|
400
|
+
}), await new Promise((m) => setTimeout(m, 150)), c(b).not.toHaveBeenCalled();
|
|
401
|
+
}), r("should use custom autoScrollOffset", async () => {
|
|
402
|
+
d.mockResolvedValueOnce({
|
|
403
|
+
ok: !0,
|
|
404
|
+
json: async () => p
|
|
405
|
+
}), i(
|
|
406
|
+
/* @__PURE__ */ a(
|
|
407
|
+
u,
|
|
408
|
+
{
|
|
409
|
+
allowAutoScroll: !0,
|
|
410
|
+
autoScrollOffset: 100,
|
|
411
|
+
baseApiUrl: s,
|
|
412
|
+
network: o
|
|
413
|
+
}
|
|
414
|
+
)
|
|
415
|
+
);
|
|
416
|
+
const t = e.getByTestId("input-zipcode"), n = e.getByTestId("action-button");
|
|
417
|
+
l.change(t, { target: { value: "90210" } }), l.click(n), await h(() => {
|
|
418
|
+
c(e.getByTestId("results-table")).toBeInTheDocument();
|
|
419
|
+
}), await h(() => {
|
|
420
|
+
c(b).toHaveBeenCalledWith({
|
|
421
|
+
left: 0,
|
|
422
|
+
top: 400,
|
|
423
|
+
// 500 - 100 (custom offset)
|
|
424
|
+
behavior: "smooth"
|
|
425
|
+
});
|
|
426
|
+
});
|
|
427
|
+
});
|
|
428
|
+
}), k("Event Publishing", () => {
|
|
429
|
+
r("should publish scripps:action:completed event after search", async () => {
|
|
430
|
+
const { publish: t } = await import("../../utils/events.js");
|
|
431
|
+
d.mockResolvedValueOnce({
|
|
432
|
+
ok: !0,
|
|
433
|
+
json: async () => p
|
|
434
|
+
}), i(/* @__PURE__ */ a(u, { baseApiUrl: s, network: o }));
|
|
435
|
+
const n = e.getByTestId("input-zipcode"), m = e.getByTestId("action-button");
|
|
436
|
+
l.change(n, { target: { value: "90210" } }), l.click(m), await h(() => {
|
|
437
|
+
c(t).toHaveBeenCalledWith("scripps:action:completed");
|
|
438
|
+
}, { timeout: 1e3 });
|
|
439
|
+
});
|
|
440
|
+
}), k("AdBlock Display", () => {
|
|
441
|
+
r("should render AdBlock when compactLayout is false", () => {
|
|
442
|
+
i(
|
|
443
|
+
/* @__PURE__ */ a(
|
|
444
|
+
u,
|
|
445
|
+
{
|
|
446
|
+
baseApiUrl: s,
|
|
447
|
+
compactLayout: !1,
|
|
448
|
+
network: o
|
|
449
|
+
}
|
|
450
|
+
)
|
|
451
|
+
), c(e.getByTestId("ad-block")).toBeInTheDocument();
|
|
452
|
+
}), r("should not render AdBlock when compactLayout is true", () => {
|
|
453
|
+
i(
|
|
454
|
+
/* @__PURE__ */ a(
|
|
455
|
+
u,
|
|
456
|
+
{
|
|
457
|
+
compactLayout: !0,
|
|
458
|
+
baseApiUrl: s,
|
|
459
|
+
network: o
|
|
460
|
+
}
|
|
461
|
+
)
|
|
462
|
+
), c(e.queryByTestId("ad-block")).not.toBeInTheDocument();
|
|
463
|
+
}), r("should render AdBlock with correct props", () => {
|
|
464
|
+
i(
|
|
465
|
+
/* @__PURE__ */ a(
|
|
466
|
+
u,
|
|
467
|
+
{
|
|
468
|
+
ad: {
|
|
469
|
+
campaign: "test-campaign",
|
|
470
|
+
source: "test-source",
|
|
471
|
+
medium: "test-medium",
|
|
472
|
+
content: "test-content"
|
|
473
|
+
},
|
|
474
|
+
baseApiUrl: s,
|
|
475
|
+
network: o
|
|
476
|
+
}
|
|
477
|
+
)
|
|
478
|
+
);
|
|
479
|
+
const n = e.getByTestId("ad-block");
|
|
480
|
+
c(n).toHaveAttribute("data-theme", "tablotv"), c(e.getByTestId("ad-header")).toHaveTextContent(
|
|
481
|
+
"Fall in love with subscription-free TV."
|
|
482
|
+
);
|
|
483
|
+
});
|
|
484
|
+
}), k("Results Header", () => {
|
|
485
|
+
r('should display plural "Channels" when multiple results', async () => {
|
|
486
|
+
d.mockResolvedValueOnce({
|
|
487
|
+
ok: !0,
|
|
488
|
+
json: async () => p
|
|
489
|
+
}), i(/* @__PURE__ */ a(u, { baseApiUrl: s, network: o }));
|
|
490
|
+
const t = e.getByTestId("input-zipcode"), n = e.getByTestId("action-button");
|
|
491
|
+
l.change(t, { target: { value: "90210" } }), l.click(n), await h(() => {
|
|
492
|
+
c(e.getByText(/Your Test Network Channels/)).toBeInTheDocument();
|
|
493
|
+
});
|
|
494
|
+
}), r('should display singular "Channel" when single result', async () => {
|
|
495
|
+
d.mockResolvedValueOnce({
|
|
496
|
+
ok: !0,
|
|
497
|
+
json: async () => [p[0]]
|
|
498
|
+
}), i(/* @__PURE__ */ a(u, { baseApiUrl: s, network: o }));
|
|
499
|
+
const t = e.getByTestId("input-zipcode"), n = e.getByTestId("action-button");
|
|
500
|
+
l.change(t, { target: { value: "90210" } }), l.click(n), await h(() => {
|
|
501
|
+
c(e.getByText(/Your Test Network Channel$/)).toBeInTheDocument();
|
|
502
|
+
});
|
|
503
|
+
});
|
|
504
|
+
}), k("Compact Layout", () => {
|
|
505
|
+
r("should pass compactLayout prop to ResultsTable", async () => {
|
|
506
|
+
d.mockResolvedValueOnce({
|
|
507
|
+
ok: !0,
|
|
508
|
+
json: async () => p
|
|
509
|
+
}), i(
|
|
510
|
+
/* @__PURE__ */ a(
|
|
511
|
+
u,
|
|
512
|
+
{
|
|
513
|
+
compactLayout: !0,
|
|
514
|
+
baseApiUrl: s,
|
|
515
|
+
network: o
|
|
516
|
+
}
|
|
517
|
+
)
|
|
518
|
+
);
|
|
519
|
+
const t = e.getByTestId("input-zipcode"), n = e.getByTestId("action-button");
|
|
520
|
+
l.change(t, { target: { value: "90210" } }), l.click(n), await h(() => {
|
|
521
|
+
const m = e.getByTestId("results-table");
|
|
522
|
+
c(m).toHaveAttribute("data-compact", "true");
|
|
523
|
+
});
|
|
524
|
+
}), r("should apply compact class to results header", async () => {
|
|
525
|
+
d.mockResolvedValueOnce({
|
|
526
|
+
ok: !0,
|
|
527
|
+
json: async () => p
|
|
528
|
+
});
|
|
529
|
+
const { container: t } = i(
|
|
530
|
+
/* @__PURE__ */ a(
|
|
531
|
+
u,
|
|
532
|
+
{
|
|
533
|
+
compactLayout: !0,
|
|
534
|
+
baseApiUrl: s,
|
|
535
|
+
network: o
|
|
536
|
+
}
|
|
537
|
+
)
|
|
538
|
+
), n = e.getByTestId("input-zipcode"), m = e.getByTestId("action-button");
|
|
539
|
+
l.change(n, { target: { value: "90210" } }), l.click(m), await h(() => {
|
|
540
|
+
const g = t.querySelector(".results-table__header--compact");
|
|
541
|
+
c(g).toBeInTheDocument();
|
|
542
|
+
});
|
|
543
|
+
});
|
|
544
|
+
}), k("Edge Cases", () => {
|
|
545
|
+
r("should not show results when submitting empty form", async () => {
|
|
546
|
+
i(/* @__PURE__ */ a(u, { baseApiUrl: s, network: o }));
|
|
547
|
+
const t = e.getByTestId("action-button");
|
|
548
|
+
l.click(t), await h(() => {
|
|
549
|
+
c(e.queryByTestId("results-table")).not.toBeInTheDocument();
|
|
550
|
+
});
|
|
551
|
+
}), r("should handle special characters in network name", () => {
|
|
552
|
+
i(/* @__PURE__ */ a(u, { baseApiUrl: s, network: {
|
|
553
|
+
brand_name: "Test & Network's Channel",
|
|
554
|
+
slug: "test-network"
|
|
555
|
+
} })), c(e.getByText(/Test & Network's Channel Channel Search:/)).toBeInTheDocument();
|
|
556
|
+
}), r("should handle network with long name", () => {
|
|
557
|
+
i(/* @__PURE__ */ a(u, { baseApiUrl: s, network: {
|
|
558
|
+
brand_name: "Very Long Network Name That Might Wrap",
|
|
559
|
+
slug: "long-network"
|
|
560
|
+
} })), c(
|
|
561
|
+
e.getByText(/Very Long Network Name That Might Wrap Channel Search:/)
|
|
562
|
+
).toBeInTheDocument();
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
});
|