vueless 1.3.1 → 1.3.2-beta.1
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/icons/internal/progress_activity.svg +1 -0
- package/package.json +1 -1
- package/ui.container-accordion/tests/UAccordion.test.ts +6 -9
- package/ui.container-accordion-item/tests/UAccordionItem.test.ts +18 -41
- package/ui.container-card/tests/UCard.test.ts +14 -31
- package/ui.container-col/tests/UCol.test.ts +11 -25
- package/ui.container-group/tests/UGroup.test.ts +12 -26
- package/ui.container-groups/tests/UGroups.test.ts +4 -11
- package/ui.container-modal/UModal.vue +1 -1
- package/ui.container-modal-confirm/UModalConfirm.vue +2 -2
- package/ui.container-modal-confirm/tests/UModalConfirm.test.ts +27 -56
- package/ui.container-page/tests/UPage.test.ts +17 -38
- package/ui.container-row/tests/URow.test.ts +11 -25
- package/ui.form-calendar/config.ts +0 -1
- package/ui.form-checkbox/config.ts +14 -15
- package/ui.form-checkbox/storybook/docs.mdx +0 -16
- package/ui.form-checkbox/storybook/optionKeys.mdx +17 -0
- package/ui.form-checkbox/storybook/stories.ts +1 -3
- package/ui.form-checkbox-group/storybook/docs.mdx +2 -2
- package/ui.form-checkbox-multi-state/storybook/docs.mdx +3 -0
- package/ui.loader/ULoader.vue +10 -2
- package/ui.loader/config.ts +14 -1
- package/ui.loader/storybook/stories.ts +4 -1
- package/ui.loader/tests/ULoader.test.ts +74 -17
- package/ui.loader/types.ts +5 -0
- package/ui.loader-overlay/tests/ULoaderOverlay.test.ts +6 -15
- package/ui.loader-progress/tests/ULoaderProgress.test.ts +8 -18
- package/ui.navigation-breadcrumbs/tests/UBreadcrumbs.test.ts +18 -40
- package/ui.navigation-pagination/tests/UPagination.test.ts +18 -40
- package/ui.navigation-progress/tests/UProgress.test.ts +11 -25
- package/ui.navigation-tab/tests/UTab.test.ts +21 -46
- package/ui.navigation-tabs/tests/UTabs.test.ts +13 -30
- package/ui.other-chip/tests/UChip.test.ts +13 -29
- package/ui.other-dot/tests/UDot.test.ts +4 -10
- package/ui.other-theme-color-toggle/tests/UThemeColorToggle.test.ts +13 -29
- package/ui.skeleton/config.ts +1 -13
- package/ui.skeleton/storybook/stories.ts +3 -20
- package/ui.skeleton/tests/USkeleton.test.ts +2 -27
- package/ui.skeleton/types.ts +0 -5
- package/ui.skeleton-choice/USkeletonChoice.vue +2 -2
- package/ui.skeleton-choice/config.ts +0 -1
- package/ui.skeleton-choice/storybook/stories.ts +3 -6
- package/ui.skeleton-choice/tests/USkeletonChoice.test.ts +7 -35
- package/ui.skeleton-choice/types.ts +0 -5
- package/ui.skeleton-input/USkeletonInput.vue +3 -3
- package/ui.skeleton-input/config.ts +0 -1
- package/ui.skeleton-input/storybook/stories.ts +4 -7
- package/ui.skeleton-input/tests/USkeletonInput.test.ts +11 -48
- package/ui.skeleton-input/types.ts +0 -5
- package/ui.skeleton-text/USkeletonText.vue +2 -2
- package/ui.skeleton-text/config.ts +0 -1
- package/ui.skeleton-text/storybook/stories.ts +1 -4
- package/ui.skeleton-text/tests/USkeletonText.test.ts +5 -32
- package/ui.skeleton-text/types.ts +0 -5
- package/ui.text-alert/tests/UAlert.test.ts +17 -38
- package/ui.text-badge/tests/UBadge.test.ts +19 -42
- package/ui.text-block/tests/UText.test.ts +12 -27
- package/ui.text-empty/tests/UEmpty.test.ts +14 -31
- package/ui.text-file/tests/UFile.test.ts +13 -30
- package/ui.text-files/tests/UFiles.test.ts +14 -32
- package/ui.text-header/tests/UHeader.test.ts +10 -23
- package/ui.text-notify/tests/UNotify.test.ts +12 -26
- package/ui.text-number/tests/UNumber.test.ts +16 -35
|
@@ -101,7 +101,7 @@ function trapFocus(e: KeyboardEvent) {
|
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
// Tab - if focused on last element, move to first
|
|
104
|
+
// Tab - if focused on the last element, move to the first
|
|
105
105
|
if (!e.shiftKey && document.activeElement === lastElement) {
|
|
106
106
|
e.preventDefault();
|
|
107
107
|
firstElement.focus();
|
|
@@ -42,7 +42,7 @@ const emit = defineEmits([
|
|
|
42
42
|
|
|
43
43
|
const confirmModalRef = useTemplateRef<InstanceType<typeof UModal>>("confirmModal");
|
|
44
44
|
|
|
45
|
-
const
|
|
45
|
+
const modalRef = computed(() => {
|
|
46
46
|
return confirmModalRef.value?.wrapperRef || null;
|
|
47
47
|
});
|
|
48
48
|
|
|
@@ -80,7 +80,7 @@ defineExpose({
|
|
|
80
80
|
* A reference to the UModal's wrapper element for direct DOM manipulation.
|
|
81
81
|
* @property {InstanceType<typeof UModal>}
|
|
82
82
|
*/
|
|
83
|
-
|
|
83
|
+
modalRef,
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
/**
|
|
@@ -11,10 +11,8 @@ describe("UModalConfirm", () => {
|
|
|
11
11
|
// Define common test value
|
|
12
12
|
const modelValue = true;
|
|
13
13
|
|
|
14
|
-
// Props tests
|
|
15
14
|
describe("Props", () => {
|
|
16
|
-
|
|
17
|
-
it("renders when modelValue is true", () => {
|
|
15
|
+
it("Model Value – renders when modelValue is true", () => {
|
|
18
16
|
const component = mount(UModalConfirm, {
|
|
19
17
|
props: {
|
|
20
18
|
modelValue,
|
|
@@ -27,7 +25,7 @@ describe("UModalConfirm", () => {
|
|
|
27
25
|
expect(modal.props("modelValue")).toBe(modelValue);
|
|
28
26
|
});
|
|
29
27
|
|
|
30
|
-
it("does not render modal content when modelValue is false", () => {
|
|
28
|
+
it("Model Value – does not render modal content when modelValue is false", () => {
|
|
31
29
|
const modelValue = false;
|
|
32
30
|
|
|
33
31
|
const component = mount(UModalConfirm, {
|
|
@@ -42,8 +40,7 @@ describe("UModalConfirm", () => {
|
|
|
42
40
|
expect(modal.props("modelValue")).toBe(modelValue);
|
|
43
41
|
});
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
it("passes title prop to UModal", () => {
|
|
43
|
+
it("Title – passes title prop to UModal", () => {
|
|
47
44
|
const title = "Confirm Modal Title";
|
|
48
45
|
const component = mount(UModalConfirm, {
|
|
49
46
|
props: {
|
|
@@ -57,8 +54,7 @@ describe("UModalConfirm", () => {
|
|
|
57
54
|
expect(modal.props("title")).toBe(title);
|
|
58
55
|
});
|
|
59
56
|
|
|
60
|
-
|
|
61
|
-
it("passes description prop to UModal", () => {
|
|
57
|
+
it("Description – passes description prop to UModal", () => {
|
|
62
58
|
const description = "Confirm Modal Description";
|
|
63
59
|
|
|
64
60
|
const component = mount(UModalConfirm, {
|
|
@@ -73,8 +69,7 @@ describe("UModalConfirm", () => {
|
|
|
73
69
|
expect(modal.props("description")).toBe(description);
|
|
74
70
|
});
|
|
75
71
|
|
|
76
|
-
|
|
77
|
-
it("renders with custom confirmLabel prop", () => {
|
|
72
|
+
it("Confirm Label – renders with custom confirmLabel prop", () => {
|
|
78
73
|
const confirmLabel = "Custom Confirm";
|
|
79
74
|
const component = mount(UModalConfirm, {
|
|
80
75
|
props: {
|
|
@@ -87,8 +82,7 @@ describe("UModalConfirm", () => {
|
|
|
87
82
|
expect(component.find("[vl-key='confirmButton']").text()).toBe(confirmLabel);
|
|
88
83
|
});
|
|
89
84
|
|
|
90
|
-
|
|
91
|
-
it("applies correct confirmColor to confirm button", () => {
|
|
85
|
+
it("Confirm Color – applies correct confirmColor to confirm button", () => {
|
|
92
86
|
const colors = [
|
|
93
87
|
"primary",
|
|
94
88
|
"secondary",
|
|
@@ -113,8 +107,7 @@ describe("UModalConfirm", () => {
|
|
|
113
107
|
});
|
|
114
108
|
});
|
|
115
109
|
|
|
116
|
-
|
|
117
|
-
it("disables confirm button when confirmDisabled is true", () => {
|
|
110
|
+
it("Confirm Disabled – disables confirm button when confirmDisabled is true", () => {
|
|
118
111
|
const component = mount(UModalConfirm, {
|
|
119
112
|
props: {
|
|
120
113
|
modelValue,
|
|
@@ -125,8 +118,7 @@ describe("UModalConfirm", () => {
|
|
|
125
118
|
expect(component.find("[vl-key='confirmButton']").attributes("disabled")).toBeDefined();
|
|
126
119
|
});
|
|
127
120
|
|
|
128
|
-
|
|
129
|
-
it("hides cancel button when cancelHidden is true", () => {
|
|
121
|
+
it("Cancel Hidden – hides cancel button when cancelHidden is true", () => {
|
|
130
122
|
const cancelHidden = true;
|
|
131
123
|
|
|
132
124
|
const component = mount(UModalConfirm, {
|
|
@@ -143,8 +135,7 @@ describe("UModalConfirm", () => {
|
|
|
143
135
|
expect(cancelButton).toBeUndefined();
|
|
144
136
|
});
|
|
145
137
|
|
|
146
|
-
|
|
147
|
-
it("passes variant prop to UModal", () => {
|
|
138
|
+
it("Variant – passes variant prop to UModal", () => {
|
|
148
139
|
const variants = ["solid", "outlined", "subtle", "soft", "inverted"];
|
|
149
140
|
|
|
150
141
|
variants.forEach((variant) => {
|
|
@@ -161,8 +152,7 @@ describe("UModalConfirm", () => {
|
|
|
161
152
|
});
|
|
162
153
|
});
|
|
163
154
|
|
|
164
|
-
|
|
165
|
-
it("passes size prop to UModal", () => {
|
|
155
|
+
it("Size – passes size prop to UModal", () => {
|
|
166
156
|
const sizes = ["xs", "sm", "md", "lg", "xl", "2xl", "3xl", "4xl", "5xl"];
|
|
167
157
|
|
|
168
158
|
sizes.forEach((size) => {
|
|
@@ -179,8 +169,7 @@ describe("UModalConfirm", () => {
|
|
|
179
169
|
});
|
|
180
170
|
});
|
|
181
171
|
|
|
182
|
-
|
|
183
|
-
it("passes closeOnCross prop to UModal", () => {
|
|
172
|
+
it("Close On Cross – passes closeOnCross prop to UModal", () => {
|
|
184
173
|
const component = mount(UModalConfirm, {
|
|
185
174
|
props: {
|
|
186
175
|
modelValue,
|
|
@@ -193,8 +182,7 @@ describe("UModalConfirm", () => {
|
|
|
193
182
|
expect(modal.props("closeOnCross")).toBe(false);
|
|
194
183
|
});
|
|
195
184
|
|
|
196
|
-
|
|
197
|
-
it("passes closeOnOverlay prop to UModal", () => {
|
|
185
|
+
it("Close On Overlay – passes closeOnOverlay prop to UModal", () => {
|
|
198
186
|
const component = mount(UModalConfirm, {
|
|
199
187
|
props: {
|
|
200
188
|
modelValue,
|
|
@@ -221,8 +209,7 @@ describe("UModalConfirm", () => {
|
|
|
221
209
|
expect(modal.props("closeOnEsc")).toBe(false);
|
|
222
210
|
});
|
|
223
211
|
|
|
224
|
-
|
|
225
|
-
it("passes inner prop to UModal", () => {
|
|
212
|
+
it("Inner – passes inner prop to UModal", () => {
|
|
226
213
|
const component = mount(UModalConfirm, {
|
|
227
214
|
props: {
|
|
228
215
|
modelValue,
|
|
@@ -235,8 +222,7 @@ describe("UModalConfirm", () => {
|
|
|
235
222
|
expect(modal.props("inner")).toBe(true);
|
|
236
223
|
});
|
|
237
224
|
|
|
238
|
-
|
|
239
|
-
it("passes divided prop to UModal", () => {
|
|
225
|
+
it("Divided – passes divided prop to UModal", () => {
|
|
240
226
|
const component = mount(UModalConfirm, {
|
|
241
227
|
props: {
|
|
242
228
|
modelValue,
|
|
@@ -249,8 +235,7 @@ describe("UModalConfirm", () => {
|
|
|
249
235
|
expect(modal.props("divided")).toBe(true);
|
|
250
236
|
});
|
|
251
237
|
|
|
252
|
-
|
|
253
|
-
it("applies data-test attribute", () => {
|
|
238
|
+
it("Data Test – applies data-test attribute", () => {
|
|
254
239
|
const dataTest = "modal-confirm-test";
|
|
255
240
|
const component = mount(UModalConfirm, {
|
|
256
241
|
props: {
|
|
@@ -264,10 +249,8 @@ describe("UModalConfirm", () => {
|
|
|
264
249
|
});
|
|
265
250
|
});
|
|
266
251
|
|
|
267
|
-
// Slots tests
|
|
268
252
|
describe("Slots", () => {
|
|
269
|
-
|
|
270
|
-
it("passes default slot content to UModal", () => {
|
|
253
|
+
it("Default – passes default slot content to UModal", () => {
|
|
271
254
|
const slotClass = "default-content";
|
|
272
255
|
const slotContent = "Default Content";
|
|
273
256
|
|
|
@@ -288,8 +271,7 @@ describe("UModalConfirm", () => {
|
|
|
288
271
|
expect(modal.text()).toContain(slotContent);
|
|
289
272
|
});
|
|
290
273
|
|
|
291
|
-
|
|
292
|
-
it("passes before-title slot content to UModal", () => {
|
|
274
|
+
it("Before-title – passes before-title slot content to UModal", () => {
|
|
293
275
|
const slotClass = "before-title";
|
|
294
276
|
const slotContent = "Before Title";
|
|
295
277
|
|
|
@@ -310,8 +292,7 @@ describe("UModalConfirm", () => {
|
|
|
310
292
|
expect(modal.text()).toContain(slotContent);
|
|
311
293
|
});
|
|
312
294
|
|
|
313
|
-
|
|
314
|
-
it("passes title slot content to UModal", () => {
|
|
295
|
+
it("Title – passes title slot content to UModal", () => {
|
|
315
296
|
const slotClass = "title-content";
|
|
316
297
|
const slotContent = "Title Content";
|
|
317
298
|
|
|
@@ -332,8 +313,7 @@ describe("UModalConfirm", () => {
|
|
|
332
313
|
expect(modal.text()).toContain(slotContent);
|
|
333
314
|
});
|
|
334
315
|
|
|
335
|
-
|
|
336
|
-
it("passes after-title slot content to UModal", () => {
|
|
316
|
+
it("After-title – passes after-title slot content to UModal", () => {
|
|
337
317
|
const slotClass = "after-title";
|
|
338
318
|
const slotContent = "After Title";
|
|
339
319
|
|
|
@@ -354,8 +334,7 @@ describe("UModalConfirm", () => {
|
|
|
354
334
|
expect(modal.text()).toContain(slotContent);
|
|
355
335
|
});
|
|
356
336
|
|
|
357
|
-
|
|
358
|
-
it("passes actions slot content to UModal", () => {
|
|
337
|
+
it("Actions – passes actions slot content to UModal", () => {
|
|
359
338
|
const slotClass = "actions-content";
|
|
360
339
|
const slotContent = "Actions Content";
|
|
361
340
|
|
|
@@ -376,8 +355,7 @@ describe("UModalConfirm", () => {
|
|
|
376
355
|
expect(modal.text()).toContain(slotContent);
|
|
377
356
|
});
|
|
378
357
|
|
|
379
|
-
|
|
380
|
-
it("renders custom content in footer-left slot instead of default buttons", () => {
|
|
358
|
+
it("Footer-left – renders custom content in footer-left slot instead of default buttons", () => {
|
|
381
359
|
const slotClass = "footer-left";
|
|
382
360
|
const slotContent = "Footer Left";
|
|
383
361
|
|
|
@@ -405,8 +383,7 @@ describe("UModalConfirm", () => {
|
|
|
405
383
|
expect(confirmButton).toBeUndefined();
|
|
406
384
|
});
|
|
407
385
|
|
|
408
|
-
|
|
409
|
-
it("passes footer-right slot content to UModal", () => {
|
|
386
|
+
it("Footer-right – passes footer-right slot content to UModal", () => {
|
|
410
387
|
const slotClass = "footer-right";
|
|
411
388
|
const slotContent = "Footer Right";
|
|
412
389
|
const component = mount(UModalConfirm, {
|
|
@@ -427,10 +404,8 @@ describe("UModalConfirm", () => {
|
|
|
427
404
|
});
|
|
428
405
|
});
|
|
429
406
|
|
|
430
|
-
// Events tests
|
|
431
407
|
describe("Events", () => {
|
|
432
|
-
|
|
433
|
-
it("emits update:modelValue event when close button is clicked", async () => {
|
|
408
|
+
it("Update Model Value – emits update:modelValue event when close button is clicked", async () => {
|
|
434
409
|
const component = mount(UModalConfirm, {
|
|
435
410
|
props: {
|
|
436
411
|
modelValue,
|
|
@@ -447,8 +422,7 @@ describe("UModalConfirm", () => {
|
|
|
447
422
|
expect(component.emitted("update:modelValue")?.[0]).toEqual([false]);
|
|
448
423
|
});
|
|
449
424
|
|
|
450
|
-
|
|
451
|
-
it("emits confirm event when confirm button is clicked", async () => {
|
|
425
|
+
it("Confirm – emits confirm event when confirm button is clicked", async () => {
|
|
452
426
|
const component = mount(UModalConfirm, {
|
|
453
427
|
props: {
|
|
454
428
|
modelValue,
|
|
@@ -468,8 +442,7 @@ describe("UModalConfirm", () => {
|
|
|
468
442
|
expect(component.emitted("update:modelValue")?.[0]).toEqual([false]);
|
|
469
443
|
});
|
|
470
444
|
|
|
471
|
-
|
|
472
|
-
it("emits close event when cancel button is clicked", async () => {
|
|
445
|
+
it("Close – emits close event when cancel button is clicked", async () => {
|
|
473
446
|
const component = mount(UModalConfirm, {
|
|
474
447
|
props: {
|
|
475
448
|
modelValue,
|
|
@@ -490,17 +463,15 @@ describe("UModalConfirm", () => {
|
|
|
490
463
|
});
|
|
491
464
|
});
|
|
492
465
|
|
|
493
|
-
// Exposed refs tests
|
|
494
466
|
describe("Exposed refs", () => {
|
|
495
|
-
|
|
496
|
-
it("exposes modal ref", () => {
|
|
467
|
+
it("modalRef – exposes modal ref", () => {
|
|
497
468
|
const component = mount(UModalConfirm, {
|
|
498
469
|
props: {
|
|
499
470
|
modelValue,
|
|
500
471
|
},
|
|
501
472
|
});
|
|
502
473
|
|
|
503
|
-
expect(component.vm.
|
|
474
|
+
expect(component.vm.modalRef).toBeDefined();
|
|
504
475
|
});
|
|
505
476
|
});
|
|
506
477
|
});
|
|
@@ -28,10 +28,8 @@ const mountWithRouter = (component: unknown, options: UnknownObject) => {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
describe("UPage.vue", () => {
|
|
31
|
-
// Props tests
|
|
32
31
|
describe("Props", () => {
|
|
33
|
-
|
|
34
|
-
it("applies correct variant classes", () => {
|
|
32
|
+
it("Variant – applies correct variant classes", () => {
|
|
35
33
|
const variants = {
|
|
36
34
|
solid: "bg-default border-transparent",
|
|
37
35
|
outlined: "bg-default border-muted",
|
|
@@ -52,8 +50,7 @@ describe("UPage.vue", () => {
|
|
|
52
50
|
});
|
|
53
51
|
});
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
it("applies correct size classes", () => {
|
|
53
|
+
it("Size – applies correct size classes", () => {
|
|
57
54
|
const sizeClasses = {
|
|
58
55
|
xs: "md:w-[25rem]",
|
|
59
56
|
sm: "md:w-[31.25rem]",
|
|
@@ -78,8 +75,7 @@ describe("UPage.vue", () => {
|
|
|
78
75
|
});
|
|
79
76
|
});
|
|
80
77
|
|
|
81
|
-
|
|
82
|
-
it("applies correct titleSize to the header", () => {
|
|
78
|
+
it("Title Size – applies correct titleSize to the header", () => {
|
|
83
79
|
const titleSizes = ["xs", "sm", "md", "lg", "xl", "2xl"];
|
|
84
80
|
const title = "Test Title";
|
|
85
81
|
|
|
@@ -98,8 +94,7 @@ describe("UPage.vue", () => {
|
|
|
98
94
|
});
|
|
99
95
|
});
|
|
100
96
|
|
|
101
|
-
|
|
102
|
-
it("applies correct rounding classes", () => {
|
|
97
|
+
it("Rounding – applies correct rounding classes", () => {
|
|
103
98
|
const variants = {
|
|
104
99
|
true: "border-r-0",
|
|
105
100
|
false: "rounded-large",
|
|
@@ -120,8 +115,7 @@ describe("UPage.vue", () => {
|
|
|
120
115
|
});
|
|
121
116
|
});
|
|
122
117
|
|
|
123
|
-
|
|
124
|
-
it("renders the title correctly", () => {
|
|
118
|
+
it("Title – renders the title correctly", () => {
|
|
125
119
|
const title = "Test Title";
|
|
126
120
|
|
|
127
121
|
const component = mount(UPage, {
|
|
@@ -137,8 +131,7 @@ describe("UPage.vue", () => {
|
|
|
137
131
|
expect(header.props("label")).toBe(title);
|
|
138
132
|
});
|
|
139
133
|
|
|
140
|
-
|
|
141
|
-
it("renders the description correctly", () => {
|
|
134
|
+
it("Description – renders the description correctly", () => {
|
|
142
135
|
const description = "Test Description";
|
|
143
136
|
|
|
144
137
|
const component = mount(UPage, {
|
|
@@ -154,8 +147,7 @@ describe("UPage.vue", () => {
|
|
|
154
147
|
expect(descriptionElement.text()).toBe(description);
|
|
155
148
|
});
|
|
156
149
|
|
|
157
|
-
|
|
158
|
-
it("renders back link correctly", () => {
|
|
150
|
+
it("Back To – renders back link correctly", () => {
|
|
159
151
|
// Need to provide a valid RouteLocationRaw object
|
|
160
152
|
const backTo = { path: "/back" };
|
|
161
153
|
const backLabel = "Back";
|
|
@@ -175,8 +167,7 @@ describe("UPage.vue", () => {
|
|
|
175
167
|
expect(backLink.props("label")).toBe(backLabel);
|
|
176
168
|
});
|
|
177
169
|
|
|
178
|
-
|
|
179
|
-
it("applies the correct data-test attribute", () => {
|
|
170
|
+
it("Data Test – applies the correct data-test attribute", () => {
|
|
180
171
|
const dataTest = "page-test";
|
|
181
172
|
|
|
182
173
|
const component = mount(UPage, {
|
|
@@ -189,10 +180,8 @@ describe("UPage.vue", () => {
|
|
|
189
180
|
});
|
|
190
181
|
});
|
|
191
182
|
|
|
192
|
-
// Slots tests
|
|
193
183
|
describe("Slots", () => {
|
|
194
|
-
|
|
195
|
-
it("renders content in default slot", () => {
|
|
184
|
+
it("Default – renders content in default slot", () => {
|
|
196
185
|
const slotContent = "Default Content";
|
|
197
186
|
const slotClass = "default-content";
|
|
198
187
|
|
|
@@ -206,8 +195,7 @@ describe("UPage.vue", () => {
|
|
|
206
195
|
expect(component.text()).toContain(slotContent);
|
|
207
196
|
});
|
|
208
197
|
|
|
209
|
-
|
|
210
|
-
it("renders content in before-title slot", () => {
|
|
198
|
+
it("Before-title – renders content in before-title slot", () => {
|
|
211
199
|
const slotContent = "Before Title Content";
|
|
212
200
|
const slotClass = "before-title-content";
|
|
213
201
|
|
|
@@ -221,8 +209,7 @@ describe("UPage.vue", () => {
|
|
|
221
209
|
expect(component.text()).toContain(slotContent);
|
|
222
210
|
});
|
|
223
211
|
|
|
224
|
-
|
|
225
|
-
it("renders content in title slot", () => {
|
|
212
|
+
it("Title – renders content in title slot", () => {
|
|
226
213
|
const slotContent = "Title Content";
|
|
227
214
|
const slotClass = "title-content";
|
|
228
215
|
|
|
@@ -236,8 +223,7 @@ describe("UPage.vue", () => {
|
|
|
236
223
|
expect(component.text()).toContain(slotContent);
|
|
237
224
|
});
|
|
238
225
|
|
|
239
|
-
|
|
240
|
-
it("renders content in after-title slot", () => {
|
|
226
|
+
it("After-title – renders content in after-title slot", () => {
|
|
241
227
|
const slotContent = "After Title Content";
|
|
242
228
|
const slotClass = "after-title-content";
|
|
243
229
|
|
|
@@ -251,8 +237,7 @@ describe("UPage.vue", () => {
|
|
|
251
237
|
expect(component.text()).toContain(slotContent);
|
|
252
238
|
});
|
|
253
239
|
|
|
254
|
-
|
|
255
|
-
it("renders content in actions slot", () => {
|
|
240
|
+
it("Actions – renders content in actions slot", () => {
|
|
256
241
|
const slotContent = "Actions Content";
|
|
257
242
|
const slotClass = "actions-content";
|
|
258
243
|
|
|
@@ -266,8 +251,7 @@ describe("UPage.vue", () => {
|
|
|
266
251
|
expect(component.text()).toContain(slotContent);
|
|
267
252
|
});
|
|
268
253
|
|
|
269
|
-
|
|
270
|
-
it("renders content in footer-left slot", () => {
|
|
254
|
+
it("Footer-left – renders content in footer-left slot", () => {
|
|
271
255
|
const slotContent = "Footer Left Content";
|
|
272
256
|
const slotClass = "footer-left-content";
|
|
273
257
|
|
|
@@ -281,8 +265,7 @@ describe("UPage.vue", () => {
|
|
|
281
265
|
expect(component.text()).toContain(slotContent);
|
|
282
266
|
});
|
|
283
267
|
|
|
284
|
-
|
|
285
|
-
it("renders content in footer-right slot", () => {
|
|
268
|
+
it("Footer-right – renders content in footer-right slot", () => {
|
|
286
269
|
const slotContent = "Footer Right Content";
|
|
287
270
|
const slotClass = "footer-right-content";
|
|
288
271
|
|
|
@@ -297,10 +280,8 @@ describe("UPage.vue", () => {
|
|
|
297
280
|
});
|
|
298
281
|
});
|
|
299
282
|
|
|
300
|
-
// Events tests
|
|
301
283
|
describe("Events", () => {
|
|
302
|
-
|
|
303
|
-
it("emits back event when back link is clicked", async () => {
|
|
284
|
+
it("Back – emits back event when back link is clicked", async () => {
|
|
304
285
|
const component = mountWithRouter(UPage, {
|
|
305
286
|
props: {
|
|
306
287
|
title: "Test Title", // Need a title to make isExistHeader true
|
|
@@ -319,10 +300,8 @@ describe("UPage.vue", () => {
|
|
|
319
300
|
});
|
|
320
301
|
});
|
|
321
302
|
|
|
322
|
-
// Exposed refs tests
|
|
323
303
|
describe("Exposed refs", () => {
|
|
324
|
-
|
|
325
|
-
it("exposes wrapperRef", () => {
|
|
304
|
+
it("wrapperRef – exposes wrapperRef", () => {
|
|
326
305
|
const component = mount(UPage);
|
|
327
306
|
|
|
328
307
|
expect(component.vm.wrapperRef).toBeDefined();
|
|
@@ -6,10 +6,8 @@ import URow from "../URow.vue";
|
|
|
6
6
|
import type { Props } from "../types";
|
|
7
7
|
|
|
8
8
|
describe("URow.vue", () => {
|
|
9
|
-
// Props tests
|
|
10
9
|
describe("Props", () => {
|
|
11
|
-
|
|
12
|
-
it("applies the correct gap class", () => {
|
|
10
|
+
it("Gap – applies the correct gap class", () => {
|
|
13
11
|
const gapClasses = {
|
|
14
12
|
none: "gap-0",
|
|
15
13
|
"2xs": "gap-1",
|
|
@@ -32,8 +30,7 @@ describe("URow.vue", () => {
|
|
|
32
30
|
});
|
|
33
31
|
});
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
it("applies the correct align class", () => {
|
|
33
|
+
it("Align – applies the correct align class", () => {
|
|
37
34
|
const alignClasses = {
|
|
38
35
|
end: "items-end",
|
|
39
36
|
start: "items-start",
|
|
@@ -53,8 +50,7 @@ describe("URow.vue", () => {
|
|
|
53
50
|
});
|
|
54
51
|
});
|
|
55
52
|
|
|
56
|
-
|
|
57
|
-
it("applies the correct content class", () => {
|
|
53
|
+
it("Content – applies the correct content class", () => {
|
|
58
54
|
const contentClasses = {
|
|
59
55
|
end: "content-end",
|
|
60
56
|
start: "content-start",
|
|
@@ -78,8 +74,7 @@ describe("URow.vue", () => {
|
|
|
78
74
|
});
|
|
79
75
|
});
|
|
80
76
|
|
|
81
|
-
|
|
82
|
-
it("applies the correct justify class", () => {
|
|
77
|
+
it("Justify – applies the correct justify class", () => {
|
|
83
78
|
const justifyClasses = {
|
|
84
79
|
end: "justify-end",
|
|
85
80
|
start: "justify-start",
|
|
@@ -100,8 +95,7 @@ describe("URow.vue", () => {
|
|
|
100
95
|
});
|
|
101
96
|
});
|
|
102
97
|
|
|
103
|
-
|
|
104
|
-
it("applies the correct reverse class", () => {
|
|
98
|
+
it("Reverse – applies the correct reverse class", () => {
|
|
105
99
|
const reverseClasses = {
|
|
106
100
|
false: "flex-row",
|
|
107
101
|
true: "flex-row-reverse",
|
|
@@ -118,8 +112,7 @@ describe("URow.vue", () => {
|
|
|
118
112
|
});
|
|
119
113
|
});
|
|
120
114
|
|
|
121
|
-
|
|
122
|
-
it("applies the correct wrap class", () => {
|
|
115
|
+
it("Wrap – applies the correct wrap class", () => {
|
|
123
116
|
const wrap = true;
|
|
124
117
|
const expectedClasses = "flex-wrap";
|
|
125
118
|
|
|
@@ -132,8 +125,7 @@ describe("URow.vue", () => {
|
|
|
132
125
|
expect(component.attributes("class")).toContain(expectedClasses);
|
|
133
126
|
});
|
|
134
127
|
|
|
135
|
-
|
|
136
|
-
it("applies the correct block class", () => {
|
|
128
|
+
it("Block – applies the correct block class", () => {
|
|
137
129
|
const block = true;
|
|
138
130
|
const expectedClasses = "w-full";
|
|
139
131
|
|
|
@@ -146,8 +138,7 @@ describe("URow.vue", () => {
|
|
|
146
138
|
expect(component.attributes("class")).toContain(expectedClasses);
|
|
147
139
|
});
|
|
148
140
|
|
|
149
|
-
|
|
150
|
-
it("renders the correct HTML tag", () => {
|
|
141
|
+
it("Tag – renders the correct HTML tag", () => {
|
|
151
142
|
const tags = ["div", "section", "article", "main", "aside", "nav", "span"];
|
|
152
143
|
|
|
153
144
|
tags.forEach((tag) => {
|
|
@@ -161,8 +152,7 @@ describe("URow.vue", () => {
|
|
|
161
152
|
});
|
|
162
153
|
});
|
|
163
154
|
|
|
164
|
-
|
|
165
|
-
it("applies the correct data-test attribute", () => {
|
|
155
|
+
it("Data Test – applies the correct data-test attribute", () => {
|
|
166
156
|
const dataTest = "test-row";
|
|
167
157
|
|
|
168
158
|
const component = mount(URow, {
|
|
@@ -175,10 +165,8 @@ describe("URow.vue", () => {
|
|
|
175
165
|
});
|
|
176
166
|
});
|
|
177
167
|
|
|
178
|
-
// Slots tests
|
|
179
168
|
describe("Slots", () => {
|
|
180
|
-
|
|
181
|
-
it("renders content from default slot", () => {
|
|
169
|
+
it("Default – renders content from default slot", () => {
|
|
182
170
|
const slotContent = "Custom Content";
|
|
183
171
|
|
|
184
172
|
const component = mount(URow, {
|
|
@@ -191,10 +179,8 @@ describe("URow.vue", () => {
|
|
|
191
179
|
});
|
|
192
180
|
});
|
|
193
181
|
|
|
194
|
-
// Exposed refs tests
|
|
195
182
|
describe("Exposed refs", () => {
|
|
196
|
-
|
|
197
|
-
it("exposes wrapperRef", () => {
|
|
183
|
+
it("wrapperRef – exposes wrapperRef", () => {
|
|
198
184
|
const component = mount(URow);
|
|
199
185
|
|
|
200
186
|
expect(component.vm.wrapperRef).toBeDefined();
|
|
@@ -159,7 +159,6 @@ export default /*tw*/ {
|
|
|
159
159
|
range: false,
|
|
160
160
|
timepicker: false,
|
|
161
161
|
/* icons */
|
|
162
|
-
viewSwitchIcon: "keyboard_arrow_down",
|
|
163
162
|
nextYearIcon: "keyboard_double_arrow_right",
|
|
164
163
|
prevYearIcon: "keyboard_double_arrow_left",
|
|
165
164
|
nextIcon: "keyboard_arrow_right",
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
checkboxLabel: "{ULabel}",
|
|
3
|
+
checkboxBase: {
|
|
4
|
+
base: "rounded-small cursor-pointer transition",
|
|
5
|
+
variants: {
|
|
6
|
+
size: {
|
|
7
|
+
sm: "size-4 -ml-4",
|
|
8
|
+
md: "size-5 -ml-5",
|
|
9
|
+
lg: "size-6 -ml-6",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
3
13
|
checkbox: {
|
|
4
14
|
base: `
|
|
5
|
-
bg-default
|
|
6
|
-
border border-solid border-default rounded-small outline-transparent
|
|
15
|
+
{>checkboxBase} ml-0 bg-default border border-solid border-default outline-transparent
|
|
7
16
|
appearance-none p-0 print:color-adjust-exact inline-block align-middle bg-origin-border select-none shrink-0
|
|
8
17
|
hover:border-lifted
|
|
9
18
|
active:border-{color} active:bg-{color}/15
|
|
@@ -13,11 +22,6 @@ export default /*tw*/ {
|
|
|
13
22
|
disabled:checked:bg-{color}/(--vl-disabled-opacity) disabled:checked:border-transparent
|
|
14
23
|
`,
|
|
15
24
|
variants: {
|
|
16
|
-
size: {
|
|
17
|
-
sm: "size-4",
|
|
18
|
-
md: "size-5",
|
|
19
|
-
lg: "size-6",
|
|
20
|
-
},
|
|
21
25
|
error: {
|
|
22
26
|
true: "!border-error focus-visible:outline-error",
|
|
23
27
|
},
|
|
@@ -25,21 +29,15 @@ export default /*tw*/ {
|
|
|
25
29
|
},
|
|
26
30
|
checked: {
|
|
27
31
|
base: `
|
|
28
|
-
flex items-center justify-center
|
|
32
|
+
{>checkboxBase} flex items-center justify-center relative
|
|
29
33
|
bg-{color} hover:bg-{color}-lifted active:bg-{color}-accented
|
|
30
34
|
`,
|
|
31
35
|
variants: {
|
|
32
|
-
size: {
|
|
33
|
-
sm: "size-4",
|
|
34
|
-
md: "size-5",
|
|
35
|
-
lg: "size-6",
|
|
36
|
-
},
|
|
37
36
|
disabled: {
|
|
38
37
|
true: "!bg-{color}/(--vl-disabled-opacity) cursor-not-allowed",
|
|
39
38
|
},
|
|
40
39
|
},
|
|
41
40
|
},
|
|
42
|
-
partiallyChecked: "{>checked}",
|
|
43
41
|
checkedIcon: {
|
|
44
42
|
base: "{UIcon} text-inverted",
|
|
45
43
|
defaults: {
|
|
@@ -50,9 +48,10 @@ export default /*tw*/ {
|
|
|
50
48
|
},
|
|
51
49
|
},
|
|
52
50
|
},
|
|
51
|
+
partiallyChecked: "{>checked}",
|
|
53
52
|
partiallyCheckedIcon: "{>checkedIcon}",
|
|
54
|
-
/* These are used for a11y. */
|
|
55
53
|
i18n: {
|
|
54
|
+
/* These are used for a11y. */
|
|
56
55
|
checkbox: "Checkbox",
|
|
57
56
|
},
|
|
58
57
|
defaults: {
|
|
@@ -12,21 +12,5 @@ import defaultConfig from "../config?raw"
|
|
|
12
12
|
<Controls of={stories.Default} />
|
|
13
13
|
<Stories of={stories} />
|
|
14
14
|
|
|
15
|
-
## Option meta keys
|
|
16
|
-
Keys you may/have to provide to the component in an option object.
|
|
17
|
-
|
|
18
|
-
<Markdown>
|
|
19
|
-
{`
|
|
20
|
-
| Key name | Description | Type |
|
|
21
|
-
| ------------------| ---------------------------------------| ---------------------------------------|
|
|
22
|
-
| value | Native value attribute | Boolean, String, Number, Array, Object |
|
|
23
|
-
| trueValue | Own value for checkbox checked state | Boolean, String, Number, Array, Object |
|
|
24
|
-
| falseValue | Own value for checkbox unchecked state | Boolean, String, Number, Array, Object |
|
|
25
|
-
| label | Option label | String |
|
|
26
|
-
| icon | Option icon | String |
|
|
27
|
-
| description | Option description | Number |
|
|
28
|
-
`}
|
|
29
|
-
</Markdown>
|
|
30
|
-
|
|
31
15
|
## Default config
|
|
32
16
|
<Source code={getSource(defaultConfig)} language="jsx" dark />
|