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
package/ui.text-block/UText.vue
CHANGED
|
@@ -15,28 +15,28 @@ withDefaults(defineProps<Props>(), {
|
|
|
15
15
|
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const textRef = useTemplateRef<HTMLElement>("text");
|
|
19
19
|
|
|
20
20
|
defineExpose({
|
|
21
21
|
/**
|
|
22
22
|
* A reference to the component's wrapper element for direct DOM manipulation.
|
|
23
|
-
* @property {
|
|
23
|
+
* @property {HTMLElement}
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
textRef,
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Get element / nested component attributes for each config token ✨
|
|
30
30
|
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
31
31
|
*/
|
|
32
|
-
const { getDataTest,
|
|
32
|
+
const { getDataTest, textAttrs } = useUI<Config>(defaultConfig);
|
|
33
33
|
</script>
|
|
34
34
|
|
|
35
35
|
<template>
|
|
36
|
-
<
|
|
36
|
+
<component :is="tag" ref="text" v-bind="textAttrs" :data-test="getDataTest()">
|
|
37
37
|
<!-- @slot Use it to add something inside. -->
|
|
38
38
|
<slot>
|
|
39
|
-
|
|
39
|
+
{{ label }}
|
|
40
40
|
</slot>
|
|
41
|
-
</
|
|
41
|
+
</component>
|
|
42
42
|
</template>
|
package/ui.text-block/config.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
|
-
|
|
2
|
+
text: {
|
|
3
3
|
base: `
|
|
4
|
-
flex flex-col
|
|
5
4
|
font-normal leading-normal
|
|
6
5
|
[&_b]:font-bold [&_i]:italic [&_p]:font-normal
|
|
7
6
|
[&_a:not([class])]:underline [&_a:not([class])]:underline-offset-4
|
|
@@ -18,15 +17,16 @@ export default /*tw*/ {
|
|
|
18
17
|
lifted: "text-{color}-lifted",
|
|
19
18
|
accented: "text-{color}-accented",
|
|
20
19
|
muted: "text-{color}/(--vl-disabled-opacity)",
|
|
20
|
+
inverted: "text-{color} brightness-125 dark:brightness-75",
|
|
21
21
|
},
|
|
22
22
|
color: {
|
|
23
23
|
inherit: "text-inherit",
|
|
24
24
|
},
|
|
25
25
|
size: {
|
|
26
|
-
xs: "text-tiny
|
|
27
|
-
sm: "text-small
|
|
28
|
-
md: "text-medium
|
|
29
|
-
lg: "text-large
|
|
26
|
+
xs: "text-tiny",
|
|
27
|
+
sm: "text-small",
|
|
28
|
+
md: "text-medium",
|
|
29
|
+
lg: "text-large",
|
|
30
30
|
},
|
|
31
31
|
align: {
|
|
32
32
|
left: "text-left",
|
|
@@ -52,15 +52,16 @@ export default /*tw*/ {
|
|
|
52
52
|
{ color: "text", variant: "lifted", class: "text-lifted" },
|
|
53
53
|
{ color: "text", variant: "accented", class: "text-accented" },
|
|
54
54
|
{ color: "text", variant: "muted", class: "text-muted" },
|
|
55
|
+
{ color: "text", variant: "inverted", class: "text-inverted brightness-100 dark:brightness-100" },
|
|
55
56
|
],
|
|
56
57
|
},
|
|
57
|
-
label: "",
|
|
58
58
|
defaults: {
|
|
59
59
|
color: "text",
|
|
60
60
|
variant: "default",
|
|
61
61
|
size: "md",
|
|
62
62
|
align: "left",
|
|
63
63
|
weight: "normal",
|
|
64
|
+
tag: "div",
|
|
64
65
|
line: false,
|
|
65
66
|
wrap: true,
|
|
66
67
|
},
|
|
@@ -114,6 +114,19 @@ export const Line: StoryFn<UTextArgs> = (args: UTextArgs) => ({
|
|
|
114
114
|
});
|
|
115
115
|
Line.args = {};
|
|
116
116
|
|
|
117
|
+
export const Tag: StoryFn<UTextArgs> = (args: UTextArgs) => ({
|
|
118
|
+
components: { UText, UCol },
|
|
119
|
+
setup: () => ({ args }),
|
|
120
|
+
template: `
|
|
121
|
+
<UCol>
|
|
122
|
+
<UText tag="p" label="This is a paragraph tag" />
|
|
123
|
+
<UText tag="span" label="This is a span tag" />
|
|
124
|
+
<UText tag="div" label="This is a div tag (default)" />
|
|
125
|
+
</UCol>
|
|
126
|
+
`,
|
|
127
|
+
});
|
|
128
|
+
Tag.args = {};
|
|
129
|
+
|
|
117
130
|
export const Wrap: StoryFn<UTextArgs> = (args: UTextArgs) => ({
|
|
118
131
|
components: { UText, UCol },
|
|
119
132
|
setup: () => ({ args }),
|
|
@@ -135,31 +148,6 @@ export const Wrap: StoryFn<UTextArgs> = (args: UTextArgs) => ({
|
|
|
135
148
|
});
|
|
136
149
|
Wrap.args = {};
|
|
137
150
|
|
|
138
|
-
export const Paragraphs = DefaultTemplate.bind({});
|
|
139
|
-
Paragraphs.args = {
|
|
140
|
-
slotTemplate: `
|
|
141
|
-
<template #default>
|
|
142
|
-
<p>
|
|
143
|
-
In a world where technology evolves at an unprecedented pace, staying
|
|
144
|
-
updated with the latest advancements is crucial for success. Companies
|
|
145
|
-
that adapt quickly to new trends often find themselves at the forefront
|
|
146
|
-
of their industries, leading to increased innovation and productivity.
|
|
147
|
-
However, it's not just about adopting new tools but also about integrating
|
|
148
|
-
them seamlessly into existing workflows to maximize their potential.
|
|
149
|
-
</p>
|
|
150
|
-
|
|
151
|
-
<p>
|
|
152
|
-
Employees must be encouraged to continuously learn and develop new skills,
|
|
153
|
-
ensuring they can leverage these technological advancements effectively.
|
|
154
|
-
This not only enhances their professional growth but also contributes to
|
|
155
|
-
the overall success of the organization. By fostering a culture of
|
|
156
|
-
continuous improvement, businesses can navigate the challenges of a
|
|
157
|
-
rapidly changing landscape and emerge stronger and more competitive.
|
|
158
|
-
</p>
|
|
159
|
-
</template>
|
|
160
|
-
`,
|
|
161
|
-
};
|
|
162
|
-
|
|
163
151
|
export const List = DefaultTemplate.bind({});
|
|
164
152
|
List.args = {
|
|
165
153
|
slotTemplate: `
|
|
@@ -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, {
|
|
@@ -136,8 +128,21 @@ describe("UText.vue", () => {
|
|
|
136
128
|
expect(component.html()).toContain(label);
|
|
137
129
|
});
|
|
138
130
|
|
|
139
|
-
|
|
140
|
-
|
|
131
|
+
it("renders the correct HTML tag", () => {
|
|
132
|
+
const tags = ["div", "p", "span", "section", "article"];
|
|
133
|
+
|
|
134
|
+
tags.forEach((tag) => {
|
|
135
|
+
const component = mount(UText, {
|
|
136
|
+
props: {
|
|
137
|
+
tag,
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
expect(component.element.tagName.toLowerCase()).toBe(tag);
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
141
146
|
const dataTest = "test-text";
|
|
142
147
|
|
|
143
148
|
const component = mount(UText, {
|
|
@@ -149,8 +154,7 @@ describe("UText.vue", () => {
|
|
|
149
154
|
expect(component.attributes("data-test")).toBe(dataTest);
|
|
150
155
|
});
|
|
151
156
|
|
|
152
|
-
|
|
153
|
-
it("applies custom classes from config prop", () => {
|
|
157
|
+
it("Config – applies custom classes from config prop", () => {
|
|
154
158
|
const customClasses = "font-bold";
|
|
155
159
|
|
|
156
160
|
const component = mount(UText, {
|
|
@@ -165,10 +169,8 @@ describe("UText.vue", () => {
|
|
|
165
169
|
});
|
|
166
170
|
});
|
|
167
171
|
|
|
168
|
-
// Slots tests
|
|
169
172
|
describe("Slots", () => {
|
|
170
|
-
|
|
171
|
-
it("renders content from default slot", () => {
|
|
173
|
+
it("Default – renders content from default slot", () => {
|
|
172
174
|
const slotContent = "Custom Content";
|
|
173
175
|
|
|
174
176
|
const component = mount(UText, {
|
|
@@ -180,8 +182,7 @@ describe("UText.vue", () => {
|
|
|
180
182
|
expect(component.text()).toContain(slotContent);
|
|
181
183
|
});
|
|
182
184
|
|
|
183
|
-
|
|
184
|
-
it("default slot overrides label prop", () => {
|
|
185
|
+
it("Default slot overrides label – default slot overrides label prop", () => {
|
|
185
186
|
const label = "Label Text";
|
|
186
187
|
const slotContent = "Custom Content";
|
|
187
188
|
|
|
@@ -199,13 +200,11 @@ describe("UText.vue", () => {
|
|
|
199
200
|
});
|
|
200
201
|
});
|
|
201
202
|
|
|
202
|
-
// Exposed refs tests
|
|
203
203
|
describe("Exposed refs", () => {
|
|
204
|
-
|
|
205
|
-
it("exposes wrapperRef", () => {
|
|
204
|
+
it("wrapperRef – exposes wrapperRef", () => {
|
|
206
205
|
const component = mount(UText, {});
|
|
207
206
|
|
|
208
|
-
expect(component.vm.
|
|
207
|
+
expect(component.vm.textRef).toBeDefined();
|
|
209
208
|
});
|
|
210
209
|
});
|
|
211
210
|
});
|
package/ui.text-block/types.ts
CHANGED
|
@@ -22,7 +22,7 @@ export interface Props {
|
|
|
22
22
|
/**
|
|
23
23
|
* Text variant.
|
|
24
24
|
*/
|
|
25
|
-
variant?: "default" | "accented" | "lifted" | "muted";
|
|
25
|
+
variant?: "default" | "accented" | "lifted" | "muted" | "inverted";
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Font weight.
|
|
@@ -45,6 +45,11 @@ export interface Props {
|
|
|
45
45
|
| "grayscale"
|
|
46
46
|
| "inherit";
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Allows changing HTML tag.
|
|
50
|
+
*/
|
|
51
|
+
tag?: string;
|
|
52
|
+
|
|
48
53
|
/**
|
|
49
54
|
* Removes text line height (useful for 1-line text).
|
|
50
55
|
*/
|
|
@@ -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();
|