vueless 1.3.1-beta.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/config.ts +2 -0
- package/ui.container-card/tests/UCard.test.ts +14 -31
- package/ui.container-card/types.ts +1 -1
- package/ui.container-col/tests/UCol.test.ts +11 -25
- package/ui.container-drawer/config.ts +1 -0
- package/ui.container-drawer/types.ts +1 -1
- 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/config.ts +2 -1
- package/ui.container-modal/types.ts +1 -1
- package/ui.container-modal-confirm/UModalConfirm.vue +2 -2
- package/ui.container-modal-confirm/tests/UModalConfirm.test.ts +28 -57
- package/ui.container-modal-confirm/types.ts +1 -1
- package/ui.container-page/config.ts +2 -0
- package/ui.container-page/tests/UPage.test.ts +18 -38
- package/ui.container-page/types.ts +1 -1
- 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/USkeleton.vue +6 -6
- 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 +8 -8
- 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 +11 -10
- 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 +8 -8
- package/ui.skeleton-text/config.ts +2 -2
- 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/UText.vue +7 -7
- package/ui.text-block/config.ts +8 -7
- package/ui.text-block/storybook/stories.ts +13 -25
- package/ui.text-block/tests/UText.test.ts +27 -28
- package/ui.text-block/types.ts +6 -1
- 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/config.ts +2 -0
- 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
|
@@ -7,10 +7,8 @@ import USkeleton from "../../ui.skeleton/USkeleton.vue";
|
|
|
7
7
|
import type { Props } from "../types";
|
|
8
8
|
|
|
9
9
|
describe("USkeletonInput.vue", () => {
|
|
10
|
-
// Props tests
|
|
11
10
|
describe("Props", () => {
|
|
12
|
-
|
|
13
|
-
it("renders label skeleton when label prop is true and labelAlign is not topInside", () => {
|
|
11
|
+
it("Label – renders label skeleton when label prop is true and labelAlign is not topInside", () => {
|
|
14
12
|
const label = true;
|
|
15
13
|
const labelAlign = "top";
|
|
16
14
|
|
|
@@ -29,8 +27,7 @@ describe("USkeletonInput.vue", () => {
|
|
|
29
27
|
expect(skeletons.length).toBe(expectedComponentAmount);
|
|
30
28
|
});
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
it("does not render label skeleton when label prop is false", () => {
|
|
30
|
+
it("Label – does not render label skeleton when label prop is false", () => {
|
|
34
31
|
const label = false;
|
|
35
32
|
const labelAlign = "top";
|
|
36
33
|
|
|
@@ -49,8 +46,7 @@ describe("USkeletonInput.vue", () => {
|
|
|
49
46
|
expect(skeletons.length).toBe(expectedComponentAmount);
|
|
50
47
|
});
|
|
51
48
|
|
|
52
|
-
|
|
53
|
-
it("does not render label skeleton when labelAlign is topInside", () => {
|
|
49
|
+
it("Label – does not render label skeleton when labelAlign is topInside", () => {
|
|
54
50
|
const label = true;
|
|
55
51
|
const labelAlign = "topInside";
|
|
56
52
|
|
|
@@ -69,8 +65,7 @@ describe("USkeletonInput.vue", () => {
|
|
|
69
65
|
expect(skeletons.length).toBe(expectedComponentAmount);
|
|
70
66
|
});
|
|
71
67
|
|
|
72
|
-
|
|
73
|
-
it("applies the correct size class to input for input type", () => {
|
|
68
|
+
it("Size – applies the correct size class to input for input type", () => {
|
|
74
69
|
const size = {
|
|
75
70
|
sm: "h-11",
|
|
76
71
|
md: "h-12.5",
|
|
@@ -92,8 +87,7 @@ describe("USkeletonInput.vue", () => {
|
|
|
92
87
|
});
|
|
93
88
|
});
|
|
94
89
|
|
|
95
|
-
|
|
96
|
-
it("applies the correct size class to input for textarea type", () => {
|
|
90
|
+
it("Size – applies the correct size class to input for textarea type", () => {
|
|
97
91
|
const size = {
|
|
98
92
|
sm: "h-15.75",
|
|
99
93
|
md: "h-18",
|
|
@@ -115,8 +109,7 @@ describe("USkeletonInput.vue", () => {
|
|
|
115
109
|
});
|
|
116
110
|
});
|
|
117
111
|
|
|
118
|
-
|
|
119
|
-
it("applies the correct size class to label", () => {
|
|
112
|
+
it("Size – applies the correct size class to label", () => {
|
|
120
113
|
const size = {
|
|
121
114
|
sm: "h-3",
|
|
122
115
|
md: "h-3.5",
|
|
@@ -137,8 +130,7 @@ describe("USkeletonInput.vue", () => {
|
|
|
137
130
|
});
|
|
138
131
|
});
|
|
139
132
|
|
|
140
|
-
|
|
141
|
-
it("applies the correct labelAlign class to wrapper", () => {
|
|
133
|
+
it("LabelAlign – applies the correct labelAlign class to wrapper", () => {
|
|
142
134
|
const labelAlign = {
|
|
143
135
|
top: "flex-col",
|
|
144
136
|
left: "flex-row",
|
|
@@ -156,8 +148,7 @@ describe("USkeletonInput.vue", () => {
|
|
|
156
148
|
});
|
|
157
149
|
});
|
|
158
150
|
|
|
159
|
-
|
|
160
|
-
it("applies the correct type class to input", () => {
|
|
151
|
+
it("Type – applies the correct type class to input", () => {
|
|
161
152
|
const type = {
|
|
162
153
|
input: "h-8.5", // Using md size and top labelAlign as default
|
|
163
154
|
textarea: "h-14.5", // Using md size and top labelAlign as default
|
|
@@ -178,32 +169,7 @@ describe("USkeletonInput.vue", () => {
|
|
|
178
169
|
});
|
|
179
170
|
});
|
|
180
171
|
|
|
181
|
-
|
|
182
|
-
it("passes the correct variant to skeleton components", () => {
|
|
183
|
-
const variants = {
|
|
184
|
-
light: "light",
|
|
185
|
-
default: "default",
|
|
186
|
-
dark: "dark",
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
Object.entries(variants).forEach(([variant, expectedVariant]) => {
|
|
190
|
-
const component = mount(USkeletonInput, {
|
|
191
|
-
props: {
|
|
192
|
-
variant: variant as Props["variant"],
|
|
193
|
-
labelAlign: "top", // To ensure label is rendered
|
|
194
|
-
},
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
const skeletons = component.findAllComponents(USkeleton);
|
|
198
|
-
|
|
199
|
-
skeletons.forEach((skeleton) => {
|
|
200
|
-
expect(skeleton.props("variant")).toBe(expectedVariant);
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
// DataTest prop
|
|
206
|
-
it("applies the correct data-test attribute", () => {
|
|
172
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
207
173
|
const dataTest = "test-skeleton-input";
|
|
208
174
|
|
|
209
175
|
const component = mount(USkeletonInput, {
|
|
@@ -216,10 +182,8 @@ describe("USkeletonInput.vue", () => {
|
|
|
216
182
|
});
|
|
217
183
|
});
|
|
218
184
|
|
|
219
|
-
// Slots tests
|
|
220
185
|
describe("Slots", () => {
|
|
221
|
-
|
|
222
|
-
it("renders content from label slot", () => {
|
|
186
|
+
it("Label – renders content from label slot", () => {
|
|
223
187
|
const slotContent = "Custom Label";
|
|
224
188
|
const slotClass = "custom-label";
|
|
225
189
|
|
|
@@ -238,8 +202,7 @@ describe("USkeletonInput.vue", () => {
|
|
|
238
202
|
expect(component.findAllComponents(USkeleton).length).toBe(1); // Only input skeleton, not label skeleton
|
|
239
203
|
});
|
|
240
204
|
|
|
241
|
-
|
|
242
|
-
it("renders content from default slot", () => {
|
|
205
|
+
it("Default – renders content from default slot", () => {
|
|
243
206
|
const slotContent = "Custom Content";
|
|
244
207
|
const slotClass = "custom-content";
|
|
245
208
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed } from "vue";
|
|
3
2
|
import { useUI } from "../composables/useUI";
|
|
4
3
|
import { getDefaults } from "../utils/ui";
|
|
5
4
|
|
|
@@ -12,24 +11,25 @@ import USkeleton from "../ui.skeleton/USkeleton.vue";
|
|
|
12
11
|
|
|
13
12
|
defineOptions({ inheritAttrs: false });
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
withDefaults(defineProps<Props>(), {
|
|
16
15
|
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
17
16
|
});
|
|
18
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Get element / nested component attributes for each config token ✨
|
|
20
|
+
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
21
|
+
*/
|
|
19
22
|
const { getDataTest, wrapperAttrs, headerAttrs, textAttrs, headerWrapperAttrs, textWrapperAttrs } =
|
|
20
|
-
useUI<Config>(
|
|
21
|
-
defaultConfig,
|
|
22
|
-
computed(() => props),
|
|
23
|
-
);
|
|
23
|
+
useUI<Config>(defaultConfig);
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
26
|
<template>
|
|
27
27
|
<div v-bind="wrapperAttrs" :data-test="getDataTest()">
|
|
28
28
|
<div v-if="headerLines" v-bind="headerWrapperAttrs">
|
|
29
|
-
<USkeleton v-for="line in headerLines" :key="line"
|
|
29
|
+
<USkeleton v-for="line in headerLines" :key="line" v-bind="headerAttrs" />
|
|
30
30
|
</div>
|
|
31
31
|
<div v-if="textLines" v-bind="textWrapperAttrs">
|
|
32
|
-
<USkeleton v-for="line in textLines" :key="line"
|
|
32
|
+
<USkeleton v-for="line in textLines" :key="line" v-bind="textAttrs" />
|
|
33
33
|
</div>
|
|
34
34
|
</div>
|
|
35
35
|
</template>
|
|
@@ -14,9 +14,10 @@ export default /*tw*/ {
|
|
|
14
14
|
"2xl": "h-11.5",
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
|
+
compoundVariants: [{ textLines: 0, headerLines: 1, class: "last:max-w-full" }],
|
|
17
18
|
},
|
|
18
19
|
text: {
|
|
19
|
-
base: "{USkeleton} rounded-small last:max-w-4/5",
|
|
20
|
+
base: "{USkeleton} rounded-small only:max-w-full last:max-w-4/5",
|
|
20
21
|
variants: {
|
|
21
22
|
size: {
|
|
22
23
|
xs: "h-3.5",
|
|
@@ -31,7 +32,6 @@ export default /*tw*/ {
|
|
|
31
32
|
body: "{USkeleton} rounded-small",
|
|
32
33
|
defaults: {
|
|
33
34
|
size: "md",
|
|
34
|
-
variant: "default",
|
|
35
35
|
headerLines: 0,
|
|
36
36
|
textLines: 3,
|
|
37
37
|
},
|
|
@@ -7,7 +7,7 @@ import UCol from "../../ui.container-col/UCol.vue";
|
|
|
7
7
|
import type { Props } from "../types";
|
|
8
8
|
|
|
9
9
|
interface SkeletonTextArgs extends Props {
|
|
10
|
-
enum: "size"
|
|
10
|
+
enum: "size";
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export default {
|
|
@@ -54,6 +54,3 @@ Default.args = {};
|
|
|
54
54
|
|
|
55
55
|
export const Sizes = EnumTemplate.bind({});
|
|
56
56
|
Sizes.args = { enum: "size", headerLines: 1, textLines: 3 };
|
|
57
|
-
|
|
58
|
-
export const Variant = EnumTemplate.bind({});
|
|
59
|
-
Variant.args = { enum: "variant" };
|
|
@@ -7,10 +7,8 @@ import USkeleton from "../../ui.skeleton/USkeleton.vue";
|
|
|
7
7
|
import type { Props } from "../types";
|
|
8
8
|
|
|
9
9
|
describe("USkeletonText.vue", () => {
|
|
10
|
-
// Props tests
|
|
11
10
|
describe("Props", () => {
|
|
12
|
-
|
|
13
|
-
it("renders the correct number of header lines", () => {
|
|
11
|
+
it("HeaderLines – renders the correct number of header lines", () => {
|
|
14
12
|
const headerLines = 3;
|
|
15
13
|
|
|
16
14
|
const component = mount(USkeletonText, {
|
|
@@ -26,8 +24,7 @@ describe("USkeletonText.vue", () => {
|
|
|
26
24
|
expect(headerSkeletons.length).toBe(headerLines);
|
|
27
25
|
});
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
it("renders the correct number of text lines", () => {
|
|
27
|
+
it("TextLines – renders the correct number of text lines", () => {
|
|
31
28
|
const textLines = 5;
|
|
32
29
|
|
|
33
30
|
const component = mount(USkeletonText, {
|
|
@@ -41,8 +38,7 @@ describe("USkeletonText.vue", () => {
|
|
|
41
38
|
expect(textSkeletons.length).toBe(textLines);
|
|
42
39
|
});
|
|
43
40
|
|
|
44
|
-
|
|
45
|
-
it("applies the correct size class to header skeletons", () => {
|
|
41
|
+
it("Size – applies the correct size class to header skeletons", () => {
|
|
46
42
|
const size = {
|
|
47
43
|
xs: "h-4.5",
|
|
48
44
|
sm: "h-5",
|
|
@@ -67,8 +63,7 @@ describe("USkeletonText.vue", () => {
|
|
|
67
63
|
});
|
|
68
64
|
});
|
|
69
65
|
|
|
70
|
-
|
|
71
|
-
it("applies the correct size class to text skeletons", () => {
|
|
66
|
+
it("Size – applies the correct size class to text skeletons", () => {
|
|
72
67
|
const size = {
|
|
73
68
|
xs: "h-3.5",
|
|
74
69
|
sm: "h-4.5",
|
|
@@ -93,29 +88,7 @@ describe("USkeletonText.vue", () => {
|
|
|
93
88
|
});
|
|
94
89
|
});
|
|
95
90
|
|
|
96
|
-
|
|
97
|
-
it("passes the correct variant to skeleton components", () => {
|
|
98
|
-
const variants = ["light", "default", "dark"];
|
|
99
|
-
|
|
100
|
-
variants.forEach((variant) => {
|
|
101
|
-
const component = mount(USkeletonText, {
|
|
102
|
-
props: {
|
|
103
|
-
variant: variant as Props["variant"],
|
|
104
|
-
headerLines: 1,
|
|
105
|
-
textLines: 1,
|
|
106
|
-
},
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
const headerSkeleton = component.find("[vl-key='headerWrapper']").findComponent(USkeleton);
|
|
110
|
-
const textSkeleton = component.find("[vl-key='textWrapper']").findComponent(USkeleton);
|
|
111
|
-
|
|
112
|
-
expect(headerSkeleton.props("variant")).toBe(variant);
|
|
113
|
-
expect(textSkeleton.props("variant")).toBe(variant);
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
// DataTest prop
|
|
118
|
-
it("applies the correct data-test attribute", () => {
|
|
91
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
119
92
|
const dataTest = "test-skeleton-text";
|
|
120
93
|
|
|
121
94
|
const component = mount(USkeletonText, {
|
|
@@ -9,10 +9,8 @@ import UText from "../../ui.text-block/UText.vue";
|
|
|
9
9
|
import type { Props } from "../types";
|
|
10
10
|
|
|
11
11
|
describe("UAlert.vue", () => {
|
|
12
|
-
// Props tests
|
|
13
12
|
describe("Props", () => {
|
|
14
|
-
|
|
15
|
-
it("applies the correct variant class", async () => {
|
|
13
|
+
it("Variant – applies the correct variant class", async () => {
|
|
16
14
|
const variants = {
|
|
17
15
|
solid: "text-inverted bg-primary",
|
|
18
16
|
outlined: "text-primary border-primary",
|
|
@@ -32,8 +30,7 @@ describe("UAlert.vue", () => {
|
|
|
32
30
|
});
|
|
33
31
|
});
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
it("applies the correct size class", async () => {
|
|
33
|
+
it("Size – applies the correct size class", async () => {
|
|
37
34
|
const size = {
|
|
38
35
|
xs: "text-tiny",
|
|
39
36
|
sm: "text-small",
|
|
@@ -53,8 +50,7 @@ describe("UAlert.vue", () => {
|
|
|
53
50
|
});
|
|
54
51
|
});
|
|
55
52
|
|
|
56
|
-
|
|
57
|
-
it("applies the correct color class", async () => {
|
|
53
|
+
it("Color – applies the correct color class", async () => {
|
|
58
54
|
const colors = [
|
|
59
55
|
"primary",
|
|
60
56
|
"secondary",
|
|
@@ -78,8 +74,7 @@ describe("UAlert.vue", () => {
|
|
|
78
74
|
});
|
|
79
75
|
});
|
|
80
76
|
|
|
81
|
-
|
|
82
|
-
it("renders the correct title text", () => {
|
|
77
|
+
it("Title – renders the correct title text", () => {
|
|
83
78
|
const title = "Alert Title";
|
|
84
79
|
|
|
85
80
|
const component = mount(UAlert, {
|
|
@@ -91,8 +86,7 @@ describe("UAlert.vue", () => {
|
|
|
91
86
|
expect(component.text()).toContain(title);
|
|
92
87
|
});
|
|
93
88
|
|
|
94
|
-
|
|
95
|
-
it("renders the correct description text", () => {
|
|
89
|
+
it("Description – renders the correct description text", () => {
|
|
96
90
|
const description = "Alert Description";
|
|
97
91
|
|
|
98
92
|
const component = mount(UAlert, {
|
|
@@ -104,8 +98,7 @@ describe("UAlert.vue", () => {
|
|
|
104
98
|
expect(component.text()).toContain(description);
|
|
105
99
|
});
|
|
106
100
|
|
|
107
|
-
|
|
108
|
-
it("renders icon when icon prop is provided", () => {
|
|
101
|
+
it("Icon – renders icon when icon prop is provided", () => {
|
|
109
102
|
const icon = "info";
|
|
110
103
|
|
|
111
104
|
const component = mount(UAlert, {
|
|
@@ -122,8 +115,7 @@ describe("UAlert.vue", () => {
|
|
|
122
115
|
expect(alertIcon).toBeDefined();
|
|
123
116
|
});
|
|
124
117
|
|
|
125
|
-
|
|
126
|
-
it("renders close button when closable prop is true", () => {
|
|
118
|
+
it("Closable – renders close button when closable prop is true", () => {
|
|
127
119
|
const closable = true;
|
|
128
120
|
|
|
129
121
|
const component = mount(UAlert, {
|
|
@@ -137,8 +129,7 @@ describe("UAlert.vue", () => {
|
|
|
137
129
|
expect(closeButton.exists()).toBe(true);
|
|
138
130
|
});
|
|
139
131
|
|
|
140
|
-
|
|
141
|
-
it("auto-closes after timeout", async () => {
|
|
132
|
+
it("Timeout – auto-closes after timeout", async () => {
|
|
142
133
|
vi.useFakeTimers();
|
|
143
134
|
|
|
144
135
|
const timeout = 1000;
|
|
@@ -159,8 +150,7 @@ describe("UAlert.vue", () => {
|
|
|
159
150
|
vi.useRealTimers();
|
|
160
151
|
});
|
|
161
152
|
|
|
162
|
-
|
|
163
|
-
it("applies the correct data-test attribute", () => {
|
|
153
|
+
it("Data Test – applies the correct data-test attribute", () => {
|
|
164
154
|
const dataTest = "test-alert";
|
|
165
155
|
|
|
166
156
|
const component = mount(UAlert, {
|
|
@@ -173,10 +163,8 @@ describe("UAlert.vue", () => {
|
|
|
173
163
|
});
|
|
174
164
|
});
|
|
175
165
|
|
|
176
|
-
// Slots tests
|
|
177
166
|
describe("Slots", () => {
|
|
178
|
-
|
|
179
|
-
it("renders content from default slot", () => {
|
|
167
|
+
it("Default – renders content from default slot", () => {
|
|
180
168
|
const slotContent = "Custom Content";
|
|
181
169
|
|
|
182
170
|
const component = mount(UAlert, {
|
|
@@ -188,8 +176,7 @@ describe("UAlert.vue", () => {
|
|
|
188
176
|
expect(component.text()).toContain(slotContent);
|
|
189
177
|
});
|
|
190
178
|
|
|
191
|
-
|
|
192
|
-
it("renders content from title slot", () => {
|
|
179
|
+
it("Title – renders content from title slot", () => {
|
|
193
180
|
const title = "Alert Title";
|
|
194
181
|
const slotText = "Custom Title";
|
|
195
182
|
const slotClass = "title-content";
|
|
@@ -208,8 +195,7 @@ describe("UAlert.vue", () => {
|
|
|
208
195
|
expect(component.find(`.${slotClass}`).text()).toBe(slotText);
|
|
209
196
|
});
|
|
210
197
|
|
|
211
|
-
|
|
212
|
-
it("renders content from description slot", () => {
|
|
198
|
+
it("Description – renders content from description slot", () => {
|
|
213
199
|
const description = "Alert Description";
|
|
214
200
|
const slotText = "Custom Description";
|
|
215
201
|
const slotClass = "description-content";
|
|
@@ -228,8 +214,7 @@ describe("UAlert.vue", () => {
|
|
|
228
214
|
expect(component.find(`.${slotClass}`).text()).toBe(slotText);
|
|
229
215
|
});
|
|
230
216
|
|
|
231
|
-
|
|
232
|
-
it("renders content from left slot", () => {
|
|
217
|
+
it("Left – renders content from left slot", () => {
|
|
233
218
|
const slotText = "Left";
|
|
234
219
|
const slotClass = "left-content";
|
|
235
220
|
|
|
@@ -243,8 +228,7 @@ describe("UAlert.vue", () => {
|
|
|
243
228
|
expect(component.find(`.${slotClass}`).text()).toBe(slotText);
|
|
244
229
|
});
|
|
245
230
|
|
|
246
|
-
|
|
247
|
-
it("renders content from close slot", () => {
|
|
231
|
+
it("Close – renders content from close slot", () => {
|
|
248
232
|
const slotText = "Close";
|
|
249
233
|
const slotClass = "close-content";
|
|
250
234
|
|
|
@@ -261,8 +245,7 @@ describe("UAlert.vue", () => {
|
|
|
261
245
|
expect(component.find(`.${slotClass}`).text()).toBe(slotText);
|
|
262
246
|
});
|
|
263
247
|
|
|
264
|
-
|
|
265
|
-
it("provides correct bindings to slots", () => {
|
|
248
|
+
it("Slot – provides correct bindings to slots", () => {
|
|
266
249
|
const title = "Alert Title";
|
|
267
250
|
const description = "Alert Description";
|
|
268
251
|
const icon = "info";
|
|
@@ -303,10 +286,8 @@ describe("UAlert.vue", () => {
|
|
|
303
286
|
});
|
|
304
287
|
});
|
|
305
288
|
|
|
306
|
-
// Events tests
|
|
307
289
|
describe("Events", () => {
|
|
308
|
-
|
|
309
|
-
it("emits hidden event when close button is clicked", async () => {
|
|
290
|
+
it("Hide – emits hidden event when close button is clicked", async () => {
|
|
310
291
|
const component = mount(UAlert, {
|
|
311
292
|
props: {
|
|
312
293
|
closable: true,
|
|
@@ -319,10 +300,8 @@ describe("UAlert.vue", () => {
|
|
|
319
300
|
});
|
|
320
301
|
});
|
|
321
302
|
|
|
322
|
-
// Exposed refs tests
|
|
323
303
|
describe("Exposed refs", () => {
|
|
324
|
-
|
|
325
|
-
it("exposes wrapperRef", () => {
|
|
304
|
+
it("wrapperRef – exposes wrapperRef", () => {
|
|
326
305
|
const component = mount(UAlert, {});
|
|
327
306
|
|
|
328
307
|
expect(component.vm.wrapperRef).toBeDefined();
|
|
@@ -13,10 +13,8 @@ describe("UBadge.vue", () => {
|
|
|
13
13
|
label = "Badge";
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
// Props tests
|
|
17
16
|
describe("Props", () => {
|
|
18
|
-
|
|
19
|
-
it("applies the correct variant class", async () => {
|
|
17
|
+
it("Variant – applies the correct variant class", async () => {
|
|
20
18
|
const variants = {
|
|
21
19
|
solid: "text-inverted bg-primary",
|
|
22
20
|
outlined: "border-primary text-primary",
|
|
@@ -36,8 +34,7 @@ describe("UBadge.vue", () => {
|
|
|
36
34
|
});
|
|
37
35
|
});
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
it("applies the correct size class", async () => {
|
|
37
|
+
it("Size – applies the correct size class", async () => {
|
|
41
38
|
const size = {
|
|
42
39
|
sm: "text-tiny",
|
|
43
40
|
md: "text-small",
|
|
@@ -55,8 +52,7 @@ describe("UBadge.vue", () => {
|
|
|
55
52
|
});
|
|
56
53
|
});
|
|
57
54
|
|
|
58
|
-
|
|
59
|
-
it("applies the correct color class", async () => {
|
|
55
|
+
it("Color – applies the correct color class", async () => {
|
|
60
56
|
const colors = [
|
|
61
57
|
"primary",
|
|
62
58
|
"secondary",
|
|
@@ -80,8 +76,7 @@ describe("UBadge.vue", () => {
|
|
|
80
76
|
});
|
|
81
77
|
});
|
|
82
78
|
|
|
83
|
-
|
|
84
|
-
it("renders the correct label text", () => {
|
|
79
|
+
it("Label – renders the correct label text", () => {
|
|
85
80
|
const component = mount(UBadge, {
|
|
86
81
|
props: {
|
|
87
82
|
label,
|
|
@@ -91,8 +86,7 @@ describe("UBadge.vue", () => {
|
|
|
91
86
|
expect(component.text()).toBe(label);
|
|
92
87
|
});
|
|
93
88
|
|
|
94
|
-
|
|
95
|
-
it("renders icon when icon prop is provided", () => {
|
|
89
|
+
it("Icon – renders icon when icon prop is provided", () => {
|
|
96
90
|
const icon = "close";
|
|
97
91
|
|
|
98
92
|
const component = mount(UBadge, {
|
|
@@ -108,8 +102,7 @@ describe("UBadge.vue", () => {
|
|
|
108
102
|
expect(nestedUIconComponents[0].props("name")).toBe(icon);
|
|
109
103
|
});
|
|
110
104
|
|
|
111
|
-
|
|
112
|
-
it("renders left icon when leftIcon prop is provided", () => {
|
|
105
|
+
it("Left – renders left icon when leftIcon prop is provided", () => {
|
|
113
106
|
const leftIcon = "close";
|
|
114
107
|
const label = "Badge";
|
|
115
108
|
|
|
@@ -127,8 +120,7 @@ describe("UBadge.vue", () => {
|
|
|
127
120
|
expect(nestedUIconComponents[0].props("name")).toBe(leftIcon);
|
|
128
121
|
});
|
|
129
122
|
|
|
130
|
-
|
|
131
|
-
it("renders right icon when rightIcon prop is provided", () => {
|
|
123
|
+
it("Right – renders right icon when rightIcon prop is provided", () => {
|
|
132
124
|
const rightIcon = "close";
|
|
133
125
|
const label = "Badge";
|
|
134
126
|
|
|
@@ -146,8 +138,7 @@ describe("UBadge.vue", () => {
|
|
|
146
138
|
expect(nestedUIconComponents[0].props("name")).toBe(rightIcon);
|
|
147
139
|
});
|
|
148
140
|
|
|
149
|
-
|
|
150
|
-
it("applies round class when round prop is true", () => {
|
|
141
|
+
it("Round – applies round class when round prop is true", () => {
|
|
151
142
|
const round = true;
|
|
152
143
|
const roundClasses = "rounded-full";
|
|
153
144
|
|
|
@@ -160,8 +151,7 @@ describe("UBadge.vue", () => {
|
|
|
160
151
|
expect(component.attributes("class")).toContain(roundClasses);
|
|
161
152
|
});
|
|
162
153
|
|
|
163
|
-
|
|
164
|
-
it("applies the correct tabindex attribute", () => {
|
|
154
|
+
it("Tabindex – applies the correct tabindex attribute", () => {
|
|
165
155
|
const tabindex = "2";
|
|
166
156
|
|
|
167
157
|
const component = mount(UBadge, {
|
|
@@ -173,8 +163,7 @@ describe("UBadge.vue", () => {
|
|
|
173
163
|
expect(component.attributes("tabindex")).toBe(tabindex);
|
|
174
164
|
});
|
|
175
165
|
|
|
176
|
-
|
|
177
|
-
it("applies the correct data-test attribute", () => {
|
|
166
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
178
167
|
const dataTest = "test-badge";
|
|
179
168
|
|
|
180
169
|
const component = mount(UBadge, {
|
|
@@ -187,10 +176,8 @@ describe("UBadge.vue", () => {
|
|
|
187
176
|
});
|
|
188
177
|
});
|
|
189
178
|
|
|
190
|
-
// Slots tests
|
|
191
179
|
describe("Slots", () => {
|
|
192
|
-
|
|
193
|
-
it("renders content from default slot", () => {
|
|
180
|
+
it("Default – renders content from default slot", () => {
|
|
194
181
|
const slotContent = "Custom Content";
|
|
195
182
|
const label = "Badge";
|
|
196
183
|
|
|
@@ -207,8 +194,7 @@ describe("UBadge.vue", () => {
|
|
|
207
194
|
expect(component.text()).toContain(slotContent);
|
|
208
195
|
});
|
|
209
196
|
|
|
210
|
-
|
|
211
|
-
it("renders content from left slot", () => {
|
|
197
|
+
it("Left – renders content from left slot", () => {
|
|
212
198
|
const slotText = "Left";
|
|
213
199
|
const slotClass = "left-content";
|
|
214
200
|
|
|
@@ -226,8 +212,7 @@ describe("UBadge.vue", () => {
|
|
|
226
212
|
expect(component.find(`.${slotClass}`).text()).toBe(slotText);
|
|
227
213
|
});
|
|
228
214
|
|
|
229
|
-
|
|
230
|
-
it("renders content from right slot", () => {
|
|
215
|
+
it("Right – renders content from right slot", () => {
|
|
231
216
|
const slotText = "Right";
|
|
232
217
|
const slotClass = "right-content";
|
|
233
218
|
|
|
@@ -245,8 +230,7 @@ describe("UBadge.vue", () => {
|
|
|
245
230
|
expect(component.find(`.${slotClass}`).text()).toBe(slotText);
|
|
246
231
|
});
|
|
247
232
|
|
|
248
|
-
|
|
249
|
-
it("provides correct bindings to slots", () => {
|
|
233
|
+
it("Slot – provides correct bindings to slots", () => {
|
|
250
234
|
const icon = "star";
|
|
251
235
|
const labelClass = "badge-label";
|
|
252
236
|
const iconClass = "badge-icon";
|
|
@@ -271,10 +255,8 @@ describe("UBadge.vue", () => {
|
|
|
271
255
|
});
|
|
272
256
|
});
|
|
273
257
|
|
|
274
|
-
// Events tests
|
|
275
258
|
describe("Events", () => {
|
|
276
|
-
|
|
277
|
-
it("emits click event when clicked", async () => {
|
|
259
|
+
it("Click – emits click event when clicked", async () => {
|
|
278
260
|
const component = mount(UBadge, {});
|
|
279
261
|
|
|
280
262
|
await component.trigger("click");
|
|
@@ -282,8 +264,7 @@ describe("UBadge.vue", () => {
|
|
|
282
264
|
expect(component.emitted("click")).toBeTruthy();
|
|
283
265
|
});
|
|
284
266
|
|
|
285
|
-
|
|
286
|
-
it("emits focus event when focused", async () => {
|
|
267
|
+
it("Focus – emits focus event when focused", async () => {
|
|
287
268
|
const component = mount(UBadge, {});
|
|
288
269
|
|
|
289
270
|
await component.trigger("focus");
|
|
@@ -291,8 +272,7 @@ describe("UBadge.vue", () => {
|
|
|
291
272
|
expect(component.emitted("focus")).toBeTruthy();
|
|
292
273
|
});
|
|
293
274
|
|
|
294
|
-
|
|
295
|
-
it("emits blur event when blurred", async () => {
|
|
275
|
+
it("Blur – emits blur event when blurred", async () => {
|
|
296
276
|
const component = mount(UBadge, {});
|
|
297
277
|
|
|
298
278
|
await component.trigger("blur");
|
|
@@ -300,8 +280,7 @@ describe("UBadge.vue", () => {
|
|
|
300
280
|
expect(component.emitted("blur")).toBeTruthy();
|
|
301
281
|
});
|
|
302
282
|
|
|
303
|
-
|
|
304
|
-
it("emits keydown event when key is pressed", async () => {
|
|
283
|
+
it("Keydown – emits keydown event when key is pressed", async () => {
|
|
305
284
|
const component = mount(UBadge, {});
|
|
306
285
|
|
|
307
286
|
await component.trigger("keydown");
|
|
@@ -310,10 +289,8 @@ describe("UBadge.vue", () => {
|
|
|
310
289
|
});
|
|
311
290
|
});
|
|
312
291
|
|
|
313
|
-
// Exposed refs tests
|
|
314
292
|
describe("Exposed refs", () => {
|
|
315
|
-
|
|
316
|
-
it("exposes wrapperRef", () => {
|
|
293
|
+
it("wrapperRef – exposes wrapperRef", () => {
|
|
317
294
|
const component = mount(UBadge, {});
|
|
318
295
|
|
|
319
296
|
expect(component.vm.wrapperRef).toBeDefined();
|