@codeandfunction/callaloo 4.9.4 → 4.9.5
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/callaloo.global.js +1 -1
- package/dist/chunks/CLA11yButton.vue_vue_type_style_index_0_lang-BHF3fJsf.js +2 -0
- package/dist/chunks/CLButton.vue_vue_type_style_index_0_lang-3vGTMU-k.js +2 -0
- package/dist/chunks/CLCalendar.vue_vue_type_style_index_0_lang-BAfGE35e.js +2 -0
- package/dist/chunks/CLCard.vue_vue_type_style_index_0_lang-DPQxSLkQ.js +2 -0
- package/dist/chunks/CLFormCharCounter.vue_vue_type_style_index_0_lang-BYHbqaf0.js +2 -0
- package/dist/chunks/CLFormLabel.vue_vue_type_script_setup_true_lang-BPwFZq94.js +1 -0
- package/dist/chunks/CLHeading.vue_vue_type_style_index_0_lang-CsmrsD6c.js +2 -0
- package/dist/chunks/CLIcon.vue_vue_type_style_index_0_lang-yF4CdZbV.js +2 -0
- package/dist/chunks/CLInputMessages.vue_vue_type_style_index_0_lang-DCByJ7MB.js +2 -0
- package/dist/chunks/CLLink.vue_vue_type_style_index_0_lang-CCyY39MJ.js +2 -0
- package/dist/chunks/CLModal.vue_vue_type_style_index_0_lang-CwdYGfO9.js +2 -0
- package/dist/chunks/CLNavLink.vue_vue_type_script_setup_true_lang-Ds2aJNK9.js +1 -0
- package/dist/chunks/CLPill.vue_vue_type_style_index_0_lang-BVsLNnfE.js +2 -0
- package/dist/chunks/CLSkeleton.vue_vue_type_style_index_0_lang-BmjT9fQ_.js +2 -0
- package/dist/chunks/CLSpinner.vue_vue_type_style_index_0_lang-DgZLt9T1.js +2 -0
- package/dist/chunks/CLText.vue_vue_type_style_index_0_lang-CMXJdE-D.js +2 -0
- package/dist/chunks/CLToast.vue_vue_type_style_index_0_lang-BIehrtqC.js +2 -0
- package/dist/chunks/context-CRxE5KWX.js +1 -0
- package/dist/chunks/context-JmPivI9V.js +1 -0
- package/dist/chunks/floating-ui.vue-C0JWy0Dz.js +1 -0
- package/dist/chunks/helper-C542dSLs.js +1 -0
- package/dist/chunks/icons-6SVrmx7c.js +1 -0
- package/dist/chunks/utils-C1iUBPIL.js +1 -0
- package/dist/chunks/utils-CCWSWRuR.js +1 -0
- package/dist/chunks/utils-CYywa195.js +1 -0
- package/dist/chunks/utils-DVxwAjJ4.js +1 -0
- package/dist/chunks/utils-Dst7nzvj.js +1 -0
- package/dist/chunks/utils-MElq6rY3.js +1 -0
- package/dist/components/Buttons/CLA11yButton/CLA11yButton.js +1 -5
- package/dist/components/Buttons/CLButton/CLButton.js +1 -5
- package/dist/components/CLIcon/CLIcon.js +1 -5
- package/dist/components/CLTable/CLTable.js +1 -192
- package/dist/components/Containers/CLCard/CLCard.js +1 -5
- package/dist/components/Containers/CLCarousel/CLCarousel.js +1 -544
- package/dist/components/Containers/CLDisclosure/CLDisclosure.js +1 -139
- package/dist/components/Containers/CLDrawer/CLDrawer.js +1 -119
- package/dist/components/Form/CLCalendar/CLCalendar.js +1 -5
- package/dist/components/Form/CLCheckbox/CLCheckbox.js +1 -150
- package/dist/components/Form/CLInput/CLInput.js +1 -450
- package/dist/components/Form/CLInputDatePicker/CLInputDatePicker.js +1 -178
- package/dist/components/Form/CLRadioButton/CLRadioButton.js +1 -135
- package/dist/components/Form/CLSelect/CLSelect.js +1 -140
- package/dist/components/Form/CLTextArea/CLTextArea.js +1 -149
- package/dist/components/Indicators/CLBadge/CLBadge.js +1 -40
- package/dist/components/Indicators/CLBanner/CLBanner.js +1 -145
- package/dist/components/Indicators/CLPill/CLPill.js +1 -5
- package/dist/components/Indicators/CLProgress/CLProgress.js +1 -64
- package/dist/components/Loading/CLSkeleton/CLSkeleton.js +1 -5
- package/dist/components/Loading/CLSpinner/CLSpinner.js +1 -5
- package/dist/components/Modals/CLModal/CLModal.js +1 -5
- package/dist/components/Modals/CLModalDatePicker/CLModalDatePicker.js +1 -182
- package/dist/components/Navigation/CLLink/CLLink.js +1 -5
- package/dist/components/Navigation/CLNavLink/CLNavLink.js +1 -5
- package/dist/components/Navigation/CLNavSection/CLNavSection.js +1 -54
- package/dist/components/Popups/CLDropdownMenu/CLDropdownMenu.js +1 -150
- package/dist/components/Popups/CLToast/CLToast.js +1 -5
- package/dist/components/Providers/CLThemeProvider/CLThemeProvider.js +1 -8
- package/dist/components/Providers/CLToastProvider/CLToastProvider.js +1 -7
- package/dist/components/Typography/CLHeading/CLHeading.js +1 -5
- package/dist/components/Typography/CLText/CLText.js +1 -5
- package/dist/composables/useDateInputMask.js +1 -38
- package/dist/composables/useDatePicker.js +1 -140
- package/dist/composables/useDropdown.js +1 -49
- package/dist/composables/useElementSize.js +1 -73
- package/dist/composables/useEsc.js +1 -19
- package/dist/composables/useHasSlotContent.js +1 -14
- package/dist/composables/useTheme.js +1 -40
- package/dist/composables/useToast.js +1 -17
- package/dist/index.js +1 -30
- package/package.json +20 -20
- package/dist/chunks/CLA11yButton.vue_vue_type_style_index_0_lang-zGLnnSIW.js +0 -47
- package/dist/chunks/CLButton.vue_vue_type_style_index_0_lang-MvhnNzVW.js +0 -136
- package/dist/chunks/CLCalendar.vue_vue_type_style_index_0_lang-Bz1JdT1A.js +0 -163
- package/dist/chunks/CLCard.vue_vue_type_style_index_0_lang-Sre7UYZd.js +0 -263
- package/dist/chunks/CLFormCharCounter.vue_vue_type_style_index_0_lang-CJ4VrvmR.js +0 -39
- package/dist/chunks/CLFormLabel.vue_vue_type_script_setup_true_lang-CIQxM6aH.js +0 -46
- package/dist/chunks/CLHeading.vue_vue_type_style_index_0_lang-DH5oJc1C.js +0 -52
- package/dist/chunks/CLIcon.vue_vue_type_style_index_0_lang-Dhr2tI-g.js +0 -113
- package/dist/chunks/CLInputMessages.vue_vue_type_style_index_0_lang-DTWvAACK.js +0 -149
- package/dist/chunks/CLLink.vue_vue_type_style_index_0_lang-BXysZqLn.js +0 -69
- package/dist/chunks/CLModal.vue_vue_type_style_index_0_lang-BDyONfaQ.js +0 -176
- package/dist/chunks/CLNavLink.vue_vue_type_script_setup_true_lang-Dhnmfa9W.js +0 -44
- package/dist/chunks/CLPill.vue_vue_type_style_index_0_lang-BQim03ge.js +0 -94
- package/dist/chunks/CLSkeleton.vue_vue_type_style_index_0_lang-DduoX6Cu.js +0 -31
- package/dist/chunks/CLSpinner.vue_vue_type_style_index_0_lang-DlXqnsi8.js +0 -55
- package/dist/chunks/CLText.vue_vue_type_style_index_0_lang-B-L8ECJL.js +0 -48
- package/dist/chunks/CLThemeProvider.vue_vue_type_script_setup_true_lang-jaJYKZL8.js +0 -59
- package/dist/chunks/CLToast.vue_vue_type_style_index_0_lang-CzSDeL_X.js +0 -202
- package/dist/chunks/CLToastProvider.vue_vue_type_script_setup_true_lang-DkGK0H4Z.js +0 -35
- package/dist/chunks/context-CEvx70FY.js +0 -264
- package/dist/chunks/context-dkA4VoF7.js +0 -4
- package/dist/chunks/floating-ui.vue-Fx4CxKut.js +0 -1057
- package/dist/chunks/helper-qUkciePY.js +0 -81
- package/dist/chunks/icons-DllZKtC2.js +0 -4
- package/dist/chunks/magic-string.es-uPKorP4O.js +0 -663
- package/dist/chunks/utils-BfOa9ckr.js +0 -24
- package/dist/chunks/utils-BjZURPWx.js +0 -51
- package/dist/chunks/utils-C1xiySYN.js +0 -41
- package/dist/chunks/utils-D00IXMTR.js +0 -25
- package/dist/chunks/utils-eBt2zUZl.js +0 -17
- package/dist/chunks/utils-nD3K7jh9.js +0 -85
- package/dist/chunks/vue-test-utils.esm-bundler-BeQTU4qG.js +0 -18679
- package/dist/composables/useDatePicker.spec.js +0 -232
- package/dist/composables/useTheme.spec.js +0 -88
- package/dist/composables/useToast.spec.js +0 -45
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import '../assets/core.css';
|
|
2
|
-
import { nextTick as g, defineComponent as B, h as y, ref as D } from "vue";
|
|
3
|
-
import { d as s, b as f, a as m, i as n, m as c, g as e } from "../chunks/vue-test-utils.esm-bundler-BeQTU4qG.js";
|
|
4
|
-
import { useDatePicker as p } from "./useDatePicker.js";
|
|
5
|
-
s("useDatePicker", () => {
|
|
6
|
-
let u, t, l, d;
|
|
7
|
-
const i = (a, o) => B({
|
|
8
|
-
setup() {
|
|
9
|
-
return t = p({
|
|
10
|
-
appliedStart: a,
|
|
11
|
-
appliedEnd: o
|
|
12
|
-
}), () => y("div");
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
f(() => {
|
|
16
|
-
l = D(null), d = D(null);
|
|
17
|
-
}), m(() => {
|
|
18
|
-
u?.unmount();
|
|
19
|
-
}), s("weekDays", () => {
|
|
20
|
-
n("should return correct week day abbreviations", () => {
|
|
21
|
-
u = c(i()), e(t.weekDays).toEqual([
|
|
22
|
-
"Su",
|
|
23
|
-
"Mo",
|
|
24
|
-
"Tu",
|
|
25
|
-
"We",
|
|
26
|
-
"Th",
|
|
27
|
-
"Fr",
|
|
28
|
-
"Sa"
|
|
29
|
-
]);
|
|
30
|
-
});
|
|
31
|
-
}), s("date formatting functions", () => {
|
|
32
|
-
f(() => {
|
|
33
|
-
u = c(i());
|
|
34
|
-
}), s("formatDateToISO", () => {
|
|
35
|
-
n("should convert Date to ISO string (YYYY-MM-DD)", () => {
|
|
36
|
-
const a = new Date(2026, 0, 26), o = t.formatDateToISO(a);
|
|
37
|
-
e(o).toBe("2026-01-26");
|
|
38
|
-
}), n("should pad month and day with zeros", () => {
|
|
39
|
-
const a = new Date(2026, 0, 5), o = t.formatDateToISO(a);
|
|
40
|
-
e(o).toBe("2026-01-05");
|
|
41
|
-
}), n("should handle December correctly", () => {
|
|
42
|
-
const a = new Date(2026, 11, 31), o = t.formatDateToISO(a);
|
|
43
|
-
e(o).toBe("2026-12-31");
|
|
44
|
-
});
|
|
45
|
-
}), s("isoToLocalDate", () => {
|
|
46
|
-
n("should convert ISO string to Date", () => {
|
|
47
|
-
const o = t.isoToLocalDate("2026-01-26");
|
|
48
|
-
e(o).toBeInstanceOf(Date), e(o.getFullYear()).toBe(2026), e(o.getMonth()).toBe(0), e(o.getDate()).toBe(26);
|
|
49
|
-
});
|
|
50
|
-
}), s("formatHumanDate", () => {
|
|
51
|
-
n("should format to human-readable date", () => {
|
|
52
|
-
const o = t.formatHumanDate("2026-01-26");
|
|
53
|
-
e(o).toContain("Jan"), e(o).toContain("26"), e(o).toContain("2026");
|
|
54
|
-
});
|
|
55
|
-
}), s("formatLongDate", () => {
|
|
56
|
-
n("should format to long date with weekday", () => {
|
|
57
|
-
const o = t.formatLongDate("2026-01-26");
|
|
58
|
-
e(o).toContain("January"), e(o).toContain("26"), e(o).toContain("2026");
|
|
59
|
-
});
|
|
60
|
-
}), s("formatShortNoYear", () => {
|
|
61
|
-
n("should format to M/D format", () => {
|
|
62
|
-
const o = t.formatShortNoYear("2026-01-26");
|
|
63
|
-
e(o).toBe("1/26");
|
|
64
|
-
}), n("should handle double-digit months and days", () => {
|
|
65
|
-
const o = t.formatShortNoYear("2026-12-31");
|
|
66
|
-
e(o).toBe("12/31");
|
|
67
|
-
});
|
|
68
|
-
}), s("formatShortWithYear", () => {
|
|
69
|
-
n("should format to M/D/YY format", () => {
|
|
70
|
-
const o = t.formatShortWithYear("2026-01-26");
|
|
71
|
-
e(o).toBe("1/26/26");
|
|
72
|
-
}), n("should handle double-digit months and days", () => {
|
|
73
|
-
const o = t.formatShortWithYear("2026-12-31");
|
|
74
|
-
e(o).toBe("12/31/26");
|
|
75
|
-
}), n("should use last two digits of year", () => {
|
|
76
|
-
const o = t.formatShortWithYear("2025-01-26");
|
|
77
|
-
e(o).toBe("1/26/25");
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
}), s("calendar grid generation", () => {
|
|
81
|
-
f(() => {
|
|
82
|
-
u = c(i());
|
|
83
|
-
}), n("should generate correct 42-cell grid (6 weeks × 7 days)", () => {
|
|
84
|
-
const a = t.calendarGrid.value;
|
|
85
|
-
e(a).toHaveLength(42);
|
|
86
|
-
}), n("should correctly mark cells as isOutsideMonth", () => {
|
|
87
|
-
const a = t.calendarGrid.value, o = (/* @__PURE__ */ new Date()).getMonth(), r = (/* @__PURE__ */ new Date()).getFullYear(), h = a.find((v) => !v.isOutsideMonth);
|
|
88
|
-
if (e(h).toBeDefined(), h && h.date) {
|
|
89
|
-
const v = t.isoToLocalDate(h.date);
|
|
90
|
-
e(v.getMonth()).toBe(o), e(v.getFullYear()).toBe(r);
|
|
91
|
-
}
|
|
92
|
-
}), n("should include padding days from previous month", () => {
|
|
93
|
-
const o = t.calendarGrid.value[0];
|
|
94
|
-
o.isOutsideMonth && (e(o.day).toBeGreaterThan(0), e(o.date).toBeTruthy());
|
|
95
|
-
}), n("should include padding days from next month", () => {
|
|
96
|
-
const a = t.calendarGrid.value, o = a[a.length - 1];
|
|
97
|
-
o.isOutsideMonth && (e(o.day).toBeGreaterThan(0), e(o.date).toBeTruthy());
|
|
98
|
-
}), n("should handle month boundaries correctly", () => {
|
|
99
|
-
t.currentDate.value = new Date(2026, 0, 1);
|
|
100
|
-
const o = t.calendarGrid.value.filter(
|
|
101
|
-
(r) => !r.isOutsideMonth && r.date
|
|
102
|
-
);
|
|
103
|
-
e(o.length).toBe(31), o.forEach((r) => {
|
|
104
|
-
r.date && e(r.date).toMatch(/^2026-01-/);
|
|
105
|
-
});
|
|
106
|
-
}), n("should handle February in leap year correctly", () => {
|
|
107
|
-
t.currentDate.value = new Date(2024, 1, 1);
|
|
108
|
-
const o = t.calendarGrid.value.filter(
|
|
109
|
-
(r) => !r.isOutsideMonth && r.date
|
|
110
|
-
);
|
|
111
|
-
e(o.length).toBe(29);
|
|
112
|
-
}), n("should handle February in non-leap year correctly", () => {
|
|
113
|
-
t.currentDate.value = new Date(2025, 1, 1);
|
|
114
|
-
const o = t.calendarGrid.value.filter(
|
|
115
|
-
(r) => !r.isOutsideMonth && r.date
|
|
116
|
-
);
|
|
117
|
-
e(o.length).toBe(28);
|
|
118
|
-
});
|
|
119
|
-
}), s("month navigation", () => {
|
|
120
|
-
f(() => {
|
|
121
|
-
u = c(i());
|
|
122
|
-
}), n("handleNextMonth should advance to next month", () => {
|
|
123
|
-
const a = t.currentDate.value.getMonth(), o = t.currentDate.value.getFullYear();
|
|
124
|
-
t.handleNextMonth();
|
|
125
|
-
const r = t.currentDate.value.getMonth(), h = t.currentDate.value.getFullYear();
|
|
126
|
-
a === 11 ? (e(r).toBe(0), e(h).toBe(o + 1)) : (e(r).toBe(a + 1), e(h).toBe(o));
|
|
127
|
-
}), n("handlePrevMonth should go back to previous month", () => {
|
|
128
|
-
const a = t.currentDate.value.getMonth(), o = t.currentDate.value.getFullYear();
|
|
129
|
-
t.handlePrevMonth();
|
|
130
|
-
const r = t.currentDate.value.getMonth(), h = t.currentDate.value.getFullYear();
|
|
131
|
-
a === 0 ? (e(r).toBe(11), e(h).toBe(o - 1)) : (e(r).toBe(a - 1), e(h).toBe(o));
|
|
132
|
-
}), n("currentMonthLabel should update correctly after navigation", async () => {
|
|
133
|
-
const a = t.currentMonthLabel.value;
|
|
134
|
-
t.handleNextMonth(), await g();
|
|
135
|
-
const o = t.currentMonthLabel.value;
|
|
136
|
-
e(o).not.toBe(a), e(o).toContain(
|
|
137
|
-
t.currentDate.value.getFullYear().toString()
|
|
138
|
-
);
|
|
139
|
-
}), n("setCalendarMonthToAppliedOrToday should set to applied start date", () => {
|
|
140
|
-
l.value = "2026-06-15", u = c(i(l, d)), t.setCalendarMonthToAppliedOrToday();
|
|
141
|
-
const a = t.currentDate.value;
|
|
142
|
-
e(a.getFullYear()).toBe(2026), e(a.getMonth()).toBe(5), e(a.getDate()).toBe(1);
|
|
143
|
-
}), n("setCalendarMonthToAppliedOrToday should set to today when no applied start date", () => {
|
|
144
|
-
u = c(i());
|
|
145
|
-
const a = /* @__PURE__ */ new Date();
|
|
146
|
-
t.setCalendarMonthToAppliedOrToday();
|
|
147
|
-
const o = t.currentDate.value;
|
|
148
|
-
e(o.getFullYear()).toBe(a.getFullYear()), e(o.getMonth()).toBe(a.getMonth()), e(o.getDate()).toBe(1);
|
|
149
|
-
});
|
|
150
|
-
}), s("range selection logic", () => {
|
|
151
|
-
f(() => {
|
|
152
|
-
u = c(i(l, d));
|
|
153
|
-
}), n("initializeDraft should initialize draft from applied values", () => {
|
|
154
|
-
l.value = "2026-01-15", d.value = "2026-01-20", t.initializeDraft(), e(t.draftStart.value).toBe("2026-01-15"), e(t.draftEnd.value).toBe("2026-01-20");
|
|
155
|
-
}), n("initializeDraft should handle null applied values", () => {
|
|
156
|
-
l.value = null, d.value = null, t.initializeDraft(), e(t.draftStart.value).toBeNull(), e(t.draftEnd.value).toBeNull();
|
|
157
|
-
}), n("onDayClick should handle single date selection (sets start)", () => {
|
|
158
|
-
t.onDayClick("2026-01-15"), e(t.draftStart.value).toBe("2026-01-15"), e(t.draftEnd.value).toBeNull();
|
|
159
|
-
}), n("onDayClick should handle range selection (sets end after start)", () => {
|
|
160
|
-
t.onDayClick("2026-01-15"), t.onDayClick("2026-01-20"), e(t.draftStart.value).toBe("2026-01-15"), e(t.draftEnd.value).toBe("2026-01-20");
|
|
161
|
-
}), n("onDayClick should handle reverse selection (end before start swaps them)", () => {
|
|
162
|
-
t.onDayClick("2026-01-20"), t.onDayClick("2026-01-15"), e(t.draftStart.value).toBe("2026-01-15"), e(t.draftEnd.value).toBe("2026-01-20");
|
|
163
|
-
}), n("onDayClick should reset when both dates are set and new date clicked", () => {
|
|
164
|
-
t.onDayClick("2026-01-15"), t.onDayClick("2026-01-20"), t.onDayClick("2026-02-10"), e(t.draftStart.value).toBe("2026-02-10"), e(t.draftEnd.value).toBeNull();
|
|
165
|
-
}), n("onDayClick should do nothing when null is passed", () => {
|
|
166
|
-
const a = t.draftStart.value, o = t.draftEnd.value;
|
|
167
|
-
t.onDayClick(null), e(t.draftStart.value).toBe(a), e(t.draftEnd.value).toBe(o);
|
|
168
|
-
}), n("isDraftStart should correctly identify start date", () => {
|
|
169
|
-
t.draftStart.value = "2026-01-15", e(t.isDraftStart("2026-01-15")).toBe(!0), e(t.isDraftStart("2026-01-20")).toBe(!1);
|
|
170
|
-
}), n("isDraftEnd should correctly identify end date", () => {
|
|
171
|
-
t.draftEnd.value = "2026-01-20", e(t.isDraftEnd("2026-01-20")).toBe(!0), e(t.isDraftEnd("2026-01-15")).toBe(!1);
|
|
172
|
-
}), n("isInDraftRange should correctly identify dates in range", () => {
|
|
173
|
-
t.draftStart.value = "2026-01-15", t.draftEnd.value = "2026-01-20", e(t.isInDraftRange("2026-01-15")).toBe(!0), e(t.isInDraftRange("2026-01-18")).toBe(!0), e(t.isInDraftRange("2026-01-20")).toBe(!0), e(t.isInDraftRange("2026-01-14")).toBe(!1), e(t.isInDraftRange("2026-01-21")).toBe(!1);
|
|
174
|
-
}), n("isInDraftRange should return true only for start when no end date", () => {
|
|
175
|
-
t.draftStart.value = "2026-01-15", t.draftEnd.value = null, e(t.isInDraftRange("2026-01-15")).toBe(!0), e(t.isInDraftRange("2026-01-16")).toBe(!1);
|
|
176
|
-
}), n("isInDraftRange should return false when no start date", () => {
|
|
177
|
-
t.draftStart.value = null, t.draftEnd.value = "2026-01-20", e(t.isInDraftRange("2026-01-20")).toBe(!1);
|
|
178
|
-
});
|
|
179
|
-
}), s("draft management", () => {
|
|
180
|
-
f(() => {
|
|
181
|
-
u = c(i(l, d));
|
|
182
|
-
}), n("cancelDraft should revert draft to applied values", () => {
|
|
183
|
-
l.value = "2026-01-15", d.value = "2026-01-20", t.initializeDraft(), t.draftStart.value = "2026-02-10", t.draftEnd.value = "2026-02-15", t.cancelDraft(), e(t.draftStart.value).toBe("2026-01-15"), e(t.draftEnd.value).toBe("2026-01-20");
|
|
184
|
-
}), n("cancelDraft should handle null applied values", () => {
|
|
185
|
-
l.value = null, d.value = null, t.draftStart.value = "2026-01-15", t.draftEnd.value = "2026-01-20", t.cancelDraft(), e(t.draftStart.value).toBeNull(), e(t.draftEnd.value).toBeNull();
|
|
186
|
-
}), n("clearDraft should clear both draft and applied values", () => {
|
|
187
|
-
l.value = "2026-01-15", d.value = "2026-01-20", t.clearDraft(), e(t.draftStart.value).toBeNull(), e(t.draftEnd.value).toBeNull(), e(l.value).toBeNull(), e(d.value).toBeNull();
|
|
188
|
-
}), n("clearDraft should handle when applied refs are not provided", () => {
|
|
189
|
-
u = c(i()), t.draftStart.value = "2026-01-15", t.draftEnd.value = "2026-01-20", t.clearDraft(), e(t.draftStart.value).toBeNull(), e(t.draftEnd.value).toBeNull();
|
|
190
|
-
});
|
|
191
|
-
}), s("range label", () => {
|
|
192
|
-
f(() => {
|
|
193
|
-
u = c(i(l, d));
|
|
194
|
-
}), n("should show single date when only start date", () => {
|
|
195
|
-
l.value = "2026-01-15", d.value = null;
|
|
196
|
-
const a = t.rangeLabel.value;
|
|
197
|
-
e(a).toContain("1/15/26"), e(a).not.toContain(" - ");
|
|
198
|
-
}), n("should show range with year when different years", () => {
|
|
199
|
-
l.value = "2025-12-15", d.value = "2026-01-20";
|
|
200
|
-
const a = t.rangeLabel.value;
|
|
201
|
-
e(a).toContain("12/15/25"), e(a).toContain("1/20/26"), e(a).toContain(" - ");
|
|
202
|
-
}), n("should show range without year when same year", () => {
|
|
203
|
-
l.value = "2026-01-15", d.value = "2026-01-20";
|
|
204
|
-
const a = t.rangeLabel.value;
|
|
205
|
-
e(a).toContain("1/15"), e(a).toContain("1/20"), e(a).not.toContain("/26"), e(a).toContain(" - ");
|
|
206
|
-
}), n("should show range without year when same year but different months", () => {
|
|
207
|
-
l.value = "2026-01-15", d.value = "2026-02-20";
|
|
208
|
-
const a = t.rangeLabel.value;
|
|
209
|
-
e(a).toContain("1/15"), e(a).toContain("2/20"), e(a).not.toContain("/26"), e(a).toContain(" - ");
|
|
210
|
-
});
|
|
211
|
-
}), s("ARIA labels", () => {
|
|
212
|
-
f(() => {
|
|
213
|
-
u = c(i(l, d));
|
|
214
|
-
}), n('getDayAriaLabel should include "(start date)" for start', () => {
|
|
215
|
-
t.draftStart.value = "2026-01-15";
|
|
216
|
-
const a = t.getDayAriaLabel("2026-01-15");
|
|
217
|
-
e(a).toContain("(start date)");
|
|
218
|
-
}), n('getDayAriaLabel should include "(end date)" for end', () => {
|
|
219
|
-
t.draftStart.value = "2026-01-15", t.draftEnd.value = "2026-01-20";
|
|
220
|
-
const a = t.getDayAriaLabel("2026-01-20");
|
|
221
|
-
e(a).toContain("(end date)");
|
|
222
|
-
}), n('getDayAriaLabel should include "(in range)" for dates in range', () => {
|
|
223
|
-
t.draftStart.value = "2026-01-15", t.draftEnd.value = "2026-01-20";
|
|
224
|
-
const a = t.getDayAriaLabel("2026-01-18");
|
|
225
|
-
e(a).toContain("(in range)");
|
|
226
|
-
}), n("getDayAriaLabel should return plain date when not in range", () => {
|
|
227
|
-
t.draftStart.value = "2026-01-15", t.draftEnd.value = "2026-01-20";
|
|
228
|
-
const a = t.getDayAriaLabel("2026-01-25");
|
|
229
|
-
e(a).not.toContain("(start date)"), e(a).not.toContain("(end date)"), e(a).not.toContain("(in range)"), e(a).toBeTruthy();
|
|
230
|
-
});
|
|
231
|
-
});
|
|
232
|
-
});
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import '../assets/core.css';
|
|
2
|
-
import { defineComponent as r, h as e } from "vue";
|
|
3
|
-
import { d as p, b as f, a as v, i, m, g as s, v as o } from "../chunks/vue-test-utils.esm-bundler-BeQTU4qG.js";
|
|
4
|
-
import { useTheme as a } from "./useTheme.js";
|
|
5
|
-
import { _ as l } from "../chunks/CLThemeProvider.vue_vue_type_script_setup_true_lang-jaJYKZL8.js";
|
|
6
|
-
import { CLBorderRadius as n } from "../index.js";
|
|
7
|
-
p("useTheme", () => {
|
|
8
|
-
f(() => {
|
|
9
|
-
o.spyOn(console, "warn").mockImplementation(() => {
|
|
10
|
-
}), Object.defineProperty(window, "matchMedia", {
|
|
11
|
-
writable: !0,
|
|
12
|
-
value: o.fn().mockImplementation((t) => ({
|
|
13
|
-
matches: !1,
|
|
14
|
-
media: t,
|
|
15
|
-
onchange: null,
|
|
16
|
-
addListener: o.fn(),
|
|
17
|
-
// deprecated
|
|
18
|
-
removeListener: o.fn(),
|
|
19
|
-
// deprecated
|
|
20
|
-
addEventListener: o.fn(),
|
|
21
|
-
removeEventListener: o.fn(),
|
|
22
|
-
dispatchEvent: o.fn()
|
|
23
|
-
}))
|
|
24
|
-
});
|
|
25
|
-
}), v(() => {
|
|
26
|
-
o.restoreAllMocks();
|
|
27
|
-
}), i("should warn when used outside of CLThemeProvider", () => {
|
|
28
|
-
const t = r({
|
|
29
|
-
setup() {
|
|
30
|
-
return a(), () => e("div");
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
m(t), s(console.warn).toHaveBeenCalledWith(
|
|
34
|
-
"[Callaloo]: useTheme() must be used within a <CLThemeProvider />."
|
|
35
|
-
);
|
|
36
|
-
}), i("should not warn when used inside CLThemeProvider", () => {
|
|
37
|
-
const t = r({
|
|
38
|
-
setup() {
|
|
39
|
-
return a(), () => e("div");
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
m(l, {
|
|
43
|
-
slots: {
|
|
44
|
-
default: () => e(t)
|
|
45
|
-
}
|
|
46
|
-
}), s(console.warn).not.toHaveBeenCalled();
|
|
47
|
-
}), i("should provide theme state from the provider", () => {
|
|
48
|
-
let t;
|
|
49
|
-
const d = r({
|
|
50
|
-
setup() {
|
|
51
|
-
return t = a(), () => e("div");
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
m(l, {
|
|
55
|
-
props: {
|
|
56
|
-
themeConfig: {
|
|
57
|
-
borderRadius: n.Large
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
slots: {
|
|
61
|
-
default: () => e(d)
|
|
62
|
-
}
|
|
63
|
-
}), s(t.borderRadius.value).toBe(n.Large);
|
|
64
|
-
}), i("should allow multiple providers with isolated state", () => {
|
|
65
|
-
let t, d;
|
|
66
|
-
const u = r({
|
|
67
|
-
setup() {
|
|
68
|
-
return t = a(), () => e("div");
|
|
69
|
-
}
|
|
70
|
-
}), h = r({
|
|
71
|
-
setup() {
|
|
72
|
-
return d = a(), () => e("div");
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
m(r({
|
|
76
|
-
setup() {
|
|
77
|
-
return () => e("div", [
|
|
78
|
-
e(l, { themeConfig: { borderRadius: n.Small } }, {
|
|
79
|
-
default: () => e(u)
|
|
80
|
-
}),
|
|
81
|
-
e(l, { themeConfig: { borderRadius: n.Large } }, {
|
|
82
|
-
default: () => e(h)
|
|
83
|
-
})
|
|
84
|
-
]);
|
|
85
|
-
}
|
|
86
|
-
})), s(t.borderRadius.value).toBe(n.Small), s(d.borderRadius.value).toBe(n.Large);
|
|
87
|
-
});
|
|
88
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import '../assets/core.css';
|
|
2
|
-
import { defineComponent as t, h as s, nextTick as l } from "vue";
|
|
3
|
-
import { d as m, b as v, a as c, i as a, m as n, g as o, v as r } from "../chunks/vue-test-utils.esm-bundler-BeQTU4qG.js";
|
|
4
|
-
import { useToast as i } from "./useToast.js";
|
|
5
|
-
import { _ as u } from "../chunks/CLToastProvider.vue_vue_type_script_setup_true_lang-DkGK0H4Z.js";
|
|
6
|
-
m("useToast", () => {
|
|
7
|
-
v(() => {
|
|
8
|
-
r.spyOn(console, "warn").mockImplementation(() => {
|
|
9
|
-
});
|
|
10
|
-
}), c(() => {
|
|
11
|
-
r.restoreAllMocks();
|
|
12
|
-
}), a("should warn when used outside of CLToastProvider", () => {
|
|
13
|
-
const e = t({
|
|
14
|
-
setup() {
|
|
15
|
-
return i(), () => s("div");
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
n(e), o(console.warn).toHaveBeenCalledWith(
|
|
19
|
-
"[Callaloo]: useToast() must be used within a <CLToastProvider />."
|
|
20
|
-
);
|
|
21
|
-
}), a("should not warn when used inside CLToastProvider", () => {
|
|
22
|
-
const e = t({
|
|
23
|
-
setup() {
|
|
24
|
-
return i(), () => s("div");
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
n(u, {
|
|
28
|
-
slots: {
|
|
29
|
-
default: () => s(e)
|
|
30
|
-
}
|
|
31
|
-
}), o(console.warn).not.toHaveBeenCalled();
|
|
32
|
-
}), a("should have reactive visible state", async () => {
|
|
33
|
-
let e;
|
|
34
|
-
const d = t({
|
|
35
|
-
setup() {
|
|
36
|
-
return e = i(), () => s("div");
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
n(u, {
|
|
40
|
-
slots: {
|
|
41
|
-
default: () => s(d)
|
|
42
|
-
}
|
|
43
|
-
}), o(e.visible.value).toBe(!1), e.showToast({ message: "Test" }), await l(), o(e.visible.value).toBe(!0), e.hideToast(), await l(), o(e.visible.value).toBe(!1);
|
|
44
|
-
});
|
|
45
|
-
});
|