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
|
@@ -6,10 +6,8 @@ import UText from "../UText.vue";
|
|
|
6
6
|
import type { Props } from "../types";
|
|
7
7
|
|
|
8
8
|
describe("UText.vue", () => {
|
|
9
|
-
// Props tests
|
|
10
9
|
describe("Props", () => {
|
|
11
|
-
|
|
12
|
-
it("applies the correct size class", async () => {
|
|
10
|
+
it("Size – applies the correct size class", async () => {
|
|
13
11
|
const size = {
|
|
14
12
|
xs: "text-tiny",
|
|
15
13
|
sm: "text-small",
|
|
@@ -28,8 +26,7 @@ describe("UText.vue", () => {
|
|
|
28
26
|
});
|
|
29
27
|
});
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
it("applies the correct align class", async () => {
|
|
29
|
+
it("Align – applies the correct align class", async () => {
|
|
33
30
|
const align = {
|
|
34
31
|
left: "text-left",
|
|
35
32
|
center: "text-center",
|
|
@@ -47,8 +44,7 @@ describe("UText.vue", () => {
|
|
|
47
44
|
});
|
|
48
45
|
});
|
|
49
46
|
|
|
50
|
-
|
|
51
|
-
it("applies the correct color class", async () => {
|
|
47
|
+
it("Color – applies the correct color class", async () => {
|
|
52
48
|
const colors = [
|
|
53
49
|
"primary",
|
|
54
50
|
"secondary",
|
|
@@ -76,8 +72,7 @@ describe("UText.vue", () => {
|
|
|
76
72
|
});
|
|
77
73
|
});
|
|
78
74
|
|
|
79
|
-
|
|
80
|
-
it("applies the correct variant class", async () => {
|
|
75
|
+
it("Variant – applies the correct variant class", async () => {
|
|
81
76
|
const variants = {
|
|
82
77
|
default: "text-primary",
|
|
83
78
|
lifted: "text-primary-lifted",
|
|
@@ -97,8 +92,7 @@ describe("UText.vue", () => {
|
|
|
97
92
|
});
|
|
98
93
|
});
|
|
99
94
|
|
|
100
|
-
|
|
101
|
-
it("applies line class when line prop is true", () => {
|
|
95
|
+
it("Line – applies line class when line prop is true", () => {
|
|
102
96
|
const line = true;
|
|
103
97
|
|
|
104
98
|
const component = mount(UText, {
|
|
@@ -110,8 +104,7 @@ describe("UText.vue", () => {
|
|
|
110
104
|
expect(component.attributes("class")).toContain("leading-none");
|
|
111
105
|
});
|
|
112
106
|
|
|
113
|
-
|
|
114
|
-
it("applies text-nowrap class when wrap prop is false", () => {
|
|
107
|
+
it("Wrap – applies text-nowrap class when wrap prop is false", () => {
|
|
115
108
|
const wrap = false;
|
|
116
109
|
|
|
117
110
|
const component = mount(UText, {
|
|
@@ -123,8 +116,7 @@ describe("UText.vue", () => {
|
|
|
123
116
|
expect(component.attributes("class")).toContain("text-nowrap");
|
|
124
117
|
});
|
|
125
118
|
|
|
126
|
-
|
|
127
|
-
it("renders the correct label content", () => {
|
|
119
|
+
it("Label – renders the correct label content", () => {
|
|
128
120
|
const label = "Text label";
|
|
129
121
|
|
|
130
122
|
const component = mount(UText, {
|
|
@@ -150,8 +142,7 @@ describe("UText.vue", () => {
|
|
|
150
142
|
});
|
|
151
143
|
});
|
|
152
144
|
|
|
153
|
-
|
|
154
|
-
it("applies the correct data-test attribute", () => {
|
|
145
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
155
146
|
const dataTest = "test-text";
|
|
156
147
|
|
|
157
148
|
const component = mount(UText, {
|
|
@@ -163,8 +154,7 @@ describe("UText.vue", () => {
|
|
|
163
154
|
expect(component.attributes("data-test")).toBe(dataTest);
|
|
164
155
|
});
|
|
165
156
|
|
|
166
|
-
|
|
167
|
-
it("applies custom classes from config prop", () => {
|
|
157
|
+
it("Config – applies custom classes from config prop", () => {
|
|
168
158
|
const customClasses = "font-bold";
|
|
169
159
|
|
|
170
160
|
const component = mount(UText, {
|
|
@@ -179,10 +169,8 @@ describe("UText.vue", () => {
|
|
|
179
169
|
});
|
|
180
170
|
});
|
|
181
171
|
|
|
182
|
-
// Slots tests
|
|
183
172
|
describe("Slots", () => {
|
|
184
|
-
|
|
185
|
-
it("renders content from default slot", () => {
|
|
173
|
+
it("Default – renders content from default slot", () => {
|
|
186
174
|
const slotContent = "Custom Content";
|
|
187
175
|
|
|
188
176
|
const component = mount(UText, {
|
|
@@ -194,8 +182,7 @@ describe("UText.vue", () => {
|
|
|
194
182
|
expect(component.text()).toContain(slotContent);
|
|
195
183
|
});
|
|
196
184
|
|
|
197
|
-
|
|
198
|
-
it("default slot overrides label prop", () => {
|
|
185
|
+
it("Default slot overrides label – default slot overrides label prop", () => {
|
|
199
186
|
const label = "Label Text";
|
|
200
187
|
const slotContent = "Custom Content";
|
|
201
188
|
|
|
@@ -213,10 +200,8 @@ describe("UText.vue", () => {
|
|
|
213
200
|
});
|
|
214
201
|
});
|
|
215
202
|
|
|
216
|
-
// Exposed refs tests
|
|
217
203
|
describe("Exposed refs", () => {
|
|
218
|
-
|
|
219
|
-
it("exposes wrapperRef", () => {
|
|
204
|
+
it("wrapperRef – exposes wrapperRef", () => {
|
|
220
205
|
const component = mount(UText, {});
|
|
221
206
|
|
|
222
207
|
expect(component.vm.textRef).toBeDefined();
|
|
@@ -8,10 +8,8 @@ import UHeader from "../../ui.text-header/UHeader.vue";
|
|
|
8
8
|
import type { Props } from "../types";
|
|
9
9
|
|
|
10
10
|
describe("UEmpty.vue", () => {
|
|
11
|
-
// Props tests
|
|
12
11
|
describe("Props", () => {
|
|
13
|
-
|
|
14
|
-
it("applies the correct size class", async () => {
|
|
12
|
+
it("Size – applies the correct size class", async () => {
|
|
15
13
|
const size = {
|
|
16
14
|
sm: "2xl",
|
|
17
15
|
md: "3xl",
|
|
@@ -32,8 +30,7 @@ describe("UEmpty.vue", () => {
|
|
|
32
30
|
});
|
|
33
31
|
});
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
it("renders default icon when icon prop is not provided", () => {
|
|
33
|
+
it("Icon – renders default icon when icon prop is not provided", () => {
|
|
37
34
|
const defaultIcon = "emoji_food_beverage";
|
|
38
35
|
|
|
39
36
|
const component = mount(UEmpty, {});
|
|
@@ -43,8 +40,7 @@ describe("UEmpty.vue", () => {
|
|
|
43
40
|
expect(iconComponent.props("name")).toBe(defaultIcon);
|
|
44
41
|
});
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
it("renders default icon when icon prop is true", () => {
|
|
43
|
+
it("Icon – renders default icon when icon prop is true", () => {
|
|
48
44
|
const placeholderIcon = true;
|
|
49
45
|
const defaultIcon = "emoji_food_beverage";
|
|
50
46
|
|
|
@@ -60,8 +56,7 @@ describe("UEmpty.vue", () => {
|
|
|
60
56
|
expect(iconComponent.props("name")).toBe(defaultIcon);
|
|
61
57
|
});
|
|
62
58
|
|
|
63
|
-
|
|
64
|
-
it("renders custom icon when icon prop is a string", () => {
|
|
59
|
+
it("Icon – renders custom icon when icon prop is a string", () => {
|
|
65
60
|
const customIcon = "close";
|
|
66
61
|
|
|
67
62
|
const component = mount(UEmpty, {
|
|
@@ -76,8 +71,7 @@ describe("UEmpty.vue", () => {
|
|
|
76
71
|
expect(iconComponent.props("name")).toBe(customIcon);
|
|
77
72
|
});
|
|
78
73
|
|
|
79
|
-
|
|
80
|
-
it("does not render icon when icon prop is false", () => {
|
|
74
|
+
it("Icon – does not render icon when icon prop is false", () => {
|
|
81
75
|
const placeholderIcon = false;
|
|
82
76
|
|
|
83
77
|
const component = mount(UEmpty, {
|
|
@@ -91,8 +85,7 @@ describe("UEmpty.vue", () => {
|
|
|
91
85
|
expect(iconComponent.exists()).toBe(placeholderIcon);
|
|
92
86
|
});
|
|
93
87
|
|
|
94
|
-
|
|
95
|
-
it("renders the correct title text", () => {
|
|
88
|
+
it("Title – renders the correct title text", () => {
|
|
96
89
|
const title = "Empty State Title";
|
|
97
90
|
|
|
98
91
|
const component = mount(UEmpty, {
|
|
@@ -107,8 +100,7 @@ describe("UEmpty.vue", () => {
|
|
|
107
100
|
expect(headerComponent.props("label")).toBe(title);
|
|
108
101
|
});
|
|
109
102
|
|
|
110
|
-
|
|
111
|
-
it("renders the correct description text", () => {
|
|
103
|
+
it("Description – renders the correct description text", () => {
|
|
112
104
|
const description = "Empty State Description";
|
|
113
105
|
|
|
114
106
|
const component = mount(UEmpty, {
|
|
@@ -120,8 +112,7 @@ describe("UEmpty.vue", () => {
|
|
|
120
112
|
expect(component.text()).toContain(description);
|
|
121
113
|
});
|
|
122
114
|
|
|
123
|
-
|
|
124
|
-
it("applies the correct data-test attribute", () => {
|
|
115
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
125
116
|
const dataTest = "test-empty";
|
|
126
117
|
|
|
127
118
|
const component = mount(UEmpty, {
|
|
@@ -134,10 +125,8 @@ describe("UEmpty.vue", () => {
|
|
|
134
125
|
});
|
|
135
126
|
});
|
|
136
127
|
|
|
137
|
-
// Slots tests
|
|
138
128
|
describe("Slots", () => {
|
|
139
|
-
|
|
140
|
-
it("renders content from default slot", () => {
|
|
129
|
+
it("Default – renders content from default slot", () => {
|
|
141
130
|
const slotContent = "Custom Content";
|
|
142
131
|
|
|
143
132
|
const component = mount(UEmpty, {
|
|
@@ -149,8 +138,7 @@ describe("UEmpty.vue", () => {
|
|
|
149
138
|
expect(component.text()).toContain(slotContent);
|
|
150
139
|
});
|
|
151
140
|
|
|
152
|
-
|
|
153
|
-
it("default slot overrides title and description", () => {
|
|
141
|
+
it("Default – default slot overrides title and description", () => {
|
|
154
142
|
const title = "Empty State Title";
|
|
155
143
|
const description = "Empty State Description";
|
|
156
144
|
const slotContent = "Custom Content";
|
|
@@ -171,8 +159,7 @@ describe("UEmpty.vue", () => {
|
|
|
171
159
|
expect(component.text()).not.toContain(description);
|
|
172
160
|
});
|
|
173
161
|
|
|
174
|
-
|
|
175
|
-
it("renders content from header slot", () => {
|
|
162
|
+
it("Header – renders content from header slot", () => {
|
|
176
163
|
const slotText = "Custom Header";
|
|
177
164
|
const slotClass = "header-content";
|
|
178
165
|
|
|
@@ -186,8 +173,7 @@ describe("UEmpty.vue", () => {
|
|
|
186
173
|
expect(component.find(`.${slotClass}`).text()).toBe(slotText);
|
|
187
174
|
});
|
|
188
175
|
|
|
189
|
-
|
|
190
|
-
it("header slot overrides default icon", () => {
|
|
176
|
+
it("Header – header slot overrides default icon", () => {
|
|
191
177
|
const slotContent = "Custom Header";
|
|
192
178
|
|
|
193
179
|
const component = mount(UEmpty, {
|
|
@@ -200,8 +186,7 @@ describe("UEmpty.vue", () => {
|
|
|
200
186
|
expect(component.findComponent(UIcon).exists()).toBe(false);
|
|
201
187
|
});
|
|
202
188
|
|
|
203
|
-
|
|
204
|
-
it("renders content from footer slot", () => {
|
|
189
|
+
it("Footer – renders content from footer slot", () => {
|
|
205
190
|
const slotText = "Custom Footer";
|
|
206
191
|
const slotClass = "footer-content";
|
|
207
192
|
|
|
@@ -216,10 +201,8 @@ describe("UEmpty.vue", () => {
|
|
|
216
201
|
});
|
|
217
202
|
});
|
|
218
203
|
|
|
219
|
-
// Exposed refs tests
|
|
220
204
|
describe("Exposed refs", () => {
|
|
221
|
-
|
|
222
|
-
it("exposes wrapperRef", () => {
|
|
205
|
+
it("wrapperRef – exposes wrapperRef", () => {
|
|
223
206
|
const component = mount(UEmpty, {});
|
|
224
207
|
|
|
225
208
|
expect(component.vm.wrapperRef).toBeDefined();
|
|
@@ -9,10 +9,8 @@ import type { ComponentPublicInstance } from "vue";
|
|
|
9
9
|
import type { Props } from "../types";
|
|
10
10
|
|
|
11
11
|
describe("UFile.vue", () => {
|
|
12
|
-
// Props tests
|
|
13
12
|
describe("Props", () => {
|
|
14
|
-
|
|
15
|
-
it("passes the correct url to ULink", () => {
|
|
13
|
+
it("URL – passes the correct url to ULink", () => {
|
|
16
14
|
const url = "https://example.com/file.pdf";
|
|
17
15
|
|
|
18
16
|
const component = mount(UFile, {
|
|
@@ -26,8 +24,7 @@ describe("UFile.vue", () => {
|
|
|
26
24
|
expect(linkComponent.props("href")).toBe(url);
|
|
27
25
|
});
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
it("renders image when imageUrl prop is provided", () => {
|
|
27
|
+
it("ImageUrl – renders image when imageUrl prop is provided", () => {
|
|
31
28
|
const imageUrl = "https://example.com/image.jpg";
|
|
32
29
|
|
|
33
30
|
const component = mount(UFile, {
|
|
@@ -42,8 +39,7 @@ describe("UFile.vue", () => {
|
|
|
42
39
|
expect(image.attributes("src")).toBe(imageUrl);
|
|
43
40
|
});
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
it("renders the correct label text", () => {
|
|
42
|
+
it("Label – renders the correct label text", () => {
|
|
47
43
|
const label = "Example File";
|
|
48
44
|
|
|
49
45
|
const component = mount(UFile, {
|
|
@@ -57,8 +53,7 @@ describe("UFile.vue", () => {
|
|
|
57
53
|
expect(linkComponent.text()).toContain(label);
|
|
58
54
|
});
|
|
59
55
|
|
|
60
|
-
|
|
61
|
-
it("applies the correct size class", async () => {
|
|
56
|
+
it("Size – applies the correct size class", async () => {
|
|
62
57
|
const sizeClasses = {
|
|
63
58
|
sm: "gap-0.5",
|
|
64
59
|
md: "gap-1",
|
|
@@ -76,8 +71,7 @@ describe("UFile.vue", () => {
|
|
|
76
71
|
});
|
|
77
72
|
});
|
|
78
73
|
|
|
79
|
-
|
|
80
|
-
it("uses provided id", () => {
|
|
74
|
+
it("ID – uses provided id", () => {
|
|
81
75
|
const id = "test-file-id";
|
|
82
76
|
const removable = true;
|
|
83
77
|
|
|
@@ -94,8 +88,7 @@ describe("UFile.vue", () => {
|
|
|
94
88
|
expect(component.emitted("remove")?.[0][0]).toBe(id);
|
|
95
89
|
});
|
|
96
90
|
|
|
97
|
-
|
|
98
|
-
it("shows remove button when removable prop is true", () => {
|
|
91
|
+
it("Removable – shows remove button when removable prop is true", () => {
|
|
99
92
|
const removable = true;
|
|
100
93
|
const dataTest = "test-file";
|
|
101
94
|
const removeIconDataTest = "test-file-remove-item";
|
|
@@ -115,8 +108,7 @@ describe("UFile.vue", () => {
|
|
|
115
108
|
expect(removeIcon).toBeDefined();
|
|
116
109
|
});
|
|
117
110
|
|
|
118
|
-
|
|
119
|
-
it("applies the correct data-test attribute", () => {
|
|
111
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
120
112
|
const dataTest = "test-file";
|
|
121
113
|
|
|
122
114
|
const component = mount(UFile, {
|
|
@@ -129,10 +121,8 @@ describe("UFile.vue", () => {
|
|
|
129
121
|
});
|
|
130
122
|
});
|
|
131
123
|
|
|
132
|
-
// Slots tests
|
|
133
124
|
describe("Slots", () => {
|
|
134
|
-
|
|
135
|
-
it("renders content from default slot", () => {
|
|
125
|
+
it("Default – renders content from default slot", () => {
|
|
136
126
|
const slotContent = "Custom Content";
|
|
137
127
|
|
|
138
128
|
const component = mount(UFile, {
|
|
@@ -144,8 +134,7 @@ describe("UFile.vue", () => {
|
|
|
144
134
|
expect(component.text()).toContain(slotContent);
|
|
145
135
|
});
|
|
146
136
|
|
|
147
|
-
|
|
148
|
-
it("provides correct bindings to default slot", () => {
|
|
137
|
+
it("Default – provides correct bindings to default slot", () => {
|
|
149
138
|
const id = "test-id";
|
|
150
139
|
const label = "Test File";
|
|
151
140
|
const url = "https://example.com/file.pdf";
|
|
@@ -182,8 +171,7 @@ describe("UFile.vue", () => {
|
|
|
182
171
|
expect(component.find(`.${imageUrlClass}`).text()).toBe(imageUrl);
|
|
183
172
|
});
|
|
184
173
|
|
|
185
|
-
|
|
186
|
-
it("renders content from left slot", () => {
|
|
174
|
+
it("Left – renders content from left slot", () => {
|
|
187
175
|
const slotText = "Left";
|
|
188
176
|
const slotClass = "left-content";
|
|
189
177
|
|
|
@@ -197,8 +185,7 @@ describe("UFile.vue", () => {
|
|
|
197
185
|
expect(component.find(`.${slotClass}`).text()).toBe(slotText);
|
|
198
186
|
});
|
|
199
187
|
|
|
200
|
-
|
|
201
|
-
it("renders content from right slot", () => {
|
|
188
|
+
it("Right – renders content from right slot", () => {
|
|
202
189
|
const slotText = "Right";
|
|
203
190
|
const slotClass = "right-content";
|
|
204
191
|
|
|
@@ -213,10 +200,8 @@ describe("UFile.vue", () => {
|
|
|
213
200
|
});
|
|
214
201
|
});
|
|
215
202
|
|
|
216
|
-
// Events tests
|
|
217
203
|
describe("Events", () => {
|
|
218
|
-
|
|
219
|
-
it("emits remove event when remove button is clicked", async () => {
|
|
204
|
+
it("Remove – emits remove event when remove button is clicked", async () => {
|
|
220
205
|
const id = "test-file-id";
|
|
221
206
|
const removable = true;
|
|
222
207
|
const dataTest = "test-file";
|
|
@@ -245,10 +230,8 @@ describe("UFile.vue", () => {
|
|
|
245
230
|
});
|
|
246
231
|
});
|
|
247
232
|
|
|
248
|
-
// Exposed refs tests
|
|
249
233
|
describe("Exposed refs", () => {
|
|
250
|
-
|
|
251
|
-
it("exposes file ref", () => {
|
|
234
|
+
it("file – exposes file ref", () => {
|
|
252
235
|
const component = mount(UFile, {});
|
|
253
236
|
|
|
254
237
|
expect(component.vm.fileRef).toBeDefined();
|
|
@@ -30,10 +30,8 @@ describe("UFiles.vue", () => {
|
|
|
30
30
|
URL.createObjectURL = originalCreateObjectURL;
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
// Props tests
|
|
34
33
|
describe("Props", () => {
|
|
35
|
-
|
|
36
|
-
it("renders the correct number of files", () => {
|
|
34
|
+
it("FileList – renders the correct number of files", () => {
|
|
37
35
|
const component = mount(UFiles, {
|
|
38
36
|
props: {
|
|
39
37
|
fileList,
|
|
@@ -45,8 +43,7 @@ describe("UFiles.vue", () => {
|
|
|
45
43
|
expect(fileComponents.length).toBe(fileList.length);
|
|
46
44
|
});
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
it("renders the correct label text", () => {
|
|
46
|
+
it("Label – renders the correct label text", () => {
|
|
50
47
|
const label = "File List";
|
|
51
48
|
|
|
52
49
|
const component = mount(UFiles, {
|
|
@@ -61,8 +58,7 @@ describe("UFiles.vue", () => {
|
|
|
61
58
|
expect(labelComponent.props("label")).toBe(label);
|
|
62
59
|
});
|
|
63
60
|
|
|
64
|
-
|
|
65
|
-
it("passes the correct description to ULabel", () => {
|
|
61
|
+
it("Description – passes the correct description to ULabel", () => {
|
|
66
62
|
const description = "List of files";
|
|
67
63
|
|
|
68
64
|
const component = mount(UFiles, {
|
|
@@ -77,8 +73,7 @@ describe("UFiles.vue", () => {
|
|
|
77
73
|
expect(labelComponent.props("description")).toBe(description);
|
|
78
74
|
});
|
|
79
75
|
|
|
80
|
-
|
|
81
|
-
it("passes the correct size prop to ULabel", () => {
|
|
76
|
+
it("Size – passes the correct size prop to ULabel", () => {
|
|
82
77
|
const sizes = ["sm", "md", "lg"];
|
|
83
78
|
|
|
84
79
|
sizes.forEach((size) => {
|
|
@@ -95,8 +90,7 @@ describe("UFiles.vue", () => {
|
|
|
95
90
|
});
|
|
96
91
|
});
|
|
97
92
|
|
|
98
|
-
|
|
99
|
-
it("passes removable prop to UFile components", () => {
|
|
93
|
+
it("Removable – passes removable prop to UFile components", () => {
|
|
100
94
|
const removable = true;
|
|
101
95
|
const fileList = [createMockFile("file1.pdf")];
|
|
102
96
|
|
|
@@ -112,8 +106,7 @@ describe("UFiles.vue", () => {
|
|
|
112
106
|
expect(fileComponent.props("removable")).toBe(removable);
|
|
113
107
|
});
|
|
114
108
|
|
|
115
|
-
|
|
116
|
-
it("applies the correct data-test attribute to file items", () => {
|
|
109
|
+
it("DataTest – applies the correct data-test attribute to file items", () => {
|
|
117
110
|
const dataTest = "test-files";
|
|
118
111
|
const fileList = [createMockFile("file1.pdf")];
|
|
119
112
|
|
|
@@ -129,8 +122,7 @@ describe("UFiles.vue", () => {
|
|
|
129
122
|
expect(fileComponent.attributes("data-test")).toBe(`${dataTest}-item-0`);
|
|
130
123
|
});
|
|
131
124
|
|
|
132
|
-
|
|
133
|
-
it("detects image files and sets imageUrl prop", () => {
|
|
125
|
+
it("Image – detects image files and sets imageUrl prop", () => {
|
|
134
126
|
const imageFile = createMockFile("image.jpg", "image/jpeg");
|
|
135
127
|
const fileList = [imageFile];
|
|
136
128
|
|
|
@@ -146,10 +138,8 @@ describe("UFiles.vue", () => {
|
|
|
146
138
|
});
|
|
147
139
|
});
|
|
148
140
|
|
|
149
|
-
// Slots tests
|
|
150
141
|
describe("Slots", () => {
|
|
151
|
-
|
|
152
|
-
it("renders content from default slot", () => {
|
|
142
|
+
it("Default – renders content from default slot", () => {
|
|
153
143
|
const slotContent = "Custom Content";
|
|
154
144
|
|
|
155
145
|
const component = mount(UFiles, {
|
|
@@ -164,8 +154,7 @@ describe("UFiles.vue", () => {
|
|
|
164
154
|
expect(component.text()).toContain(slotContent);
|
|
165
155
|
});
|
|
166
156
|
|
|
167
|
-
|
|
168
|
-
it("renders content from label slot", () => {
|
|
157
|
+
it("Label – renders content from label slot", () => {
|
|
169
158
|
const label = "File List";
|
|
170
159
|
const slotText = "Custom Label";
|
|
171
160
|
const slotClass = "label-content";
|
|
@@ -184,8 +173,7 @@ describe("UFiles.vue", () => {
|
|
|
184
173
|
expect(component.find(`.${slotClass}`).text()).toBe(slotText);
|
|
185
174
|
});
|
|
186
175
|
|
|
187
|
-
|
|
188
|
-
it("renders content from before-file slot", () => {
|
|
176
|
+
it("Before – renders content from before-file slot", () => {
|
|
189
177
|
const slotText = "Before";
|
|
190
178
|
const slotClass = "before-content";
|
|
191
179
|
|
|
@@ -206,8 +194,7 @@ describe("UFiles.vue", () => {
|
|
|
206
194
|
expect(component.find(`.${slotClass}`).text()).toBe(`${slotText}0`);
|
|
207
195
|
});
|
|
208
196
|
|
|
209
|
-
|
|
210
|
-
it("renders content from after-file slot", () => {
|
|
197
|
+
it("After – renders content from after-file slot", () => {
|
|
211
198
|
const slotText = "After";
|
|
212
199
|
const slotClass = "after-content";
|
|
213
200
|
|
|
@@ -228,8 +215,7 @@ describe("UFiles.vue", () => {
|
|
|
228
215
|
expect(component.find(`.${slotClass}`).text()).toBe(`${slotText}0`);
|
|
229
216
|
});
|
|
230
217
|
|
|
231
|
-
|
|
232
|
-
it("provides correct bindings to file slot", () => {
|
|
218
|
+
it("File – provides correct bindings to file slot", () => {
|
|
233
219
|
const fileName = "file1.pdf";
|
|
234
220
|
const fileIndex = "0";
|
|
235
221
|
const fileList = [createMockFile(fileName)];
|
|
@@ -266,10 +252,8 @@ describe("UFiles.vue", () => {
|
|
|
266
252
|
});
|
|
267
253
|
});
|
|
268
254
|
|
|
269
|
-
// Events tests
|
|
270
255
|
describe("Events", () => {
|
|
271
|
-
|
|
272
|
-
it("emits remove event when file is removed", async () => {
|
|
256
|
+
it("Remove – emits remove event when file is removed", async () => {
|
|
273
257
|
const fileList = [createMockFile("file1.pdf")];
|
|
274
258
|
const fileId = "test-id";
|
|
275
259
|
const removable = true;
|
|
@@ -291,10 +275,8 @@ describe("UFiles.vue", () => {
|
|
|
291
275
|
});
|
|
292
276
|
});
|
|
293
277
|
|
|
294
|
-
// Exposed refs tests
|
|
295
278
|
describe("Exposed refs", () => {
|
|
296
|
-
|
|
297
|
-
it("exposes itemsRef", () => {
|
|
279
|
+
it("itemsRef – exposes itemsRef", () => {
|
|
298
280
|
const component = mount(UFiles, {
|
|
299
281
|
props: {
|
|
300
282
|
fileList: [],
|
|
@@ -6,10 +6,8 @@ import UHeader from "../UHeader.vue";
|
|
|
6
6
|
import type { Props } from "../types";
|
|
7
7
|
|
|
8
8
|
describe("UHeader.vue", () => {
|
|
9
|
-
// Props tests
|
|
10
9
|
describe("Props", () => {
|
|
11
|
-
|
|
12
|
-
it("applies the correct size class", async () => {
|
|
10
|
+
it("Size – applies the correct size class", async () => {
|
|
13
11
|
const size = {
|
|
14
12
|
xs: "text-lg",
|
|
15
13
|
sm: "text-xl",
|
|
@@ -30,8 +28,7 @@ describe("UHeader.vue", () => {
|
|
|
30
28
|
});
|
|
31
29
|
});
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
it("applies the correct color class", async () => {
|
|
31
|
+
it("Color – applies the correct color class", async () => {
|
|
35
32
|
const colors = [
|
|
36
33
|
"primary",
|
|
37
34
|
"secondary",
|
|
@@ -58,8 +55,7 @@ describe("UHeader.vue", () => {
|
|
|
58
55
|
});
|
|
59
56
|
});
|
|
60
57
|
|
|
61
|
-
|
|
62
|
-
it("applies the correct variant class", async () => {
|
|
58
|
+
it("Variant – applies the correct variant class", async () => {
|
|
63
59
|
const variants = {
|
|
64
60
|
default: "text-primary",
|
|
65
61
|
lifted: "text-primary-lifted",
|
|
@@ -79,8 +75,7 @@ describe("UHeader.vue", () => {
|
|
|
79
75
|
});
|
|
80
76
|
});
|
|
81
77
|
|
|
82
|
-
|
|
83
|
-
it("applies the correct weight class", async () => {
|
|
78
|
+
it("Weight – applies the correct weight class", async () => {
|
|
84
79
|
const weights = {
|
|
85
80
|
light: "font-light",
|
|
86
81
|
normal: "font-normal",
|
|
@@ -100,8 +95,7 @@ describe("UHeader.vue", () => {
|
|
|
100
95
|
});
|
|
101
96
|
});
|
|
102
97
|
|
|
103
|
-
|
|
104
|
-
it("renders the correct label text", () => {
|
|
98
|
+
it("Label – renders the correct label text", () => {
|
|
105
99
|
const label = "Header Text";
|
|
106
100
|
|
|
107
101
|
const component = mount(UHeader, {
|
|
@@ -113,8 +107,7 @@ describe("UHeader.vue", () => {
|
|
|
113
107
|
expect(component.text()).toBe(label);
|
|
114
108
|
});
|
|
115
109
|
|
|
116
|
-
|
|
117
|
-
it("renders the correct HTML tag", () => {
|
|
110
|
+
it("Tag – renders the correct HTML tag", () => {
|
|
118
111
|
const tags = ["h1", "h2", "h3", "h4", "h5", "h6", "div", "span"];
|
|
119
112
|
|
|
120
113
|
tags.forEach((tag) => {
|
|
@@ -128,8 +121,7 @@ describe("UHeader.vue", () => {
|
|
|
128
121
|
});
|
|
129
122
|
});
|
|
130
123
|
|
|
131
|
-
|
|
132
|
-
it("applies line class when line prop is true", () => {
|
|
124
|
+
it("Line – applies line class when line prop is true", () => {
|
|
133
125
|
const line = true;
|
|
134
126
|
const lineClasses = "leading-none";
|
|
135
127
|
|
|
@@ -142,8 +134,7 @@ describe("UHeader.vue", () => {
|
|
|
142
134
|
expect(component.attributes("class")).toContain(lineClasses);
|
|
143
135
|
});
|
|
144
136
|
|
|
145
|
-
|
|
146
|
-
it("applies the correct data-test attribute", () => {
|
|
137
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
147
138
|
const dataTest = "test-header";
|
|
148
139
|
|
|
149
140
|
const component = mount(UHeader, {
|
|
@@ -156,10 +147,8 @@ describe("UHeader.vue", () => {
|
|
|
156
147
|
});
|
|
157
148
|
});
|
|
158
149
|
|
|
159
|
-
// Slots tests
|
|
160
150
|
describe("Slots", () => {
|
|
161
|
-
|
|
162
|
-
it("renders content from default slot", () => {
|
|
151
|
+
it("Default – renders content from default slot", () => {
|
|
163
152
|
const slotContent = "Custom Content";
|
|
164
153
|
const label = "Header";
|
|
165
154
|
|
|
@@ -177,10 +166,8 @@ describe("UHeader.vue", () => {
|
|
|
177
166
|
});
|
|
178
167
|
});
|
|
179
168
|
|
|
180
|
-
// Exposed refs tests
|
|
181
169
|
describe("Exposed refs", () => {
|
|
182
|
-
|
|
183
|
-
it("exposes headerRef", () => {
|
|
170
|
+
it("headerRef – exposes headerRef", () => {
|
|
184
171
|
const component = mount(UHeader, {});
|
|
185
172
|
|
|
186
173
|
expect(component.vm.headerRef).toBeDefined();
|