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
|
@@ -8,10 +8,8 @@ import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
|
8
8
|
import type { Props } from "../types";
|
|
9
9
|
|
|
10
10
|
describe("UChip.vue", () => {
|
|
11
|
-
// Props tests
|
|
12
11
|
describe("Props", () => {
|
|
13
|
-
|
|
14
|
-
it("renders UIcon when icon prop is provided", () => {
|
|
12
|
+
it("Icon – renders UIcon when icon prop is provided", () => {
|
|
15
13
|
const icon = "close";
|
|
16
14
|
|
|
17
15
|
const component = mount(UChip, {
|
|
@@ -28,8 +26,7 @@ describe("UChip.vue", () => {
|
|
|
28
26
|
expect(nestedUDotComponents.length).toBe(0);
|
|
29
27
|
});
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
it("renders UDot when no icon prop is provided", () => {
|
|
29
|
+
it("Default – renders UDot when no icon prop is provided", () => {
|
|
33
30
|
const component = mount(UChip, {});
|
|
34
31
|
|
|
35
32
|
const nestedUIconComponents = component.findAllComponents(UIcon);
|
|
@@ -39,8 +36,7 @@ describe("UChip.vue", () => {
|
|
|
39
36
|
expect(nestedUDotComponents.length).toBe(1);
|
|
40
37
|
});
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
it("applies the correct color class to UDot component", async () => {
|
|
39
|
+
it("Color – applies the correct color class to UDot component", async () => {
|
|
44
40
|
const colors = [
|
|
45
41
|
"primary",
|
|
46
42
|
"secondary",
|
|
@@ -68,8 +64,7 @@ describe("UChip.vue", () => {
|
|
|
68
64
|
});
|
|
69
65
|
});
|
|
70
66
|
|
|
71
|
-
|
|
72
|
-
it("applies the correct color class to UIcon component", async () => {
|
|
67
|
+
it("Color – applies the correct color class to UIcon component", async () => {
|
|
73
68
|
const colors = [
|
|
74
69
|
"primary",
|
|
75
70
|
"secondary",
|
|
@@ -98,8 +93,7 @@ describe("UChip.vue", () => {
|
|
|
98
93
|
});
|
|
99
94
|
});
|
|
100
95
|
|
|
101
|
-
|
|
102
|
-
it("applies the correct size class", async () => {
|
|
96
|
+
it("Size – applies the correct size class", async () => {
|
|
103
97
|
const sizes = ["3xs", "2xs", "xs", "sm", "md", "lg", "xl", "2xl"];
|
|
104
98
|
|
|
105
99
|
sizes.forEach((size) => {
|
|
@@ -115,8 +109,7 @@ describe("UChip.vue", () => {
|
|
|
115
109
|
});
|
|
116
110
|
});
|
|
117
111
|
|
|
118
|
-
|
|
119
|
-
it("applies the correct xPosition class", async () => {
|
|
112
|
+
it("X Position – applies the correct xPosition class", async () => {
|
|
120
113
|
const xPositions = {
|
|
121
114
|
left: "left-px",
|
|
122
115
|
right: "right-px",
|
|
@@ -135,8 +128,7 @@ describe("UChip.vue", () => {
|
|
|
135
128
|
});
|
|
136
129
|
});
|
|
137
130
|
|
|
138
|
-
|
|
139
|
-
it("applies the correct yPosition class", async () => {
|
|
131
|
+
it("Y Position – applies the correct yPosition class", async () => {
|
|
140
132
|
const yPositions = {
|
|
141
133
|
top: "top-px",
|
|
142
134
|
bottom: "bottom-px",
|
|
@@ -155,8 +147,7 @@ describe("UChip.vue", () => {
|
|
|
155
147
|
});
|
|
156
148
|
});
|
|
157
149
|
|
|
158
|
-
|
|
159
|
-
it("applies transform classes when inset prop is false", async () => {
|
|
150
|
+
it("Inset – applies transform classes when inset prop is false", async () => {
|
|
160
151
|
const inset = false;
|
|
161
152
|
const yPosition = "top";
|
|
162
153
|
const xPosition = "right";
|
|
@@ -175,8 +166,7 @@ describe("UChip.vue", () => {
|
|
|
175
166
|
expect(chipWrapper.attributes("class")).toContain("translate-x-1/2");
|
|
176
167
|
});
|
|
177
168
|
|
|
178
|
-
|
|
179
|
-
it("does not apply transform classes when inset prop is true", async () => {
|
|
169
|
+
it("Inset – does not apply transform classes when inset prop is true", async () => {
|
|
180
170
|
const inset = true;
|
|
181
171
|
const yPosition = "top";
|
|
182
172
|
const xPosition = "right";
|
|
@@ -195,8 +185,7 @@ describe("UChip.vue", () => {
|
|
|
195
185
|
expect(chipWrapper.attributes("class")).not.toContain("translate-x-1/2");
|
|
196
186
|
});
|
|
197
187
|
|
|
198
|
-
|
|
199
|
-
it("applies the correct data-test attribute", () => {
|
|
188
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
200
189
|
const dataTest = "test-chip";
|
|
201
190
|
|
|
202
191
|
const component = mount(UChip, {
|
|
@@ -209,10 +198,8 @@ describe("UChip.vue", () => {
|
|
|
209
198
|
});
|
|
210
199
|
});
|
|
211
200
|
|
|
212
|
-
// Slots tests
|
|
213
201
|
describe("Slots", () => {
|
|
214
|
-
|
|
215
|
-
it("renders content from default slot", () => {
|
|
202
|
+
it("Default – renders content from default slot", () => {
|
|
216
203
|
const slotContent = "Custom Content";
|
|
217
204
|
|
|
218
205
|
const component = mount(UChip, {
|
|
@@ -224,8 +211,7 @@ describe("UChip.vue", () => {
|
|
|
224
211
|
expect(component.text()).toContain(slotContent);
|
|
225
212
|
});
|
|
226
213
|
|
|
227
|
-
|
|
228
|
-
it("renders content from chip slot", () => {
|
|
214
|
+
it("Chip – renders content from chip slot", () => {
|
|
229
215
|
const slotText = "Custom Chip";
|
|
230
216
|
const slotClass = "custom-chip";
|
|
231
217
|
|
|
@@ -242,10 +228,8 @@ describe("UChip.vue", () => {
|
|
|
242
228
|
});
|
|
243
229
|
});
|
|
244
230
|
|
|
245
|
-
// Exposed refs tests
|
|
246
231
|
describe("Exposed refs", () => {
|
|
247
|
-
|
|
248
|
-
it("exposes wrapperRef", () => {
|
|
232
|
+
it("wrapperRef – exposes wrapperRef", () => {
|
|
249
233
|
const component = mount(UChip, {});
|
|
250
234
|
|
|
251
235
|
expect(component.vm.wrapperRef).toBeDefined();
|
|
@@ -7,10 +7,8 @@ import type { Props } from "../types";
|
|
|
7
7
|
import type { ComponentPublicInstance } from "vue";
|
|
8
8
|
|
|
9
9
|
describe("UDot.vue", () => {
|
|
10
|
-
// Props tests
|
|
11
10
|
describe("Props", () => {
|
|
12
|
-
|
|
13
|
-
it("applies the correct size class", () => {
|
|
11
|
+
it("Size – applies the correct size class", () => {
|
|
14
12
|
const sizes = {
|
|
15
13
|
xs: "size-1",
|
|
16
14
|
sm: "size-1.5",
|
|
@@ -30,8 +28,7 @@ describe("UDot.vue", () => {
|
|
|
30
28
|
});
|
|
31
29
|
});
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
it("applies the correct color class", () => {
|
|
31
|
+
it("Color – applies the correct color class", () => {
|
|
35
32
|
const colors = [
|
|
36
33
|
"primary",
|
|
37
34
|
"secondary",
|
|
@@ -55,8 +52,7 @@ describe("UDot.vue", () => {
|
|
|
55
52
|
});
|
|
56
53
|
});
|
|
57
54
|
|
|
58
|
-
|
|
59
|
-
it("applies the correct data-test attribute", () => {
|
|
55
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
60
56
|
const dataTest = "test-dot";
|
|
61
57
|
|
|
62
58
|
const component = mount(UDot, {
|
|
@@ -69,10 +65,8 @@ describe("UDot.vue", () => {
|
|
|
69
65
|
});
|
|
70
66
|
});
|
|
71
67
|
|
|
72
|
-
// Exposed refs tests
|
|
73
68
|
describe("Exposed refs", () => {
|
|
74
|
-
|
|
75
|
-
it("exposes dotRef", () => {
|
|
69
|
+
it("dotRef – exposes dotRef", () => {
|
|
76
70
|
const component = mount(UDot);
|
|
77
71
|
|
|
78
72
|
expect(
|
|
@@ -14,10 +14,8 @@ vi.mock("../../utils/theme.ts", () => ({
|
|
|
14
14
|
}));
|
|
15
15
|
|
|
16
16
|
describe("UThemeColorToggle.vue", () => {
|
|
17
|
-
// Props tests
|
|
18
17
|
describe("Props", () => {
|
|
19
|
-
|
|
20
|
-
it("applies the correct size to color pickers", async () => {
|
|
18
|
+
it("Size – applies the correct size to color pickers", async () => {
|
|
21
19
|
const sizes = ["sm", "md", "lg"];
|
|
22
20
|
|
|
23
21
|
sizes.forEach((size) => {
|
|
@@ -39,8 +37,7 @@ describe("UThemeColorToggle.vue", () => {
|
|
|
39
37
|
});
|
|
40
38
|
});
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
it("sets the primary color correctly", async () => {
|
|
40
|
+
it("Primary – sets the primary color correctly", async () => {
|
|
44
41
|
const primary = "blue";
|
|
45
42
|
|
|
46
43
|
const component = mount(UThemeColorToggle, {
|
|
@@ -55,8 +52,7 @@ describe("UThemeColorToggle.vue", () => {
|
|
|
55
52
|
expect(primaryColorPicker.props("modelValue")).toBe(primary);
|
|
56
53
|
});
|
|
57
54
|
|
|
58
|
-
|
|
59
|
-
it("sets the neutral color correctly", async () => {
|
|
55
|
+
it("Neutral – sets the neutral color correctly", async () => {
|
|
60
56
|
const neutral = "gray";
|
|
61
57
|
|
|
62
58
|
const component = mount(UThemeColorToggle, {
|
|
@@ -71,8 +67,7 @@ describe("UThemeColorToggle.vue", () => {
|
|
|
71
67
|
expect(neutralColorPicker.props("modelValue")).toBe(neutral);
|
|
72
68
|
});
|
|
73
69
|
|
|
74
|
-
|
|
75
|
-
it("passes primaryColors to the primary color picker", async () => {
|
|
70
|
+
it("PrimaryColors – passes primaryColors to the primary color picker", async () => {
|
|
76
71
|
const primaryColors = { blue: "#0000FF", red: "#FF0000" };
|
|
77
72
|
|
|
78
73
|
const component = mount(UThemeColorToggle, {
|
|
@@ -86,8 +81,7 @@ describe("UThemeColorToggle.vue", () => {
|
|
|
86
81
|
expect(primaryColorPicker.props("colors")).toEqual(primaryColors);
|
|
87
82
|
});
|
|
88
83
|
|
|
89
|
-
|
|
90
|
-
it("passes neutralColors to the neutral color picker", async () => {
|
|
84
|
+
it("NeutralColors – passes neutralColors to the neutral color picker", async () => {
|
|
91
85
|
const neutralColors = { gray: "#808080", black: "#000000" };
|
|
92
86
|
|
|
93
87
|
const component = mount(UThemeColorToggle, {
|
|
@@ -101,8 +95,7 @@ describe("UThemeColorToggle.vue", () => {
|
|
|
101
95
|
expect(neutralColorPicker.props("colors")).toEqual(neutralColors);
|
|
102
96
|
});
|
|
103
97
|
|
|
104
|
-
|
|
105
|
-
it("passes primaryLabels to the primary color picker", async () => {
|
|
98
|
+
it("PrimaryLabels – passes primaryLabels to the primary color picker", async () => {
|
|
106
99
|
const primaryLabels = { blue: "Blue", red: "Red" };
|
|
107
100
|
|
|
108
101
|
const component = mount(UThemeColorToggle, {
|
|
@@ -117,8 +110,7 @@ describe("UThemeColorToggle.vue", () => {
|
|
|
117
110
|
expect(primaryColorPicker.props("labels")).toEqual(primaryLabels);
|
|
118
111
|
});
|
|
119
112
|
|
|
120
|
-
|
|
121
|
-
it("passes neutralLabels to the neutral color picker", async () => {
|
|
113
|
+
it("NeutralLabels – passes neutralLabels to the neutral color picker", async () => {
|
|
122
114
|
const neutralLabels = { gray: "Gray", black: "Black" };
|
|
123
115
|
|
|
124
116
|
const component = mount(UThemeColorToggle, {
|
|
@@ -133,8 +125,7 @@ describe("UThemeColorToggle.vue", () => {
|
|
|
133
125
|
expect(neutralColorPicker.props("labels")).toEqual(neutralLabels);
|
|
134
126
|
});
|
|
135
127
|
|
|
136
|
-
|
|
137
|
-
it("applies the correct id attribute", () => {
|
|
128
|
+
it("ID – applies the correct id attribute", () => {
|
|
138
129
|
const id = "test-theme-toggle-id";
|
|
139
130
|
|
|
140
131
|
const component = mount(UThemeColorToggle, {
|
|
@@ -146,8 +137,7 @@ describe("UThemeColorToggle.vue", () => {
|
|
|
146
137
|
expect(component.attributes("id")).toBe(id);
|
|
147
138
|
});
|
|
148
139
|
|
|
149
|
-
|
|
150
|
-
it("applies the correct data-test attribute", () => {
|
|
140
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
151
141
|
const dataTest = "test-theme-toggle";
|
|
152
142
|
|
|
153
143
|
const component = mount(UThemeColorToggle, {
|
|
@@ -159,8 +149,7 @@ describe("UThemeColorToggle.vue", () => {
|
|
|
159
149
|
expect(component.attributes("data-test")).toBe(dataTest);
|
|
160
150
|
});
|
|
161
151
|
|
|
162
|
-
|
|
163
|
-
it("shows divider when both primaryColors and neutralColors are provided", () => {
|
|
152
|
+
it("Divider – shows divider when both primaryColors and neutralColors are provided", () => {
|
|
164
153
|
const component = mount(UThemeColorToggle, {
|
|
165
154
|
props: {
|
|
166
155
|
primaryColors: { blue: "#0000FF" },
|
|
@@ -194,10 +183,8 @@ describe("UThemeColorToggle.vue", () => {
|
|
|
194
183
|
});
|
|
195
184
|
});
|
|
196
185
|
|
|
197
|
-
// Events tests
|
|
198
186
|
describe("Events", () => {
|
|
199
|
-
|
|
200
|
-
it("emits update:primary event when primary color changes", async () => {
|
|
187
|
+
it("update:primary – emits update:primary event when primary color changes", async () => {
|
|
201
188
|
const primaryColors = { blue: "#0000FF", red: "#FF0000" };
|
|
202
189
|
const newColor = "red";
|
|
203
190
|
|
|
@@ -215,8 +202,7 @@ describe("UThemeColorToggle.vue", () => {
|
|
|
215
202
|
expect(component.emitted("update:primary")![0]).toEqual([newColor]);
|
|
216
203
|
});
|
|
217
204
|
|
|
218
|
-
|
|
219
|
-
it("emits update:neutral event when neutral color changes", async () => {
|
|
205
|
+
it("update:neutral – emits update:neutral event when neutral color changes", async () => {
|
|
220
206
|
const neutralColors = { gray: "#808080", black: "#000000" };
|
|
221
207
|
const newColor = "black";
|
|
222
208
|
|
|
@@ -235,10 +221,8 @@ describe("UThemeColorToggle.vue", () => {
|
|
|
235
221
|
});
|
|
236
222
|
});
|
|
237
223
|
|
|
238
|
-
// Exposed refs tests
|
|
239
224
|
describe("Exposed refs", () => {
|
|
240
|
-
|
|
241
|
-
it("exposes listRef", () => {
|
|
225
|
+
it("listRef – exposes listRef", () => {
|
|
242
226
|
const component = mount(UThemeColorToggle, {});
|
|
243
227
|
|
|
244
228
|
expect(
|
package/ui.skeleton/config.ts
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
|
-
body:
|
|
3
|
-
base: "rounded-medium animate-pulse h-24 w-full bg-neutral/50",
|
|
4
|
-
variants: {
|
|
5
|
-
variant: {
|
|
6
|
-
light: "brightness-75",
|
|
7
|
-
default: "brightness-50",
|
|
8
|
-
dark: "brightness-25",
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
defaults: {
|
|
13
|
-
variant: "default",
|
|
14
|
-
},
|
|
2
|
+
body: "rounded-medium animate-pulse h-24 w-full bg-inverted/15",
|
|
15
3
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryFn } from "@storybook/vue3-vite";
|
|
2
|
-
import {
|
|
2
|
+
import { getArgTypes, getDocsDescription } from "../../utils/storybook";
|
|
3
3
|
|
|
4
4
|
import USkeleton from "../USkeleton.vue";
|
|
5
5
|
import UCol from "../../ui.container-col/UCol.vue";
|
|
@@ -7,7 +7,7 @@ import UCol from "../../ui.container-col/UCol.vue";
|
|
|
7
7
|
import type { Props } from "../types";
|
|
8
8
|
|
|
9
9
|
interface SkeletonArgs extends Props {
|
|
10
|
-
enum
|
|
10
|
+
enum?: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export default {
|
|
@@ -32,26 +32,9 @@ const DefaultTemplate: StoryFn<SkeletonArgs> = (args: SkeletonArgs) => ({
|
|
|
32
32
|
`,
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
const EnumVariantTemplate: StoryFn<SkeletonArgs> = (args: SkeletonArgs, { argTypes }) => ({
|
|
36
|
-
components: { USkeleton, UCol },
|
|
37
|
-
setup: () => ({ args, argTypes, getArgs }),
|
|
38
|
-
template: `
|
|
39
|
-
<UCol>
|
|
40
|
-
<USkeleton
|
|
41
|
-
v-for="option in argTypes?.[args.enum]?.options"
|
|
42
|
-
v-bind="getArgs(args, option)"
|
|
43
|
-
:key="option"
|
|
44
|
-
/>
|
|
45
|
-
</UCol>
|
|
46
|
-
`,
|
|
47
|
-
});
|
|
48
|
-
|
|
49
35
|
export const Default = DefaultTemplate.bind({});
|
|
50
36
|
Default.args = {};
|
|
51
37
|
|
|
52
|
-
export const Variant = EnumVariantTemplate.bind({});
|
|
53
|
-
Variant.args = { enum: "variant" };
|
|
54
|
-
|
|
55
38
|
export const Slot: StoryFn<SkeletonArgs> = (args) => ({
|
|
56
39
|
components: { USkeleton, UCol },
|
|
57
40
|
setup() {
|
|
@@ -59,7 +42,7 @@ export const Slot: StoryFn<SkeletonArgs> = (args) => ({
|
|
|
59
42
|
},
|
|
60
43
|
template: `
|
|
61
44
|
<USkeleton v-bind="args" class="max-w-96 p-4">
|
|
62
|
-
<USkeleton class="w-15 h-10 rounded-small"
|
|
45
|
+
<USkeleton class="w-15 h-10 rounded-small" />
|
|
63
46
|
</USkeleton>
|
|
64
47
|
`,
|
|
65
48
|
});
|
|
@@ -3,32 +3,9 @@ import { describe, it, expect } from "vitest";
|
|
|
3
3
|
|
|
4
4
|
import USkeleton from "../USkeleton.vue";
|
|
5
5
|
|
|
6
|
-
import type { Props } from "../types";
|
|
7
|
-
|
|
8
6
|
describe("USkeleton.vue", () => {
|
|
9
|
-
// Props tests
|
|
10
7
|
describe("Props", () => {
|
|
11
|
-
|
|
12
|
-
it("applies the correct variant class", () => {
|
|
13
|
-
const variants = {
|
|
14
|
-
light: "brightness-75",
|
|
15
|
-
default: "brightness-50",
|
|
16
|
-
dark: "brightness-25",
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
Object.entries(variants).forEach(([variant, classes]) => {
|
|
20
|
-
const component = mount(USkeleton, {
|
|
21
|
-
props: {
|
|
22
|
-
variant: variant as Props["variant"],
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
expect(component.attributes("class")).toContain(classes);
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// DataTest prop
|
|
31
|
-
it("applies the correct data-test attribute", () => {
|
|
8
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
32
9
|
const dataTest = "test-skeleton";
|
|
33
10
|
|
|
34
11
|
const component = mount(USkeleton, {
|
|
@@ -41,10 +18,8 @@ describe("USkeleton.vue", () => {
|
|
|
41
18
|
});
|
|
42
19
|
});
|
|
43
20
|
|
|
44
|
-
// Slots tests
|
|
45
21
|
describe("Slots", () => {
|
|
46
|
-
|
|
47
|
-
it("renders content from default slot", () => {
|
|
22
|
+
it("Default – renders content from default slot", () => {
|
|
48
23
|
const slotContent = "Custom Content";
|
|
49
24
|
const slotClass = "custom-content";
|
|
50
25
|
|
package/ui.skeleton/types.ts
CHANGED
|
@@ -24,10 +24,10 @@ const { getDataTest, inputAttrs, labelAttrs, wrapperAttrs } = useUI<Config>(defa
|
|
|
24
24
|
|
|
25
25
|
<template>
|
|
26
26
|
<div v-bind="wrapperAttrs" :data-test="getDataTest()">
|
|
27
|
-
<USkeleton
|
|
27
|
+
<USkeleton v-bind="inputAttrs" />
|
|
28
28
|
<!-- @slot Use it to customize the label skeleton. -->
|
|
29
29
|
<slot v-if="label" name="label">
|
|
30
|
-
<USkeleton
|
|
30
|
+
<USkeleton v-bind="labelAttrs" />
|
|
31
31
|
</slot>
|
|
32
32
|
</div>
|
|
33
33
|
</template>
|
|
@@ -8,7 +8,7 @@ import USkeleton from "../../ui.skeleton/USkeleton.vue";
|
|
|
8
8
|
import type { Props } from "../types";
|
|
9
9
|
|
|
10
10
|
interface SkeletonChoiceArgs extends Props {
|
|
11
|
-
enum: "
|
|
11
|
+
enum: "size" | "labelAlign" | "type";
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export default {
|
|
@@ -73,9 +73,6 @@ LabelAlign.args = { enum: "labelAlign" };
|
|
|
73
73
|
export const Sizes = EnumVariantTemplate.bind({});
|
|
74
74
|
Sizes.args = { enum: "size" };
|
|
75
75
|
|
|
76
|
-
export const Variant = EnumVariantTemplate.bind({});
|
|
77
|
-
Variant.args = { enum: "variant" };
|
|
78
|
-
|
|
79
76
|
export const LabelSlot: StoryFn<SkeletonChoiceArgs> = (args) => ({
|
|
80
77
|
components: { USkeletonChoice, USkeleton, UCol },
|
|
81
78
|
setup() {
|
|
@@ -85,8 +82,8 @@ export const LabelSlot: StoryFn<SkeletonChoiceArgs> = (args) => ({
|
|
|
85
82
|
<USkeletonChoice v-bind="args">
|
|
86
83
|
<template #label>
|
|
87
84
|
<UCol gap="2xs">
|
|
88
|
-
<USkeleton class="h-3 w-36 rounded-small"
|
|
89
|
-
<USkeleton class="h-1.5 rounded-small"
|
|
85
|
+
<USkeleton class="h-3 w-36 rounded-small" />
|
|
86
|
+
<USkeleton class="h-1.5 rounded-small" />
|
|
90
87
|
</UCol>
|
|
91
88
|
</template>
|
|
92
89
|
</USkeletonChoice>
|
|
@@ -7,10 +7,8 @@ import USkeleton from "../../ui.skeleton/USkeleton.vue";
|
|
|
7
7
|
import type { Props } from "../types";
|
|
8
8
|
|
|
9
9
|
describe("USkeletonChoice.vue", () => {
|
|
10
|
-
// Props tests
|
|
11
10
|
describe("Props", () => {
|
|
12
|
-
|
|
13
|
-
it("renders label skeleton when label prop is true", () => {
|
|
11
|
+
it("Label – renders label skeleton when label prop is true", () => {
|
|
14
12
|
const label = true;
|
|
15
13
|
|
|
16
14
|
const component = mount(USkeletonChoice, {
|
|
@@ -24,8 +22,7 @@ describe("USkeletonChoice.vue", () => {
|
|
|
24
22
|
expect(skeletons.length).toBe(2); // Input and label skeletons
|
|
25
23
|
});
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
it("does not render label skeleton when label prop is false", () => {
|
|
25
|
+
it("Label – does not render label skeleton when label prop is false", () => {
|
|
29
26
|
const label = false;
|
|
30
27
|
|
|
31
28
|
const component = mount(USkeletonChoice, {
|
|
@@ -39,8 +36,7 @@ describe("USkeletonChoice.vue", () => {
|
|
|
39
36
|
expect(skeletons.length).toBe(1); // Only input skeleton
|
|
40
37
|
});
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
it("applies the correct size class to wrapper", () => {
|
|
39
|
+
it("Size – applies the correct size class to wrapper", () => {
|
|
44
40
|
const size = {
|
|
45
41
|
sm: "gap-2",
|
|
46
42
|
md: "gap-2.5",
|
|
@@ -99,8 +95,7 @@ describe("USkeletonChoice.vue", () => {
|
|
|
99
95
|
});
|
|
100
96
|
});
|
|
101
97
|
|
|
102
|
-
|
|
103
|
-
it("applies the correct labelAlign class to wrapper", () => {
|
|
98
|
+
it("LabelAlign – applies the correct labelAlign class to wrapper", () => {
|
|
104
99
|
const labelAlign = {
|
|
105
100
|
left: "flex-row",
|
|
106
101
|
right: "flex-row-reverse",
|
|
@@ -117,8 +112,7 @@ describe("USkeletonChoice.vue", () => {
|
|
|
117
112
|
});
|
|
118
113
|
});
|
|
119
114
|
|
|
120
|
-
|
|
121
|
-
it("applies the correct type class to input", () => {
|
|
115
|
+
it("Type – applies the correct type class to input", () => {
|
|
122
116
|
const type = {
|
|
123
117
|
checkbox: "rounded-small",
|
|
124
118
|
radio: "rounded-full",
|
|
@@ -137,27 +131,7 @@ describe("USkeletonChoice.vue", () => {
|
|
|
137
131
|
});
|
|
138
132
|
});
|
|
139
133
|
|
|
140
|
-
|
|
141
|
-
it("passes the correct variant to skeleton components", () => {
|
|
142
|
-
const variants = ["light", "default", "dark"];
|
|
143
|
-
|
|
144
|
-
variants.forEach((variant) => {
|
|
145
|
-
const component = mount(USkeletonChoice, {
|
|
146
|
-
props: {
|
|
147
|
-
variant: variant as Props["variant"],
|
|
148
|
-
},
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
const inputSkeleton = component.findAllComponents(USkeleton)[0];
|
|
152
|
-
const labelSkeleton = component.findAllComponents(USkeleton)[1];
|
|
153
|
-
|
|
154
|
-
expect(inputSkeleton.props("variant")).toBe(variant);
|
|
155
|
-
expect(labelSkeleton.props("variant")).toBe(variant);
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
// DataTest prop
|
|
160
|
-
it("applies the correct data-test attribute", () => {
|
|
134
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
161
135
|
const dataTest = "test-skeleton-choice";
|
|
162
136
|
|
|
163
137
|
const component = mount(USkeletonChoice, {
|
|
@@ -170,10 +144,8 @@ describe("USkeletonChoice.vue", () => {
|
|
|
170
144
|
});
|
|
171
145
|
});
|
|
172
146
|
|
|
173
|
-
// Slots tests
|
|
174
147
|
describe("Slots", () => {
|
|
175
|
-
|
|
176
|
-
it("renders content from label slot", () => {
|
|
148
|
+
it("Label – renders content from label slot", () => {
|
|
177
149
|
const slotContent = "Custom Label";
|
|
178
150
|
const slotClass = "custom-label";
|
|
179
151
|
|
|
@@ -27,15 +27,15 @@ const { getDataTest, inputAttrs, textareaAttrs, labelAttrs, wrapperAttrs } =
|
|
|
27
27
|
<div v-bind="wrapperAttrs" :data-test="getDataTest()">
|
|
28
28
|
<!-- @slot Use it to customize the label skeleton. -->
|
|
29
29
|
<slot v-if="labelAlign !== LABEL_ALIGN.topInside && label" name="label">
|
|
30
|
-
<USkeleton
|
|
30
|
+
<USkeleton v-bind="labelAttrs" />
|
|
31
31
|
</slot>
|
|
32
32
|
|
|
33
|
-
<USkeleton v-if="type === 'input'"
|
|
33
|
+
<USkeleton v-if="type === 'input'" v-bind="inputAttrs">
|
|
34
34
|
<!-- @slot Use it to add custom content inside the input skeleton. -->
|
|
35
35
|
<slot />
|
|
36
36
|
</USkeleton>
|
|
37
37
|
|
|
38
|
-
<USkeleton v-else
|
|
38
|
+
<USkeleton v-else v-bind="textareaAttrs">
|
|
39
39
|
<!-- @slot Use it to add custom content inside the textarea skeleton. -->
|
|
40
40
|
<slot />
|
|
41
41
|
</USkeleton>
|
|
@@ -16,7 +16,7 @@ import type { Props } from "../types";
|
|
|
16
16
|
|
|
17
17
|
interface SkeletonInputArgs extends Props {
|
|
18
18
|
slotTemplate?: string;
|
|
19
|
-
enum: "
|
|
19
|
+
enum: "size" | "labelAlign" | "type";
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export default {
|
|
@@ -88,9 +88,6 @@ export const Types: StoryFn<SkeletonInputArgs> = (args: SkeletonInputArgs) => ({
|
|
|
88
88
|
export const Sizes = EnumTemplate.bind({});
|
|
89
89
|
Sizes.args = { enum: "size" };
|
|
90
90
|
|
|
91
|
-
export const Variants = EnumTemplate.bind({});
|
|
92
|
-
Variants.args = { enum: "variant" };
|
|
93
|
-
|
|
94
91
|
export const Slot: StoryFn<SkeletonInputArgs> = (args) => ({
|
|
95
92
|
components: { USkeletonInput, USkeleton, UCol },
|
|
96
93
|
setup() {
|
|
@@ -99,7 +96,7 @@ export const Slot: StoryFn<SkeletonInputArgs> = (args) => ({
|
|
|
99
96
|
template: `
|
|
100
97
|
<USkeletonInput label-align="top" v-bind="args" class="!max-w-96">
|
|
101
98
|
<UCol align="end" >
|
|
102
|
-
<USkeleton class="size-5 rounded-small"
|
|
99
|
+
<USkeleton class="size-5 rounded-small" />
|
|
103
100
|
</UCol>
|
|
104
101
|
</USkeletonInput>
|
|
105
102
|
`,
|
|
@@ -114,8 +111,8 @@ export const LabelSlot: StoryFn<SkeletonInputArgs> = (args) => ({
|
|
|
114
111
|
<USkeletonInput v-bind="args" label-align="top" class="!max-w-96">
|
|
115
112
|
<template #label>
|
|
116
113
|
<UCol gap="2xs"s>
|
|
117
|
-
<USkeleton class="h-3 w-36 rounded-small"
|
|
118
|
-
<USkeleton class="h-1.5 w-24 rounded-small"
|
|
114
|
+
<USkeleton class="h-3 w-36 rounded-small" />
|
|
115
|
+
<USkeleton class="h-1.5 w-24 rounded-small" />
|
|
119
116
|
</UCol>
|
|
120
117
|
</template>
|
|
121
118
|
</USkeletonInput>
|