vueless 1.3.1 → 1.3.2-beta.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/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
|
@@ -8,10 +8,8 @@ import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
|
8
8
|
import type { Props } from "../types";
|
|
9
9
|
|
|
10
10
|
describe("UPagination.vue", () => {
|
|
11
|
-
// Props tests
|
|
12
11
|
describe("Props", () => {
|
|
13
|
-
|
|
14
|
-
it("applies the correct variant to buttons", async () => {
|
|
12
|
+
it("Variant – applies the correct variant to buttons", async () => {
|
|
15
13
|
const variants = ["solid", "outlined", "subtle", "soft", "ghost"];
|
|
16
14
|
|
|
17
15
|
variants.forEach((variant) => {
|
|
@@ -32,8 +30,7 @@ describe("UPagination.vue", () => {
|
|
|
32
30
|
});
|
|
33
31
|
});
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
it("applies the correct size to buttons", async () => {
|
|
33
|
+
it("Size – applies the correct size to buttons", async () => {
|
|
37
34
|
const sizes = {
|
|
38
35
|
sm: "text-small",
|
|
39
36
|
md: "text-medium",
|
|
@@ -59,8 +56,7 @@ describe("UPagination.vue", () => {
|
|
|
59
56
|
});
|
|
60
57
|
});
|
|
61
58
|
|
|
62
|
-
|
|
63
|
-
it("correctly highlights the current page", () => {
|
|
59
|
+
it("ModelValue – correctly highlights the current page", () => {
|
|
64
60
|
const currentPage = 3;
|
|
65
61
|
|
|
66
62
|
const component = mount(UPagination, {
|
|
@@ -78,8 +74,7 @@ describe("UPagination.vue", () => {
|
|
|
78
74
|
expect(activeButton?.props("variant")).toBe("solid");
|
|
79
75
|
});
|
|
80
76
|
|
|
81
|
-
|
|
82
|
-
it("calculates the correct number of pages", () => {
|
|
77
|
+
it("Total – calculates the correct number of pages", () => {
|
|
83
78
|
const total = 100;
|
|
84
79
|
const perPage = 10;
|
|
85
80
|
|
|
@@ -104,8 +99,7 @@ describe("UPagination.vue", () => {
|
|
|
104
99
|
expect(pageButtons.length).toBeLessThanOrEqual(expectedAmountOfButtons);
|
|
105
100
|
});
|
|
106
101
|
|
|
107
|
-
|
|
108
|
-
it("respects the limit of visible pages", () => {
|
|
102
|
+
it("Limit – respects the limit of visible pages", () => {
|
|
109
103
|
const limit = 3;
|
|
110
104
|
|
|
111
105
|
const component = mount(UPagination, {
|
|
@@ -127,8 +121,7 @@ describe("UPagination.vue", () => {
|
|
|
127
121
|
expect(pageButtons.length).toBeLessThanOrEqual(limit);
|
|
128
122
|
});
|
|
129
123
|
|
|
130
|
-
|
|
131
|
-
it("displays custom navigation labels", () => {
|
|
124
|
+
it("FirstLabel, PrevLabel, NextLabel, LastLabel – displays custom navigation labels", () => {
|
|
132
125
|
const firstLabel = "First";
|
|
133
126
|
const prevLabel = "Prev";
|
|
134
127
|
const nextLabel = "Next";
|
|
@@ -154,8 +147,7 @@ describe("UPagination.vue", () => {
|
|
|
154
147
|
expect(buttons[buttons.length - 1].text()).toBe(lastLabel);
|
|
155
148
|
});
|
|
156
149
|
|
|
157
|
-
|
|
158
|
-
it("disables all buttons when disabled prop is true", () => {
|
|
150
|
+
it("Disabled – disables all buttons when disabled prop is true", () => {
|
|
159
151
|
const disabled = true;
|
|
160
152
|
|
|
161
153
|
const component = mount(UPagination, {
|
|
@@ -181,8 +173,7 @@ describe("UPagination.vue", () => {
|
|
|
181
173
|
});
|
|
182
174
|
});
|
|
183
175
|
|
|
184
|
-
|
|
185
|
-
it("shows ellipsis when ellipsis prop is true", () => {
|
|
176
|
+
it("Ellipsis – shows ellipsis when ellipsis prop is true", () => {
|
|
186
177
|
const ellipsis = true;
|
|
187
178
|
const expectedEllipsis = "…";
|
|
188
179
|
|
|
@@ -199,8 +190,7 @@ describe("UPagination.vue", () => {
|
|
|
199
190
|
expect(component.html()).toContain(expectedEllipsis);
|
|
200
191
|
});
|
|
201
192
|
|
|
202
|
-
|
|
203
|
-
it("hides first/last buttons when showFirst/showLast props are false", () => {
|
|
193
|
+
it("ShowFirst – hides first/last buttons when showFirst/showLast props are false", () => {
|
|
204
194
|
const component = mount(UPagination, {
|
|
205
195
|
props: {
|
|
206
196
|
modelValue: 5,
|
|
@@ -220,8 +210,7 @@ describe("UPagination.vue", () => {
|
|
|
220
210
|
expect(lastButton.findComponent(UIcon).props("name")).toContain("chevron_right");
|
|
221
211
|
});
|
|
222
212
|
|
|
223
|
-
|
|
224
|
-
it("applies the correct data-test attribute", () => {
|
|
213
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
225
214
|
const dataTest = "test-pagination";
|
|
226
215
|
|
|
227
216
|
const component = mount(UPagination, {
|
|
@@ -240,10 +229,8 @@ describe("UPagination.vue", () => {
|
|
|
240
229
|
});
|
|
241
230
|
});
|
|
242
231
|
|
|
243
|
-
// Slots tests
|
|
244
232
|
describe("Slots", () => {
|
|
245
|
-
|
|
246
|
-
it("renders content from first slot", () => {
|
|
233
|
+
it("First – renders content from first slot", () => {
|
|
247
234
|
const slotContent = "Custom First";
|
|
248
235
|
const slotClass = "first-content";
|
|
249
236
|
|
|
@@ -262,8 +249,7 @@ describe("UPagination.vue", () => {
|
|
|
262
249
|
expect(component.find(`.${slotClass}`).text()).toBe(slotContent);
|
|
263
250
|
});
|
|
264
251
|
|
|
265
|
-
|
|
266
|
-
it("renders content from prev slot", () => {
|
|
252
|
+
it("Prev – renders content from prev slot", () => {
|
|
267
253
|
const slotContent = "Custom Prev";
|
|
268
254
|
const slotClass = "prev-content";
|
|
269
255
|
|
|
@@ -282,8 +268,7 @@ describe("UPagination.vue", () => {
|
|
|
282
268
|
expect(component.find(`.${slotClass}`).text()).toBe(slotContent);
|
|
283
269
|
});
|
|
284
270
|
|
|
285
|
-
|
|
286
|
-
it("renders content from ellipsis slot", () => {
|
|
271
|
+
it("Ellipsis – renders content from ellipsis slot", () => {
|
|
287
272
|
const slotContent = "......";
|
|
288
273
|
const slotClass = "ellipsis-content";
|
|
289
274
|
|
|
@@ -303,8 +288,7 @@ describe("UPagination.vue", () => {
|
|
|
303
288
|
expect(component.find(`.${slotClass}`).text()).toBe(slotContent);
|
|
304
289
|
});
|
|
305
290
|
|
|
306
|
-
|
|
307
|
-
it("renders content from next slot", () => {
|
|
291
|
+
it("Next – renders content from next slot", () => {
|
|
308
292
|
const slotContent = "Custom Next";
|
|
309
293
|
const slotClass = "next-content";
|
|
310
294
|
|
|
@@ -323,8 +307,7 @@ describe("UPagination.vue", () => {
|
|
|
323
307
|
expect(component.find(`.${slotClass}`).text()).toBe(slotContent);
|
|
324
308
|
});
|
|
325
309
|
|
|
326
|
-
|
|
327
|
-
it("renders content from last slot", () => {
|
|
310
|
+
it("Last – renders content from last slot", () => {
|
|
328
311
|
const slotContent = "Custom Last";
|
|
329
312
|
const slotClass = "last-content";
|
|
330
313
|
|
|
@@ -344,10 +327,8 @@ describe("UPagination.vue", () => {
|
|
|
344
327
|
});
|
|
345
328
|
});
|
|
346
329
|
|
|
347
|
-
// Events tests
|
|
348
330
|
describe("Events", () => {
|
|
349
|
-
|
|
350
|
-
it("emits update:modelValue event when page is changed", async () => {
|
|
331
|
+
it("Update:modelValue – emits update:modelValue event when page is changed", async () => {
|
|
351
332
|
const component = mount(UPagination, {
|
|
352
333
|
props: {
|
|
353
334
|
modelValue: 1,
|
|
@@ -370,8 +351,7 @@ describe("UPagination.vue", () => {
|
|
|
370
351
|
expect(component.emitted("update:modelValue")?.[0]).toEqual([2]); // Second button value
|
|
371
352
|
});
|
|
372
353
|
|
|
373
|
-
|
|
374
|
-
it("navigates to correct pages when navigation buttons are clicked", async () => {
|
|
354
|
+
it("Navigation – navigates to correct pages when navigation buttons are clicked", async () => {
|
|
375
355
|
const component = mount(UPagination, {
|
|
376
356
|
props: {
|
|
377
357
|
modelValue: 5,
|
|
@@ -400,10 +380,8 @@ describe("UPagination.vue", () => {
|
|
|
400
380
|
});
|
|
401
381
|
});
|
|
402
382
|
|
|
403
|
-
// Exposed refs tests
|
|
404
383
|
describe("Exposed refs", () => {
|
|
405
|
-
|
|
406
|
-
it("exposes paginationRef", () => {
|
|
384
|
+
it("paginationRef – exposes paginationRef", () => {
|
|
407
385
|
const component = mount(UPagination, {
|
|
408
386
|
props: {
|
|
409
387
|
modelValue: 1,
|
|
@@ -7,10 +7,8 @@ import UStepperProgress from "../UStepperProgress.vue";
|
|
|
7
7
|
import type { Props } from "../types";
|
|
8
8
|
|
|
9
9
|
describe("UProgress.vue", () => {
|
|
10
|
-
// Props tests
|
|
11
10
|
describe("Props", () => {
|
|
12
|
-
|
|
13
|
-
it("sets the correct value for progress", () => {
|
|
11
|
+
it("Value – sets the correct value for progress", () => {
|
|
14
12
|
const value = 50;
|
|
15
13
|
const max = 100;
|
|
16
14
|
|
|
@@ -28,8 +26,7 @@ describe("UProgress.vue", () => {
|
|
|
28
26
|
expect(progressElement.attributes("max")).toBe(max.toString());
|
|
29
27
|
});
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
it("sets the correct max value for progress", () => {
|
|
29
|
+
it("Max – sets the correct max value for progress", () => {
|
|
33
30
|
const value = 5;
|
|
34
31
|
const max = 10;
|
|
35
32
|
|
|
@@ -46,8 +43,7 @@ describe("UProgress.vue", () => {
|
|
|
46
43
|
expect(progressElement.attributes("max")).toBe(max.toString());
|
|
47
44
|
});
|
|
48
45
|
|
|
49
|
-
|
|
50
|
-
it("handles array of steps for max prop", () => {
|
|
46
|
+
it("Max – handles array of steps for max prop", () => {
|
|
51
47
|
const value = 1;
|
|
52
48
|
const max = ["Step 1", "Step 2", "Step 3"];
|
|
53
49
|
|
|
@@ -65,8 +61,7 @@ describe("UProgress.vue", () => {
|
|
|
65
61
|
expect(activeStep.text()).toBe(max[value]);
|
|
66
62
|
});
|
|
67
63
|
|
|
68
|
-
|
|
69
|
-
it("applies the correct size class", () => {
|
|
64
|
+
it("Size – applies the correct size class", () => {
|
|
70
65
|
const size = {
|
|
71
66
|
xs: "h-0.5",
|
|
72
67
|
sm: "h-1",
|
|
@@ -91,8 +86,7 @@ describe("UProgress.vue", () => {
|
|
|
91
86
|
});
|
|
92
87
|
});
|
|
93
88
|
|
|
94
|
-
|
|
95
|
-
it("applies the correct color class", () => {
|
|
89
|
+
it("Color – applies the correct color class", () => {
|
|
96
90
|
const colors = [
|
|
97
91
|
"primary",
|
|
98
92
|
"secondary",
|
|
@@ -121,8 +115,7 @@ describe("UProgress.vue", () => {
|
|
|
121
115
|
});
|
|
122
116
|
});
|
|
123
117
|
|
|
124
|
-
|
|
125
|
-
it("renders the correct component based on variant", () => {
|
|
118
|
+
it("Variant – renders the correct component based on variant", () => {
|
|
126
119
|
const value = 50;
|
|
127
120
|
const max = 100;
|
|
128
121
|
const variants = ["progress", "stepper"];
|
|
@@ -146,8 +139,7 @@ describe("UProgress.vue", () => {
|
|
|
146
139
|
});
|
|
147
140
|
});
|
|
148
141
|
|
|
149
|
-
|
|
150
|
-
it("shows indicator when indicator prop is true", () => {
|
|
142
|
+
it("Indicator – shows indicator when indicator prop is true", () => {
|
|
151
143
|
const value = 50;
|
|
152
144
|
const indicator = true;
|
|
153
145
|
|
|
@@ -169,8 +161,7 @@ describe("UProgress.vue", () => {
|
|
|
169
161
|
expect(indicatorElement.attributes("style")).toContain(expectedWidth);
|
|
170
162
|
});
|
|
171
163
|
|
|
172
|
-
|
|
173
|
-
it("applies the correct data-test attribute", () => {
|
|
164
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
174
165
|
const value = 1;
|
|
175
166
|
const dataTest = "test-progress";
|
|
176
167
|
|
|
@@ -186,10 +177,8 @@ describe("UProgress.vue", () => {
|
|
|
186
177
|
});
|
|
187
178
|
});
|
|
188
179
|
|
|
189
|
-
// Slots tests
|
|
190
180
|
describe("Slots", () => {
|
|
191
|
-
|
|
192
|
-
it("renders content from indicator slot", () => {
|
|
181
|
+
it("Indicator – renders content from indicator slot", () => {
|
|
193
182
|
const value = 50;
|
|
194
183
|
const slotContent = "Custom Indicator";
|
|
195
184
|
const slotClass = "indicator-content";
|
|
@@ -209,8 +198,7 @@ describe("UProgress.vue", () => {
|
|
|
209
198
|
expect(component.find(`.${slotClass}`).text()).toBe(slotContent);
|
|
210
199
|
});
|
|
211
200
|
|
|
212
|
-
|
|
213
|
-
it("renders content from step slot", () => {
|
|
201
|
+
it("Step – renders content from step slot", () => {
|
|
214
202
|
const value = 1;
|
|
215
203
|
const max = ["Step 1", "Step 2", "Step 3"];
|
|
216
204
|
const slotContent = "Custom Step";
|
|
@@ -232,10 +220,8 @@ describe("UProgress.vue", () => {
|
|
|
232
220
|
});
|
|
233
221
|
});
|
|
234
222
|
|
|
235
|
-
// Exposed refs tests
|
|
236
223
|
describe("Exposed refs", () => {
|
|
237
|
-
|
|
238
|
-
it("exposes wrapperRef", () => {
|
|
224
|
+
it("wrapperRef – exposes wrapperRef", () => {
|
|
239
225
|
const value = 50;
|
|
240
226
|
|
|
241
227
|
const component = mount(UProgress, {
|
|
@@ -16,10 +16,8 @@ describe("UTab.vue", () => {
|
|
|
16
16
|
getUTabsSize: "md",
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
// Props tests
|
|
20
19
|
describe("Props", () => {
|
|
21
|
-
|
|
22
|
-
it("renders the correct label text", () => {
|
|
20
|
+
it("Label – renders the correct label text", () => {
|
|
23
21
|
const label = "Tab Item";
|
|
24
22
|
|
|
25
23
|
const component = mount(UTab, {
|
|
@@ -35,8 +33,7 @@ describe("UTab.vue", () => {
|
|
|
35
33
|
expect(component.text()).toBe(label);
|
|
36
34
|
});
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
it("uses the provided value for tab identity", async () => {
|
|
36
|
+
it("Value – uses the provided value for tab identity", async () => {
|
|
40
37
|
const value = "tab1";
|
|
41
38
|
const setUTabsSelectedItem = vi.fn();
|
|
42
39
|
|
|
@@ -57,8 +54,7 @@ describe("UTab.vue", () => {
|
|
|
57
54
|
expect(setUTabsSelectedItem).toHaveBeenCalledWith(value);
|
|
58
55
|
});
|
|
59
56
|
|
|
60
|
-
|
|
61
|
-
it("passes icon prop to UButton", () => {
|
|
57
|
+
it("Icon – passes icon prop to UButton", () => {
|
|
62
58
|
const icon = "home";
|
|
63
59
|
|
|
64
60
|
const component = mount(UTab, {
|
|
@@ -77,8 +73,7 @@ describe("UTab.vue", () => {
|
|
|
77
73
|
expect(button.props("icon")).toBe(icon);
|
|
78
74
|
});
|
|
79
75
|
|
|
80
|
-
|
|
81
|
-
it("passes leftIcon prop to UButton", () => {
|
|
76
|
+
it("Left – passes leftIcon prop to UButton", () => {
|
|
82
77
|
const leftIcon = "arrow-left";
|
|
83
78
|
|
|
84
79
|
const component = mount(UTab, {
|
|
@@ -97,8 +92,7 @@ describe("UTab.vue", () => {
|
|
|
97
92
|
expect(button.props("leftIcon")).toBe(leftIcon);
|
|
98
93
|
});
|
|
99
94
|
|
|
100
|
-
|
|
101
|
-
it("passes rightIcon prop to UButton", () => {
|
|
95
|
+
it("Right – passes rightIcon prop to UButton", () => {
|
|
102
96
|
const rightIcon = "arrow-right";
|
|
103
97
|
|
|
104
98
|
const component = mount(UTab, {
|
|
@@ -117,8 +111,7 @@ describe("UTab.vue", () => {
|
|
|
117
111
|
expect(button.props("rightIcon")).toBe(rightIcon);
|
|
118
112
|
});
|
|
119
113
|
|
|
120
|
-
|
|
121
|
-
it("passes disabled prop to UButton", () => {
|
|
114
|
+
it("Disabled – passes disabled prop to UButton", () => {
|
|
122
115
|
const disabled = true;
|
|
123
116
|
|
|
124
117
|
const component = mount(UTab, {
|
|
@@ -137,8 +130,7 @@ describe("UTab.vue", () => {
|
|
|
137
130
|
expect(button.props("disabled")).toBe(disabled);
|
|
138
131
|
});
|
|
139
132
|
|
|
140
|
-
|
|
141
|
-
it("applies the correct data-test attribute", () => {
|
|
133
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
142
134
|
const dataTest = "test-tab";
|
|
143
135
|
|
|
144
136
|
const component = mount(UTab, {
|
|
@@ -158,8 +150,7 @@ describe("UTab.vue", () => {
|
|
|
158
150
|
|
|
159
151
|
// Active state tests
|
|
160
152
|
describe("Active state", () => {
|
|
161
|
-
|
|
162
|
-
it("applies active classes when tab is selected", () => {
|
|
153
|
+
it("Active – applies active classes when tab is selected", () => {
|
|
163
154
|
const value = "tab1";
|
|
164
155
|
const expectedClass = "border-primary";
|
|
165
156
|
|
|
@@ -181,8 +172,7 @@ describe("UTab.vue", () => {
|
|
|
181
172
|
expect(button.attributes("class")).toContain(expectedClass);
|
|
182
173
|
});
|
|
183
174
|
|
|
184
|
-
|
|
185
|
-
it("applies inactive classes when tab is not selected", () => {
|
|
175
|
+
it("Inactive – applies inactive classes when tab is not selected", () => {
|
|
186
176
|
const value = "tab1";
|
|
187
177
|
const expectedClass = "border-transparent";
|
|
188
178
|
const nonExpectedClass = "border-primary";
|
|
@@ -206,8 +196,7 @@ describe("UTab.vue", () => {
|
|
|
206
196
|
expect(button.attributes("class")).not.toContain(nonExpectedClass);
|
|
207
197
|
});
|
|
208
198
|
|
|
209
|
-
|
|
210
|
-
it("does not call setUTabsSelectedItem when disabled", async () => {
|
|
199
|
+
it("Disabled – does not call setUTabsSelectedItem when disabled", async () => {
|
|
211
200
|
const disabled = true;
|
|
212
201
|
const setUTabsSelectedItem = vi.fn();
|
|
213
202
|
|
|
@@ -232,8 +221,7 @@ describe("UTab.vue", () => {
|
|
|
232
221
|
|
|
233
222
|
// Injected props tests
|
|
234
223
|
describe("Injected props", () => {
|
|
235
|
-
|
|
236
|
-
it("uses the size from UTabs provider", () => {
|
|
224
|
+
it("Size – uses the size from UTabs provider", () => {
|
|
237
225
|
const size = "lg";
|
|
238
226
|
|
|
239
227
|
const component = mount(UTab, {
|
|
@@ -254,8 +242,7 @@ describe("UTab.vue", () => {
|
|
|
254
242
|
expect(button.props("size")).toBe(size);
|
|
255
243
|
});
|
|
256
244
|
|
|
257
|
-
|
|
258
|
-
it("uses the block prop from UTabs provider", () => {
|
|
245
|
+
it("Block – uses the block prop from UTabs provider", () => {
|
|
259
246
|
const block = true;
|
|
260
247
|
|
|
261
248
|
const component = mount(UTab, {
|
|
@@ -276,8 +263,7 @@ describe("UTab.vue", () => {
|
|
|
276
263
|
expect(button.props("block")).toBe(block);
|
|
277
264
|
});
|
|
278
265
|
|
|
279
|
-
|
|
280
|
-
it("uses the square prop from UTabs provider", () => {
|
|
266
|
+
it("Square – uses the square prop from UTabs provider", () => {
|
|
281
267
|
const square = true;
|
|
282
268
|
|
|
283
269
|
const component = mount(UTab, {
|
|
@@ -298,8 +284,7 @@ describe("UTab.vue", () => {
|
|
|
298
284
|
expect(button.props("square")).toBe(square);
|
|
299
285
|
});
|
|
300
286
|
|
|
301
|
-
|
|
302
|
-
it("applies correct classes based on scrollable prop from UTabs", () => {
|
|
287
|
+
it("Scrollable – applies correct classes based on scrollable prop from UTabs", () => {
|
|
303
288
|
const scrollable = false;
|
|
304
289
|
const expectedClasses = "-mb-px";
|
|
305
290
|
|
|
@@ -322,10 +307,8 @@ describe("UTab.vue", () => {
|
|
|
322
307
|
});
|
|
323
308
|
});
|
|
324
309
|
|
|
325
|
-
// Slots tests
|
|
326
310
|
describe("Slots", () => {
|
|
327
|
-
|
|
328
|
-
it("renders content from left slot", () => {
|
|
311
|
+
it("Left – renders content from left slot", () => {
|
|
329
312
|
const label = "Tab Item";
|
|
330
313
|
const slotText = "Left";
|
|
331
314
|
const slotClass = "left-content";
|
|
@@ -348,8 +331,7 @@ describe("UTab.vue", () => {
|
|
|
348
331
|
expect(component.find(`.${slotClass}`).text()).toBe(slotText);
|
|
349
332
|
});
|
|
350
333
|
|
|
351
|
-
|
|
352
|
-
it("renders content from label slot", () => {
|
|
334
|
+
it("Label – renders content from label slot", () => {
|
|
353
335
|
const label = "Tab Item";
|
|
354
336
|
const slotText = "Custom Label";
|
|
355
337
|
const slotClass = "label-content";
|
|
@@ -372,8 +354,7 @@ describe("UTab.vue", () => {
|
|
|
372
354
|
expect(component.find(`.${slotClass}`).text()).toBe(slotText);
|
|
373
355
|
});
|
|
374
356
|
|
|
375
|
-
|
|
376
|
-
it("renders content from right slot", () => {
|
|
357
|
+
it("Right – renders content from right slot", () => {
|
|
377
358
|
const label = "Tab Item";
|
|
378
359
|
const slotText = "Right";
|
|
379
360
|
const slotClass = "right-content";
|
|
@@ -396,8 +377,7 @@ describe("UTab.vue", () => {
|
|
|
396
377
|
expect(component.find(`.${slotClass}`).text()).toBe(slotText);
|
|
397
378
|
});
|
|
398
379
|
|
|
399
|
-
|
|
400
|
-
it("passes active state to slots", () => {
|
|
380
|
+
it("Slot – passes active state to slots", () => {
|
|
401
381
|
const value = "tab1";
|
|
402
382
|
|
|
403
383
|
const component = mount(UTab, {
|
|
@@ -419,8 +399,7 @@ describe("UTab.vue", () => {
|
|
|
419
399
|
expect(component.find('[data-active="true"]').exists()).toBe(true);
|
|
420
400
|
});
|
|
421
401
|
|
|
422
|
-
|
|
423
|
-
it("passes icon-name to slots", () => {
|
|
402
|
+
it("Slot – passes icon-name to slots", () => {
|
|
424
403
|
const leftIcon = "home";
|
|
425
404
|
|
|
426
405
|
const component = mount(UTab, {
|
|
@@ -441,10 +420,8 @@ describe("UTab.vue", () => {
|
|
|
441
420
|
});
|
|
442
421
|
});
|
|
443
422
|
|
|
444
|
-
// Events tests
|
|
445
423
|
describe("Events", () => {
|
|
446
|
-
|
|
447
|
-
it("calls setUTabsSelectedItem when clicked", async () => {
|
|
424
|
+
it("Click – calls setUTabsSelectedItem when clicked", async () => {
|
|
448
425
|
const value = "tab1";
|
|
449
426
|
const setUTabsSelectedItem = vi.fn();
|
|
450
427
|
|
|
@@ -466,10 +443,8 @@ describe("UTab.vue", () => {
|
|
|
466
443
|
});
|
|
467
444
|
});
|
|
468
445
|
|
|
469
|
-
// Exposed refs tests
|
|
470
446
|
describe("Exposed refs", () => {
|
|
471
|
-
|
|
472
|
-
it("exposes button ref", () => {
|
|
447
|
+
it("button – exposes button ref", () => {
|
|
473
448
|
const component = mount(UTab, {
|
|
474
449
|
props: {
|
|
475
450
|
label: "Tab Item",
|
|
@@ -15,10 +15,8 @@ describe("UTabs.vue", () => {
|
|
|
15
15
|
{ value: "tab3", label: "Tab 3" },
|
|
16
16
|
];
|
|
17
17
|
|
|
18
|
-
// Props tests
|
|
19
18
|
describe("Props", () => {
|
|
20
|
-
|
|
21
|
-
it("correctly sets the selected tab", () => {
|
|
19
|
+
it("ModelValue – correctly sets the selected tab", () => {
|
|
22
20
|
const modelValue = "tab2";
|
|
23
21
|
const expectedActiveClass = "border-primary";
|
|
24
22
|
|
|
@@ -41,8 +39,7 @@ describe("UTabs.vue", () => {
|
|
|
41
39
|
expect(activeTab.classes()).toContain(expectedActiveClass);
|
|
42
40
|
});
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
it("renders the correct number of tabs from options", () => {
|
|
42
|
+
it("Options – renders the correct number of tabs from options", () => {
|
|
46
43
|
const component = mount(UTabs, {
|
|
47
44
|
props: {
|
|
48
45
|
options,
|
|
@@ -61,8 +58,7 @@ describe("UTabs.vue", () => {
|
|
|
61
58
|
});
|
|
62
59
|
});
|
|
63
60
|
|
|
64
|
-
|
|
65
|
-
it("applies the correct size to tabs", () => {
|
|
61
|
+
it("Size – applies the correct size to tabs", () => {
|
|
66
62
|
const sizes = ["2xs", "xs", "sm", "md", "lg", "xl"];
|
|
67
63
|
|
|
68
64
|
sizes.forEach((size) => {
|
|
@@ -84,8 +80,7 @@ describe("UTabs.vue", () => {
|
|
|
84
80
|
});
|
|
85
81
|
});
|
|
86
82
|
|
|
87
|
-
|
|
88
|
-
it("applies scrollable class when scrollable prop is true", () => {
|
|
83
|
+
it("Scrollable – applies scrollable class when scrollable prop is true", () => {
|
|
89
84
|
const scrollable = true;
|
|
90
85
|
|
|
91
86
|
const component = mount(UTabs, {
|
|
@@ -102,8 +97,7 @@ describe("UTabs.vue", () => {
|
|
|
102
97
|
expect(tabsContainer.classes()).toContain("scroll-smooth");
|
|
103
98
|
});
|
|
104
99
|
|
|
105
|
-
|
|
106
|
-
it("shows scroll buttons when scrollable and content overflows", async () => {
|
|
100
|
+
it("Scroll – shows scroll buttons when scrollable and content overflows", async () => {
|
|
107
101
|
const manyOptions: UTabsOption[] = Array.from({ length: 10 }, (_, i) => ({
|
|
108
102
|
value: `tab${i}`,
|
|
109
103
|
label: `Tab ${i}`,
|
|
@@ -140,8 +134,7 @@ describe("UTabs.vue", () => {
|
|
|
140
134
|
expect(nextButton).toBeDefined();
|
|
141
135
|
});
|
|
142
136
|
|
|
143
|
-
|
|
144
|
-
it("provides block value to tabs", () => {
|
|
137
|
+
it("Block – provides block value to tabs", () => {
|
|
145
138
|
const block = true;
|
|
146
139
|
|
|
147
140
|
const component = mount(UTabs, {
|
|
@@ -161,8 +154,7 @@ describe("UTabs.vue", () => {
|
|
|
161
154
|
expect(button.props("block")).toBe(block);
|
|
162
155
|
});
|
|
163
156
|
|
|
164
|
-
|
|
165
|
-
it("provides square value to tabs", () => {
|
|
157
|
+
it("Square – provides square value to tabs", () => {
|
|
166
158
|
const square = true;
|
|
167
159
|
|
|
168
160
|
const component = mount(UTabs, {
|
|
@@ -182,8 +174,7 @@ describe("UTabs.vue", () => {
|
|
|
182
174
|
expect(button.props("square")).toBe(square);
|
|
183
175
|
});
|
|
184
176
|
|
|
185
|
-
|
|
186
|
-
it("applies the correct data-test attribute", () => {
|
|
177
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
187
178
|
const dataTest = "test-tabs";
|
|
188
179
|
const singleOption = [options[0]];
|
|
189
180
|
|
|
@@ -207,10 +198,8 @@ describe("UTabs.vue", () => {
|
|
|
207
198
|
});
|
|
208
199
|
});
|
|
209
200
|
|
|
210
|
-
// Slots tests
|
|
211
201
|
describe("Slots", () => {
|
|
212
|
-
|
|
213
|
-
it("renders content from default slot", () => {
|
|
202
|
+
it("Default – renders content from default slot", () => {
|
|
214
203
|
const slotContent = "Custom Tabs";
|
|
215
204
|
const slotClass = "custom-tabs";
|
|
216
205
|
|
|
@@ -224,8 +213,7 @@ describe("UTabs.vue", () => {
|
|
|
224
213
|
expect(component.find(`.${slotClass}`).text()).toBe(slotContent);
|
|
225
214
|
});
|
|
226
215
|
|
|
227
|
-
|
|
228
|
-
it("renders content from prev slot when scrollable", async () => {
|
|
216
|
+
it("Prev – renders content from prev slot when scrollable", async () => {
|
|
229
217
|
const slotContent = "Prev";
|
|
230
218
|
const slotClass = "prev-content";
|
|
231
219
|
const dataTest = "test-tabs";
|
|
@@ -261,8 +249,7 @@ describe("UTabs.vue", () => {
|
|
|
261
249
|
expect(component.find(`.${slotClass}`).text()).toBe(slotContent);
|
|
262
250
|
});
|
|
263
251
|
|
|
264
|
-
|
|
265
|
-
it("renders content from next slot when scrollable", async () => {
|
|
252
|
+
it("Next – renders content from next slot when scrollable", async () => {
|
|
266
253
|
const slotContent = "Next";
|
|
267
254
|
const slotClass = "next-content";
|
|
268
255
|
const dataTest = "test-tabs";
|
|
@@ -299,10 +286,8 @@ describe("UTabs.vue", () => {
|
|
|
299
286
|
});
|
|
300
287
|
});
|
|
301
288
|
|
|
302
|
-
// Events tests
|
|
303
289
|
describe("Events", () => {
|
|
304
|
-
|
|
305
|
-
it("emits update:modelValue event when tab is clicked", async () => {
|
|
290
|
+
it("Update:modelValue – emits update:modelValue event when tab is clicked", async () => {
|
|
306
291
|
const component = mount(UTabs, {
|
|
307
292
|
props: {
|
|
308
293
|
options,
|
|
@@ -321,10 +306,8 @@ describe("UTabs.vue", () => {
|
|
|
321
306
|
});
|
|
322
307
|
});
|
|
323
308
|
|
|
324
|
-
// Exposed refs tests
|
|
325
309
|
describe("Exposed refs", () => {
|
|
326
|
-
|
|
327
|
-
it("exposes wrapperRef", () => {
|
|
310
|
+
it("wrapperRef – exposes wrapperRef", () => {
|
|
328
311
|
const singleOption = [options[0]];
|
|
329
312
|
|
|
330
313
|
const component = mount(UTabs, {
|