@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
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as i, Fragment as w } from "react/jsx-runtime";
|
|
2
2
|
import { classes as m } from "../../utils/helpers.js";
|
|
3
|
-
import '../../assets/GradientButton.css';const
|
|
3
|
+
import '../../assets/GradientButton.css';const e = {
|
|
4
4
|
"gradient-btn": "_gradient-btn_1nwnc_1",
|
|
5
5
|
"gradient-btn--small": "_gradient-btn--small_1nwnc_23",
|
|
6
6
|
"gradient-btn--large": "_gradient-btn--large_1nwnc_30",
|
|
@@ -9,58 +9,60 @@ import '../../assets/GradientButton.css';const a = {
|
|
|
9
9
|
"gradient-btn--info": "_gradient-btn--info_1nwnc_45",
|
|
10
10
|
"gradient-btn--danger": "_gradient-btn--danger_1nwnc_49"
|
|
11
11
|
};
|
|
12
|
-
function
|
|
13
|
-
type:
|
|
14
|
-
label:
|
|
15
|
-
onClick:
|
|
12
|
+
function h({
|
|
13
|
+
type: l = "button",
|
|
14
|
+
label: g = "",
|
|
15
|
+
onClick: $ = () => {
|
|
16
16
|
},
|
|
17
|
-
varient:
|
|
18
|
-
size:
|
|
19
|
-
classname:
|
|
20
|
-
href:
|
|
17
|
+
varient: a = "primary",
|
|
18
|
+
size: r = "regular",
|
|
19
|
+
classname: d = "",
|
|
20
|
+
href: _ = "",
|
|
21
21
|
gradientStartColor: n = "",
|
|
22
22
|
gradientEndColor: t = "",
|
|
23
|
-
|
|
23
|
+
hoverGradientStartColor: p = "",
|
|
24
|
+
hoverGradientEndColor: u = "",
|
|
25
|
+
...b
|
|
24
26
|
}) {
|
|
25
|
-
const
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
+
const c = a === "" ? "" : `gradient-btn--${a}`, s = r === "" ? "" : `gradient-btn--${r}`;
|
|
28
|
+
return /* @__PURE__ */ i(w, { children: _ === "" ? /* @__PURE__ */ i(
|
|
27
29
|
"button",
|
|
28
30
|
{
|
|
29
31
|
className: m([
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
d,
|
|
33
|
+
e["gradient-btn"],
|
|
32
34
|
"gradient-btn",
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
a === "" ? "" : e[c],
|
|
36
|
+
r === "" ? "" : e[s]
|
|
35
37
|
]),
|
|
36
38
|
style: n !== "" && t !== "" ? {
|
|
37
39
|
"--gradient": `linear-gradient(180deg, ${t}, ${n}, ${n},${t})`
|
|
38
40
|
} : {},
|
|
39
|
-
type:
|
|
40
|
-
onClick:
|
|
41
|
-
...
|
|
42
|
-
children:
|
|
41
|
+
type: l,
|
|
42
|
+
onClick: $,
|
|
43
|
+
...b,
|
|
44
|
+
children: g
|
|
43
45
|
}
|
|
44
|
-
) : /* @__PURE__ */
|
|
46
|
+
) : /* @__PURE__ */ i(
|
|
45
47
|
"a",
|
|
46
48
|
{
|
|
47
49
|
className: m([
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
d,
|
|
51
|
+
e["gradient-btn"],
|
|
50
52
|
"gradient-btn",
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
a === "" ? "" : e[c],
|
|
54
|
+
r === "" ? "" : e[s]
|
|
53
55
|
]),
|
|
54
|
-
href:
|
|
56
|
+
href: _,
|
|
55
57
|
style: n !== "" && t !== "" ? {
|
|
56
58
|
"--gradient": `linear-gradient(180deg, ${t}, ${n}, ${n},${t})`
|
|
57
59
|
} : {},
|
|
58
|
-
...
|
|
59
|
-
children:
|
|
60
|
+
...b,
|
|
61
|
+
children: g
|
|
60
62
|
}
|
|
61
63
|
) });
|
|
62
64
|
}
|
|
63
65
|
export {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
h as GradientButton,
|
|
67
|
+
h as default
|
|
66
68
|
};
|
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { v as u, d as i, b as c, a as g, i as l, r, s as o, g as e } from "../../react.esm-DLSrfVwM.mjs";
|
|
3
|
+
import { u as b } from "../../index-BUN4jQ3m.mjs";
|
|
4
|
+
import { GradientButton as n } from "./GradientButton.js";
|
|
5
|
+
u.mock("../../utils/helpers", () => ({
|
|
6
|
+
classes: (t) => t.filter(Boolean).join(" ")
|
|
7
|
+
}));
|
|
8
|
+
u.mock("./GradientButton.module.scss", () => ({
|
|
9
|
+
default: {
|
|
10
|
+
"gradient-btn": "gradient-btn-module",
|
|
11
|
+
"gradient-btn--primary": "gradient-btn--primary-module",
|
|
12
|
+
"gradient-btn--secondary": "gradient-btn--secondary-module",
|
|
13
|
+
"gradient-btn--tertiary": "gradient-btn--tertiary-module",
|
|
14
|
+
"gradient-btn--small": "gradient-btn--small-module",
|
|
15
|
+
"gradient-btn--regular": "gradient-btn--regular-module",
|
|
16
|
+
"gradient-btn--large": "gradient-btn--large-module"
|
|
17
|
+
}
|
|
18
|
+
}));
|
|
19
|
+
i("GradientButton", () => {
|
|
20
|
+
c(() => {
|
|
21
|
+
u.clearAllMocks();
|
|
22
|
+
}), g(() => {
|
|
23
|
+
u.restoreAllMocks();
|
|
24
|
+
}), i("Basic Rendering", () => {
|
|
25
|
+
l("should render a button by default when no href is provided", () => {
|
|
26
|
+
r(/* @__PURE__ */ a(n, { label: "Click me" }));
|
|
27
|
+
const t = o.getByRole("button", { name: "Click me" });
|
|
28
|
+
e(t).toBeInTheDocument(), e(t.tagName).toBe("BUTTON");
|
|
29
|
+
}), l("should render an anchor when href is provided", () => {
|
|
30
|
+
r(/* @__PURE__ */ a(n, { href: "https://example.com", label: "Click me" }));
|
|
31
|
+
const t = o.getByRole("link", { name: "Click me" });
|
|
32
|
+
e(t).toBeInTheDocument(), e(t.tagName).toBe("A"), e(t).toHaveAttribute("href", "https://example.com");
|
|
33
|
+
}), l("should render button when href is empty string", () => {
|
|
34
|
+
r(/* @__PURE__ */ a(n, { href: "", label: "Click me" }));
|
|
35
|
+
const t = o.getByRole("button", { name: "Click me" });
|
|
36
|
+
e(t).toBeInTheDocument();
|
|
37
|
+
}), l("should display the label text", () => {
|
|
38
|
+
r(/* @__PURE__ */ a(n, { label: "Test Label" })), e(o.getByText("Test Label")).toBeInTheDocument();
|
|
39
|
+
});
|
|
40
|
+
}), i("Button Type Attribute", () => {
|
|
41
|
+
l('should use "button" type by default', () => {
|
|
42
|
+
r(/* @__PURE__ */ a(n, { label: "Click me" }));
|
|
43
|
+
const t = o.getByRole("button");
|
|
44
|
+
e(t).toHaveAttribute("type", "button");
|
|
45
|
+
}), l('should accept "submit" type', () => {
|
|
46
|
+
r(/* @__PURE__ */ a(n, { label: "Submit", type: "submit" }));
|
|
47
|
+
const t = o.getByRole("button");
|
|
48
|
+
e(t).toHaveAttribute("type", "submit");
|
|
49
|
+
}), l('should accept "reset" type', () => {
|
|
50
|
+
r(/* @__PURE__ */ a(n, { label: "Reset", type: "reset" }));
|
|
51
|
+
const t = o.getByRole("button");
|
|
52
|
+
e(t).toHaveAttribute("type", "reset");
|
|
53
|
+
}), l("should not apply type attribute to anchor element", () => {
|
|
54
|
+
r(/* @__PURE__ */ a(n, { href: "https://example.com", label: "Link", type: "submit" }));
|
|
55
|
+
const t = o.getByRole("link");
|
|
56
|
+
e(t).not.toHaveAttribute("type");
|
|
57
|
+
});
|
|
58
|
+
}), i("Click Handler", () => {
|
|
59
|
+
l("should call onClick when button is clicked", async () => {
|
|
60
|
+
const t = b.setup(), s = u.fn();
|
|
61
|
+
r(/* @__PURE__ */ a(n, { label: "Click me", onClick: s }));
|
|
62
|
+
const d = o.getByRole("button");
|
|
63
|
+
await t.click(d), e(s).toHaveBeenCalledTimes(1);
|
|
64
|
+
}), l("should receive event object in onClick handler", async () => {
|
|
65
|
+
const t = b.setup(), s = u.fn();
|
|
66
|
+
r(/* @__PURE__ */ a(n, { label: "Click me", onClick: s }));
|
|
67
|
+
const d = o.getByRole("button");
|
|
68
|
+
await t.click(d), e(s).toHaveBeenCalledWith(e.objectContaining({
|
|
69
|
+
type: "click"
|
|
70
|
+
}));
|
|
71
|
+
}), l("should not call onClick for anchor elements", async () => {
|
|
72
|
+
const t = b.setup(), s = u.fn();
|
|
73
|
+
r(/* @__PURE__ */ a(n, { href: "#test", label: "Link", onClick: s }));
|
|
74
|
+
const d = o.getByRole("link");
|
|
75
|
+
await t.click(d), e(s).not.toHaveBeenCalled();
|
|
76
|
+
}), l("should use default noop function when onClick is not provided", async () => {
|
|
77
|
+
const t = b.setup();
|
|
78
|
+
r(/* @__PURE__ */ a(n, { label: "Click me" }));
|
|
79
|
+
const s = o.getByRole("button");
|
|
80
|
+
await t.click(s), e(s).toBeInTheDocument();
|
|
81
|
+
});
|
|
82
|
+
}), i("Variant Classes", () => {
|
|
83
|
+
l("should apply primary variant class by default", () => {
|
|
84
|
+
r(/* @__PURE__ */ a(n, { label: "Button" }));
|
|
85
|
+
const t = o.getByRole("button");
|
|
86
|
+
e(t).toHaveClass("gradient-btn--primary-module");
|
|
87
|
+
}), l("should apply secondary variant class", () => {
|
|
88
|
+
r(/* @__PURE__ */ a(n, { label: "Button", varient: "secondary" }));
|
|
89
|
+
const t = o.getByRole("button");
|
|
90
|
+
e(t).toHaveClass("gradient-btn--secondary-module");
|
|
91
|
+
}), l("should apply tertiary variant class", () => {
|
|
92
|
+
r(/* @__PURE__ */ a(n, { label: "Button", varient: "tertiary" }));
|
|
93
|
+
const t = o.getByRole("button");
|
|
94
|
+
e(t).toHaveClass("gradient-btn--tertiary-module");
|
|
95
|
+
}), l("should not apply variant class when empty string", () => {
|
|
96
|
+
r(/* @__PURE__ */ a(n, { label: "Button", varient: "" }));
|
|
97
|
+
const t = o.getByRole("button");
|
|
98
|
+
e(t).not.toHaveClass("gradient-btn--primary-module"), e(t).not.toHaveClass("gradient-btn--secondary-module"), e(t).not.toHaveClass("gradient-btn--tertiary-module");
|
|
99
|
+
}), l("should apply variant class to anchor element", () => {
|
|
100
|
+
r(/* @__PURE__ */ a(n, { href: "https://example.com", label: "Link", varient: "secondary" }));
|
|
101
|
+
const t = o.getByRole("link");
|
|
102
|
+
e(t).toHaveClass("gradient-btn--secondary-module");
|
|
103
|
+
});
|
|
104
|
+
}), i("Size Classes", () => {
|
|
105
|
+
l("should apply regular size class by default", () => {
|
|
106
|
+
r(/* @__PURE__ */ a(n, { label: "Button" }));
|
|
107
|
+
const t = o.getByRole("button");
|
|
108
|
+
e(t).toHaveClass("gradient-btn--regular-module");
|
|
109
|
+
}), l("should apply small size class", () => {
|
|
110
|
+
r(/* @__PURE__ */ a(n, { label: "Button", size: "small" }));
|
|
111
|
+
const t = o.getByRole("button");
|
|
112
|
+
e(t).toHaveClass("gradient-btn--small-module");
|
|
113
|
+
}), l("should apply large size class", () => {
|
|
114
|
+
r(/* @__PURE__ */ a(n, { label: "Button", size: "large" }));
|
|
115
|
+
const t = o.getByRole("button");
|
|
116
|
+
e(t).toHaveClass("gradient-btn--large-module");
|
|
117
|
+
}), l("should not apply size class when empty string", () => {
|
|
118
|
+
r(/* @__PURE__ */ a(n, { label: "Button", size: "" }));
|
|
119
|
+
const t = o.getByRole("button");
|
|
120
|
+
e(t).not.toHaveClass("gradient-btn--small-module"), e(t).not.toHaveClass("gradient-btn--regular-module"), e(t).not.toHaveClass("gradient-btn--large-module");
|
|
121
|
+
}), l("should apply size class to anchor element", () => {
|
|
122
|
+
r(/* @__PURE__ */ a(n, { href: "https://example.com", label: "Link", size: "large" }));
|
|
123
|
+
const t = o.getByRole("link");
|
|
124
|
+
e(t).toHaveClass("gradient-btn--large-module");
|
|
125
|
+
});
|
|
126
|
+
}), i("Custom Classes", () => {
|
|
127
|
+
l("should apply base classes to button", () => {
|
|
128
|
+
r(/* @__PURE__ */ a(n, { label: "Button" }));
|
|
129
|
+
const t = o.getByRole("button");
|
|
130
|
+
e(t).toHaveClass("gradient-btn-module"), e(t).toHaveClass("gradient-btn");
|
|
131
|
+
}), l("should apply custom classname to button", () => {
|
|
132
|
+
r(/* @__PURE__ */ a(n, { classname: "custom-class", label: "Button" }));
|
|
133
|
+
const t = o.getByRole("button");
|
|
134
|
+
e(t).toHaveClass("custom-class");
|
|
135
|
+
}), l("should apply custom classname to anchor", () => {
|
|
136
|
+
r(/* @__PURE__ */ a(n, { classname: "custom-link", href: "https://example.com", label: "Link" }));
|
|
137
|
+
const t = o.getByRole("link");
|
|
138
|
+
e(t).toHaveClass("custom-link");
|
|
139
|
+
}), l("should combine multiple classes correctly", () => {
|
|
140
|
+
r(
|
|
141
|
+
/* @__PURE__ */ a(
|
|
142
|
+
n,
|
|
143
|
+
{
|
|
144
|
+
classname: "custom-class",
|
|
145
|
+
label: "Button",
|
|
146
|
+
size: "large",
|
|
147
|
+
varient: "secondary"
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
);
|
|
151
|
+
const t = o.getByRole("button");
|
|
152
|
+
e(t).toHaveClass("custom-class"), e(t).toHaveClass("gradient-btn-module"), e(t).toHaveClass("gradient-btn"), e(t).toHaveClass("gradient-btn--secondary-module"), e(t).toHaveClass("gradient-btn--large-module");
|
|
153
|
+
});
|
|
154
|
+
}), i("Custom Gradient Styles", () => {
|
|
155
|
+
l("should apply custom gradient when both colors are provided on button", () => {
|
|
156
|
+
r(
|
|
157
|
+
/* @__PURE__ */ a(
|
|
158
|
+
n,
|
|
159
|
+
{
|
|
160
|
+
gradientEndColor: "#00ff00",
|
|
161
|
+
gradientStartColor: "#ff0000",
|
|
162
|
+
label: "Button"
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
);
|
|
166
|
+
const t = o.getByRole("button");
|
|
167
|
+
e(t).toHaveStyle({
|
|
168
|
+
"--gradient": "linear-gradient(180deg, #00ff00, #ff0000, #ff0000,#00ff00)"
|
|
169
|
+
});
|
|
170
|
+
}), l("should apply custom gradient when both colors are provided on anchor", () => {
|
|
171
|
+
r(
|
|
172
|
+
/* @__PURE__ */ a(
|
|
173
|
+
n,
|
|
174
|
+
{
|
|
175
|
+
gradientEndColor: "#00ff00",
|
|
176
|
+
gradientStartColor: "#ff0000",
|
|
177
|
+
href: "https://example.com",
|
|
178
|
+
label: "Link"
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
);
|
|
182
|
+
const t = o.getByRole("link");
|
|
183
|
+
e(t).toHaveStyle({
|
|
184
|
+
"--gradient": "linear-gradient(180deg, #00ff00, #ff0000, #ff0000,#00ff00)"
|
|
185
|
+
});
|
|
186
|
+
}), l("should not apply gradient when only start color is provided", () => {
|
|
187
|
+
r(
|
|
188
|
+
/* @__PURE__ */ a(
|
|
189
|
+
n,
|
|
190
|
+
{
|
|
191
|
+
gradientStartColor: "#ff0000",
|
|
192
|
+
label: "Button"
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
);
|
|
196
|
+
const t = o.getByRole("button");
|
|
197
|
+
e(t.getAttribute("style")).toBeNull();
|
|
198
|
+
}), l("should not apply gradient when only end color is provided", () => {
|
|
199
|
+
r(
|
|
200
|
+
/* @__PURE__ */ a(
|
|
201
|
+
n,
|
|
202
|
+
{
|
|
203
|
+
gradientEndColor: "#00ff00",
|
|
204
|
+
label: "Button"
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
);
|
|
208
|
+
const t = o.getByRole("button");
|
|
209
|
+
e(t.getAttribute("style")).toBeNull();
|
|
210
|
+
}), l("should not apply gradient when both colors are empty strings", () => {
|
|
211
|
+
r(
|
|
212
|
+
/* @__PURE__ */ a(
|
|
213
|
+
n,
|
|
214
|
+
{
|
|
215
|
+
gradientEndColor: "",
|
|
216
|
+
gradientStartColor: "",
|
|
217
|
+
label: "Button"
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
);
|
|
221
|
+
const t = o.getByRole("button");
|
|
222
|
+
e(t.getAttribute("style")).toBeNull();
|
|
223
|
+
}), l("should use gradient color order correctly (end, start, start, end)", () => {
|
|
224
|
+
r(
|
|
225
|
+
/* @__PURE__ */ a(
|
|
226
|
+
n,
|
|
227
|
+
{
|
|
228
|
+
gradientEndColor: "red",
|
|
229
|
+
gradientStartColor: "blue",
|
|
230
|
+
label: "Button"
|
|
231
|
+
}
|
|
232
|
+
)
|
|
233
|
+
);
|
|
234
|
+
const s = o.getByRole("button").getAttribute("style");
|
|
235
|
+
e(s).toContain("linear-gradient(180deg, red, blue, blue,red)");
|
|
236
|
+
});
|
|
237
|
+
}), i("Href Attribute", () => {
|
|
238
|
+
l("should apply href to anchor element", () => {
|
|
239
|
+
r(/* @__PURE__ */ a(n, { href: "https://example.com", label: "Link" }));
|
|
240
|
+
const t = o.getByRole("link");
|
|
241
|
+
e(t).toHaveAttribute("href", "https://example.com");
|
|
242
|
+
}), l("should handle relative URLs", () => {
|
|
243
|
+
r(/* @__PURE__ */ a(n, { href: "/about", label: "Link" }));
|
|
244
|
+
const t = o.getByRole("link");
|
|
245
|
+
e(t).toHaveAttribute("href", "/about");
|
|
246
|
+
}), l("should handle anchor links", () => {
|
|
247
|
+
r(/* @__PURE__ */ a(n, { href: "#section", label: "Link" }));
|
|
248
|
+
const t = o.getByRole("link");
|
|
249
|
+
e(t).toHaveAttribute("href", "#section");
|
|
250
|
+
});
|
|
251
|
+
}), i("Spread Attributes", () => {
|
|
252
|
+
l("should pass additional attributes to button", () => {
|
|
253
|
+
r(
|
|
254
|
+
/* @__PURE__ */ a(
|
|
255
|
+
n,
|
|
256
|
+
{
|
|
257
|
+
"aria-label": "Custom aria label",
|
|
258
|
+
"data-testid": "custom-button",
|
|
259
|
+
label: "Button"
|
|
260
|
+
}
|
|
261
|
+
)
|
|
262
|
+
);
|
|
263
|
+
const t = o.getByTestId("custom-button");
|
|
264
|
+
e(t).toHaveAttribute("aria-label", "Custom aria label");
|
|
265
|
+
}), l("should pass additional attributes to anchor", () => {
|
|
266
|
+
r(
|
|
267
|
+
/* @__PURE__ */ a(
|
|
268
|
+
n,
|
|
269
|
+
{
|
|
270
|
+
"data-testid": "custom-link",
|
|
271
|
+
href: "https://example.com",
|
|
272
|
+
label: "Link",
|
|
273
|
+
rel: "noopener noreferrer",
|
|
274
|
+
target: "_blank"
|
|
275
|
+
}
|
|
276
|
+
)
|
|
277
|
+
);
|
|
278
|
+
const t = o.getByTestId("custom-link");
|
|
279
|
+
e(t).toHaveAttribute("target", "_blank"), e(t).toHaveAttribute("rel", "noopener noreferrer");
|
|
280
|
+
}), l("should handle disabled attribute on button", () => {
|
|
281
|
+
r(/* @__PURE__ */ a(n, { disabled: !0, label: "Button" }));
|
|
282
|
+
const t = o.getByRole("button");
|
|
283
|
+
e(t).toBeDisabled();
|
|
284
|
+
}), l("should handle aria attributes", () => {
|
|
285
|
+
r(
|
|
286
|
+
/* @__PURE__ */ a(
|
|
287
|
+
n,
|
|
288
|
+
{
|
|
289
|
+
"aria-describedby": "description",
|
|
290
|
+
"aria-pressed": "true",
|
|
291
|
+
label: "Button"
|
|
292
|
+
}
|
|
293
|
+
)
|
|
294
|
+
);
|
|
295
|
+
const t = o.getByRole("button");
|
|
296
|
+
e(t).toHaveAttribute("aria-describedby", "description"), e(t).toHaveAttribute("aria-pressed", "true");
|
|
297
|
+
}), l("should handle data attributes", () => {
|
|
298
|
+
r(
|
|
299
|
+
/* @__PURE__ */ a(
|
|
300
|
+
n,
|
|
301
|
+
{
|
|
302
|
+
"data-category": "primary",
|
|
303
|
+
"data-index": 0,
|
|
304
|
+
label: "Button"
|
|
305
|
+
}
|
|
306
|
+
)
|
|
307
|
+
);
|
|
308
|
+
const t = o.getByRole("button");
|
|
309
|
+
e(t).toHaveAttribute("data-category", "primary"), e(t).toHaveAttribute("data-index", "0");
|
|
310
|
+
});
|
|
311
|
+
}), i("Default Props", () => {
|
|
312
|
+
l("should use all default props when none are provided", () => {
|
|
313
|
+
r(/* @__PURE__ */ a(n, {}));
|
|
314
|
+
const t = o.getByRole("button");
|
|
315
|
+
e(t).toHaveAttribute("type", "button"), e(t).toHaveClass("gradient-btn--primary-module"), e(t).toHaveClass("gradient-btn--regular-module"), e(t).toHaveTextContent("");
|
|
316
|
+
}), l("should use empty string label by default", () => {
|
|
317
|
+
r(/* @__PURE__ */ a(n, {}));
|
|
318
|
+
const t = o.getByRole("button");
|
|
319
|
+
e(t).toHaveTextContent("");
|
|
320
|
+
}), l("should use primary variant by default", () => {
|
|
321
|
+
r(/* @__PURE__ */ a(n, { label: "Button" }));
|
|
322
|
+
const t = o.getByRole("button");
|
|
323
|
+
e(t).toHaveClass("gradient-btn--primary-module");
|
|
324
|
+
}), l("should use regular size by default", () => {
|
|
325
|
+
r(/* @__PURE__ */ a(n, { label: "Button" }));
|
|
326
|
+
const t = o.getByRole("button");
|
|
327
|
+
e(t).toHaveClass("gradient-btn--regular-module");
|
|
328
|
+
});
|
|
329
|
+
}), i("Edge Cases", () => {
|
|
330
|
+
l("should handle empty label", () => {
|
|
331
|
+
r(/* @__PURE__ */ a(n, { label: "" }));
|
|
332
|
+
const t = o.getByRole("button");
|
|
333
|
+
e(t).toHaveTextContent("");
|
|
334
|
+
}), l("should handle special characters in label", () => {
|
|
335
|
+
r(/* @__PURE__ */ a(n, { label: "Click & Submit!" }));
|
|
336
|
+
const t = o.getByRole("button");
|
|
337
|
+
e(t).toHaveTextContent("Click & Submit!");
|
|
338
|
+
}), l("should handle unicode characters in label", () => {
|
|
339
|
+
r(/* @__PURE__ */ a(n, { label: "🚀 Launch" }));
|
|
340
|
+
const t = o.getByRole("button");
|
|
341
|
+
e(t).toHaveTextContent("🚀 Launch");
|
|
342
|
+
}), l("should handle very long href", () => {
|
|
343
|
+
const t = "https://example.com/" + "a".repeat(1e3);
|
|
344
|
+
r(/* @__PURE__ */ a(n, { href: t, label: "Link" }));
|
|
345
|
+
const s = o.getByRole("link");
|
|
346
|
+
e(s).toHaveAttribute("href", t);
|
|
347
|
+
}), l("should handle complex gradient colors with rgba", () => {
|
|
348
|
+
r(
|
|
349
|
+
/* @__PURE__ */ a(
|
|
350
|
+
n,
|
|
351
|
+
{
|
|
352
|
+
gradientEndColor: "rgba(0, 255, 0, 0.8)",
|
|
353
|
+
gradientStartColor: "rgba(255, 0, 0, 0.5)",
|
|
354
|
+
label: "Button"
|
|
355
|
+
}
|
|
356
|
+
)
|
|
357
|
+
);
|
|
358
|
+
const t = o.getByRole("button");
|
|
359
|
+
e(t).toHaveStyle({
|
|
360
|
+
"--gradient": "linear-gradient(180deg, rgba(0, 255, 0, 0.8), rgba(255, 0, 0, 0.5), rgba(255, 0, 0, 0.5),rgba(0, 255, 0, 0.8))"
|
|
361
|
+
});
|
|
362
|
+
}), l("should handle all empty string optional props", () => {
|
|
363
|
+
r(
|
|
364
|
+
/* @__PURE__ */ a(
|
|
365
|
+
n,
|
|
366
|
+
{
|
|
367
|
+
classname: "",
|
|
368
|
+
gradientEndColor: "",
|
|
369
|
+
gradientStartColor: "",
|
|
370
|
+
href: "",
|
|
371
|
+
label: "",
|
|
372
|
+
size: "",
|
|
373
|
+
varient: ""
|
|
374
|
+
}
|
|
375
|
+
)
|
|
376
|
+
);
|
|
377
|
+
const t = o.getByRole("button");
|
|
378
|
+
e(t).toBeInTheDocument();
|
|
379
|
+
});
|
|
380
|
+
}), i("Integration", () => {
|
|
381
|
+
l("should render complete button with all features", () => {
|
|
382
|
+
const t = u.fn();
|
|
383
|
+
r(
|
|
384
|
+
/* @__PURE__ */ a(
|
|
385
|
+
n,
|
|
386
|
+
{
|
|
387
|
+
"aria-label": "Submit contact form",
|
|
388
|
+
classname: "form-button",
|
|
389
|
+
"data-form-id": "contact",
|
|
390
|
+
gradientEndColor: "#4ecdc4",
|
|
391
|
+
gradientStartColor: "#ff6b6b",
|
|
392
|
+
label: "Submit Form",
|
|
393
|
+
size: "large",
|
|
394
|
+
type: "submit",
|
|
395
|
+
varient: "secondary",
|
|
396
|
+
onClick: t
|
|
397
|
+
}
|
|
398
|
+
)
|
|
399
|
+
);
|
|
400
|
+
const s = o.getByRole("button", { name: "Submit contact form" });
|
|
401
|
+
e(s).toHaveAttribute("type", "submit"), e(s).toHaveTextContent("Submit Form"), e(s).toHaveClass("form-button"), e(s).toHaveClass("gradient-btn--secondary-module"), e(s).toHaveClass("gradient-btn--large-module"), e(s).toHaveAttribute("data-form-id", "contact"), e(s).toHaveStyle({
|
|
402
|
+
"--gradient": "linear-gradient(180deg, #4ecdc4, #ff6b6b, #ff6b6b,#4ecdc4)"
|
|
403
|
+
});
|
|
404
|
+
}), l("should render complete anchor with all features", () => {
|
|
405
|
+
r(
|
|
406
|
+
/* @__PURE__ */ a(
|
|
407
|
+
n,
|
|
408
|
+
{
|
|
409
|
+
classname: "external-link",
|
|
410
|
+
"data-analytics": "click-external",
|
|
411
|
+
gradientEndColor: "#764ba2",
|
|
412
|
+
gradientStartColor: "#667eea",
|
|
413
|
+
href: "https://example.com",
|
|
414
|
+
label: "External Link",
|
|
415
|
+
rel: "noopener noreferrer",
|
|
416
|
+
size: "small",
|
|
417
|
+
target: "_blank",
|
|
418
|
+
varient: "tertiary"
|
|
419
|
+
}
|
|
420
|
+
)
|
|
421
|
+
);
|
|
422
|
+
const t = o.getByRole("link", { name: "External Link" });
|
|
423
|
+
e(t).toHaveAttribute("href", "https://example.com"), e(t).toHaveClass("external-link"), e(t).toHaveClass("gradient-btn--tertiary-module"), e(t).toHaveClass("gradient-btn--small-module"), e(t).toHaveAttribute("target", "_blank"), e(t).toHaveAttribute("rel", "noopener noreferrer"), e(t).toHaveAttribute("data-analytics", "click-external"), e(t).toHaveStyle({
|
|
424
|
+
"--gradient": "linear-gradient(180deg, #764ba2, #667eea, #667eea,#764ba2)"
|
|
425
|
+
});
|
|
426
|
+
}), l("should switch between button and anchor when href changes", () => {
|
|
427
|
+
const { rerender: t } = r(/* @__PURE__ */ a(n, { label: "Element" }));
|
|
428
|
+
e(o.getByRole("button")).toBeInTheDocument(), t(/* @__PURE__ */ a(n, { href: "https://example.com", label: "Element" })), e(o.queryByRole("button")).not.toBeInTheDocument(), e(o.getByRole("link")).toBeInTheDocument();
|
|
429
|
+
});
|
|
430
|
+
}), i("Unused Props", () => {
|
|
431
|
+
l("should accept hoverGradientStartColor prop without error", () => {
|
|
432
|
+
r(
|
|
433
|
+
/* @__PURE__ */ a(
|
|
434
|
+
n,
|
|
435
|
+
{
|
|
436
|
+
hoverGradientStartColor: "#ff0000",
|
|
437
|
+
label: "Button"
|
|
438
|
+
}
|
|
439
|
+
)
|
|
440
|
+
);
|
|
441
|
+
const t = o.getByRole("button");
|
|
442
|
+
e(t).toBeInTheDocument();
|
|
443
|
+
}), l("should accept hoverGradientEndColor prop without error", () => {
|
|
444
|
+
r(
|
|
445
|
+
/* @__PURE__ */ a(
|
|
446
|
+
n,
|
|
447
|
+
{
|
|
448
|
+
hoverGradientEndColor: "#00ff00",
|
|
449
|
+
label: "Button"
|
|
450
|
+
}
|
|
451
|
+
)
|
|
452
|
+
);
|
|
453
|
+
const t = o.getByRole("button");
|
|
454
|
+
e(t).toBeInTheDocument();
|
|
455
|
+
});
|
|
456
|
+
});
|
|
457
|
+
});
|