vueless 1.3.6-beta.4 → 1.3.6-beta.6
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vueless",
|
|
3
|
-
"version": "1.3.6-beta.
|
|
3
|
+
"version": "1.3.6-beta.6",
|
|
4
4
|
"description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
|
|
5
5
|
"author": "Johnny Grid <hello@vueless.com> (https://vueless.com)",
|
|
6
6
|
"homepage": "https://vueless.com",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@vue/eslint-config-typescript": "^14.6.0",
|
|
58
58
|
"@vue/test-utils": "^2.4.6",
|
|
59
59
|
"@vue/tsconfig": "^0.7.0",
|
|
60
|
-
"@vueless/storybook": "^1.3.
|
|
60
|
+
"@vueless/storybook": "^1.3.13",
|
|
61
61
|
"eslint": "^9.32.0",
|
|
62
62
|
"eslint-plugin-storybook": "^10.0.2",
|
|
63
63
|
"eslint-plugin-vue": "^10.3.0",
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { mount } from "@vue/test-utils";
|
|
2
|
+
import { describe, it, expect } from "vitest";
|
|
3
|
+
|
|
4
|
+
import UGrid from "../UGrid.vue";
|
|
5
|
+
|
|
6
|
+
import type { Props } from "../types";
|
|
7
|
+
|
|
8
|
+
describe("UGrid.vue", () => {
|
|
9
|
+
describe("Props", () => {
|
|
10
|
+
it("Cols – applies the correct cols class", () => {
|
|
11
|
+
const colsClasses = {
|
|
12
|
+
"1": "grid-cols-1",
|
|
13
|
+
"2": "grid-cols-2",
|
|
14
|
+
"3": "grid-cols-3",
|
|
15
|
+
"4": "grid-cols-4",
|
|
16
|
+
"5": "grid-cols-5",
|
|
17
|
+
"6": "grid-cols-6",
|
|
18
|
+
"7": "grid-cols-7",
|
|
19
|
+
"8": "grid-cols-8",
|
|
20
|
+
"9": "grid-cols-9",
|
|
21
|
+
"10": "grid-cols-10",
|
|
22
|
+
"11": "grid-cols-11",
|
|
23
|
+
"12": "grid-cols-12",
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
Object.entries(colsClasses).forEach(([cols, classes]) => {
|
|
27
|
+
const component = mount(UGrid, {
|
|
28
|
+
props: {
|
|
29
|
+
cols: cols as Props["cols"],
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
expect(component.attributes("class")).toContain(classes);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("Rows – applies the correct rows class", () => {
|
|
38
|
+
const rowsClasses = {
|
|
39
|
+
"1": "grid-rows-1",
|
|
40
|
+
"2": "grid-rows-2",
|
|
41
|
+
"3": "grid-rows-3",
|
|
42
|
+
"4": "grid-rows-4",
|
|
43
|
+
"5": "grid-rows-5",
|
|
44
|
+
"6": "grid-rows-6",
|
|
45
|
+
"7": "grid-rows-7",
|
|
46
|
+
"8": "grid-rows-8",
|
|
47
|
+
"9": "grid-rows-9",
|
|
48
|
+
"10": "grid-rows-10",
|
|
49
|
+
"11": "grid-rows-11",
|
|
50
|
+
"12": "grid-rows-12",
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
Object.entries(rowsClasses).forEach(([rows, classes]) => {
|
|
54
|
+
const component = mount(UGrid, {
|
|
55
|
+
props: {
|
|
56
|
+
rows: rows as Props["rows"],
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
expect(component.attributes("class")).toContain(classes);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("Gap – applies the correct gap class", () => {
|
|
65
|
+
const gapClasses = {
|
|
66
|
+
none: "gap-0",
|
|
67
|
+
"2xs": "gap-1",
|
|
68
|
+
xs: "gap-2",
|
|
69
|
+
sm: "gap-3",
|
|
70
|
+
md: "gap-4",
|
|
71
|
+
lg: "gap-5",
|
|
72
|
+
xl: "gap-6",
|
|
73
|
+
"2xl": "gap-8",
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
Object.entries(gapClasses).forEach(([gap, classes]) => {
|
|
77
|
+
const component = mount(UGrid, {
|
|
78
|
+
props: {
|
|
79
|
+
gap: gap as Props["gap"],
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
expect(component.attributes("class")).toContain(classes);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("Row Gap – applies the correct row gap class", () => {
|
|
88
|
+
const rowGapClasses = {
|
|
89
|
+
none: "gap-y-0",
|
|
90
|
+
"2xs": "gap-y-1",
|
|
91
|
+
xs: "gap-y-2",
|
|
92
|
+
sm: "gap-y-3",
|
|
93
|
+
md: "gap-y-4",
|
|
94
|
+
lg: "gap-y-5",
|
|
95
|
+
xl: "gap-y-6",
|
|
96
|
+
"2xl": "gap-y-8",
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
Object.entries(rowGapClasses).forEach(([rowGap, classes]) => {
|
|
100
|
+
const component = mount(UGrid, {
|
|
101
|
+
props: {
|
|
102
|
+
rowGap: rowGap as Props["rowGap"],
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
expect(component.attributes("class")).toContain(classes);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it("Col Gap – applies the correct col gap class", () => {
|
|
111
|
+
const colGapClasses = {
|
|
112
|
+
none: "gap-x-0",
|
|
113
|
+
"2xs": "gap-x-1",
|
|
114
|
+
xs: "gap-x-2",
|
|
115
|
+
sm: "gap-x-3",
|
|
116
|
+
md: "gap-x-4",
|
|
117
|
+
lg: "gap-x-5",
|
|
118
|
+
xl: "gap-x-6",
|
|
119
|
+
"2xl": "gap-x-8",
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
Object.entries(colGapClasses).forEach(([colGap, classes]) => {
|
|
123
|
+
const component = mount(UGrid, {
|
|
124
|
+
props: {
|
|
125
|
+
colGap: colGap as Props["colGap"],
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
expect(component.attributes("class")).toContain(classes);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it("Align – applies the correct align class", () => {
|
|
134
|
+
const alignClasses = {
|
|
135
|
+
start: "items-start",
|
|
136
|
+
end: "items-end",
|
|
137
|
+
center: "items-center",
|
|
138
|
+
stretch: "items-stretch",
|
|
139
|
+
baseline: "items-baseline",
|
|
140
|
+
normal: "items-normal",
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
Object.entries(alignClasses).forEach(([align, classes]) => {
|
|
144
|
+
const component = mount(UGrid, {
|
|
145
|
+
props: {
|
|
146
|
+
align: align as Props["align"],
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
expect(component.attributes("class")).toContain(classes);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it("Content – applies the correct content class", () => {
|
|
155
|
+
const contentClasses = {
|
|
156
|
+
start: "content-start",
|
|
157
|
+
end: "content-end",
|
|
158
|
+
center: "content-center",
|
|
159
|
+
around: "content-around",
|
|
160
|
+
evenly: "content-evenly",
|
|
161
|
+
between: "content-between",
|
|
162
|
+
normal: "content-normal",
|
|
163
|
+
stretch: "content-stretch",
|
|
164
|
+
baseline: "content-baseline",
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
Object.entries(contentClasses).forEach(([content, classes]) => {
|
|
168
|
+
const component = mount(UGrid, {
|
|
169
|
+
props: {
|
|
170
|
+
content: content as Props["content"],
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
expect(component.attributes("class")).toContain(classes);
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it("Justify – applies the correct justify class", () => {
|
|
179
|
+
const justifyClasses = {
|
|
180
|
+
start: "justify-items-start",
|
|
181
|
+
end: "justify-items-end",
|
|
182
|
+
"end-safe": "justify-items-end-safe",
|
|
183
|
+
center: "justify-items-center",
|
|
184
|
+
"center-safe": "justify-items-center-safe",
|
|
185
|
+
stretch: "justify-items-stretch",
|
|
186
|
+
normal: "justify-items-normal",
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
Object.entries(justifyClasses).forEach(([justify, classes]) => {
|
|
190
|
+
const component = mount(UGrid, {
|
|
191
|
+
props: {
|
|
192
|
+
justify: justify as Props["justify"],
|
|
193
|
+
},
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
expect(component.attributes("class")).toContain(classes);
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it("Place Content – applies the correct place content class", () => {
|
|
201
|
+
const placeContentClasses = {
|
|
202
|
+
start: "place-content-start",
|
|
203
|
+
end: "place-content-end",
|
|
204
|
+
"end-safe": "place-content-end-safe",
|
|
205
|
+
center: "place-content-center",
|
|
206
|
+
"center-safe": "place-content-center-safe",
|
|
207
|
+
around: "place-content-around",
|
|
208
|
+
evenly: "place-content-evenly",
|
|
209
|
+
between: "place-content-between",
|
|
210
|
+
stretch: "place-content-stretch",
|
|
211
|
+
baseline: "place-content-baseline",
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
Object.entries(placeContentClasses).forEach(([placeContent, classes]) => {
|
|
215
|
+
const component = mount(UGrid, {
|
|
216
|
+
props: {
|
|
217
|
+
placeContent: placeContent as Props["placeContent"],
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
expect(component.attributes("class")).toContain(classes);
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it("Place Items – applies the correct place items class", () => {
|
|
226
|
+
const placeItemsClasses = {
|
|
227
|
+
start: "place-items-start",
|
|
228
|
+
end: "place-items-end",
|
|
229
|
+
"end-safe": "place-items-end-safe",
|
|
230
|
+
center: "place-items-center",
|
|
231
|
+
"center-safe": "place-items-center-safe",
|
|
232
|
+
stretch: "place-items-stretch",
|
|
233
|
+
baseline: "place-items-baseline",
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
Object.entries(placeItemsClasses).forEach(([placeItems, classes]) => {
|
|
237
|
+
const component = mount(UGrid, {
|
|
238
|
+
props: {
|
|
239
|
+
placeItems: placeItems as Props["placeItems"],
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
expect(component.attributes("class")).toContain(classes);
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
it("Tag – renders the correct HTML tag", () => {
|
|
248
|
+
const tags = ["div", "section", "article", "main", "aside", "nav", "span"];
|
|
249
|
+
|
|
250
|
+
tags.forEach((tag) => {
|
|
251
|
+
const component = mount(UGrid, {
|
|
252
|
+
props: {
|
|
253
|
+
tag,
|
|
254
|
+
},
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
expect(component.element.tagName.toLowerCase()).toBe(tag);
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
it("Data Test – applies the correct data-test attribute", () => {
|
|
262
|
+
const dataTest = "grid-test";
|
|
263
|
+
|
|
264
|
+
const component = mount(UGrid, {
|
|
265
|
+
props: {
|
|
266
|
+
dataTest,
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
expect(component.attributes("data-test")).toBe(dataTest);
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
describe("Slots", () => {
|
|
275
|
+
it("Default – renders content from default slot", () => {
|
|
276
|
+
const slotContent = "Custom Content";
|
|
277
|
+
|
|
278
|
+
const component = mount(UGrid, {
|
|
279
|
+
slots: {
|
|
280
|
+
default: slotContent,
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
expect(component.text()).toContain(slotContent);
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
describe("Exposed refs", () => {
|
|
289
|
+
it("wrapperRef – exposes wrapperRef", () => {
|
|
290
|
+
const component = mount(UGrid);
|
|
291
|
+
|
|
292
|
+
expect(component.vm.wrapperRef).toBeDefined();
|
|
293
|
+
// wrapperRef is a reference to the wrapper div element, not a boolean
|
|
294
|
+
expect(component.vm.wrapperRef instanceof HTMLElement).toBe(true);
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
});
|
|
@@ -16,7 +16,9 @@ type UInputRef = InstanceType<typeof UInput>;
|
|
|
16
16
|
|
|
17
17
|
defineOptions({ internal: true });
|
|
18
18
|
|
|
19
|
-
const props = defineProps<UDatePickerRangeInputsProps>()
|
|
19
|
+
const props = withDefaults(defineProps<UDatePickerRangeInputsProps>(), {
|
|
20
|
+
dataTest: null,
|
|
21
|
+
});
|
|
20
22
|
|
|
21
23
|
const rangeInputStartRef = useTemplateRef<UInputRef>("range-input-start");
|
|
22
24
|
const rangeInputEndRef = useTemplateRef<UInputRef>("range-input-end");
|
|
@@ -140,6 +142,7 @@ defineExpose({
|
|
|
140
142
|
v-bind="attrs.rangeInputFirstAttrs.value"
|
|
141
143
|
:name="rangeInputName"
|
|
142
144
|
no-autocomplete
|
|
145
|
+
:data-test="`${dataTest}-from`"
|
|
143
146
|
@blur="updateDateValue(rangeStart, InputRangeType.Start)"
|
|
144
147
|
@keydown.enter="updateDateValue(rangeStart, InputRangeType.Start)"
|
|
145
148
|
@input="validateInput($event, InputRangeType.Start)"
|
|
@@ -153,6 +156,7 @@ defineExpose({
|
|
|
153
156
|
v-bind="attrs.rangeInputLastAttrs.value"
|
|
154
157
|
:name="rangeInputName"
|
|
155
158
|
no-autocomplete
|
|
159
|
+
:data-test="`${dataTest}-to`"
|
|
156
160
|
@blur="updateDateValue(rangeEnd, InputRangeType.End)"
|
|
157
161
|
@keydown.enter="updateDateValue(rangeEnd, InputRangeType.End)"
|
|
158
162
|
@input="validateInput($event, InputRangeType.End)"
|