vueless 1.3.1 → 1.3.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/icons/internal/progress_activity.svg +1 -0
- package/package.json +1 -1
- package/ui.container-accordion/tests/UAccordion.test.ts +6 -9
- package/ui.container-accordion-item/tests/UAccordionItem.test.ts +18 -41
- package/ui.container-card/tests/UCard.test.ts +14 -31
- package/ui.container-col/tests/UCol.test.ts +11 -25
- package/ui.container-group/tests/UGroup.test.ts +12 -26
- package/ui.container-groups/tests/UGroups.test.ts +4 -11
- package/ui.container-modal/UModal.vue +1 -1
- package/ui.container-modal-confirm/UModalConfirm.vue +2 -2
- package/ui.container-modal-confirm/tests/UModalConfirm.test.ts +27 -56
- package/ui.container-page/tests/UPage.test.ts +17 -38
- package/ui.container-row/tests/URow.test.ts +11 -25
- package/ui.form-calendar/config.ts +0 -1
- package/ui.form-checkbox/config.ts +14 -15
- package/ui.form-checkbox/storybook/docs.mdx +0 -16
- package/ui.form-checkbox/storybook/optionKeys.mdx +17 -0
- package/ui.form-checkbox/storybook/stories.ts +1 -3
- package/ui.form-checkbox-group/storybook/docs.mdx +2 -2
- package/ui.form-checkbox-multi-state/storybook/docs.mdx +3 -0
- package/ui.loader/ULoader.vue +10 -2
- package/ui.loader/config.ts +14 -1
- package/ui.loader/storybook/stories.ts +4 -1
- package/ui.loader/tests/ULoader.test.ts +74 -17
- package/ui.loader/types.ts +5 -0
- package/ui.loader-overlay/tests/ULoaderOverlay.test.ts +6 -15
- package/ui.loader-progress/tests/ULoaderProgress.test.ts +8 -18
- package/ui.navigation-breadcrumbs/tests/UBreadcrumbs.test.ts +18 -40
- package/ui.navigation-pagination/tests/UPagination.test.ts +18 -40
- package/ui.navigation-progress/tests/UProgress.test.ts +11 -25
- package/ui.navigation-tab/tests/UTab.test.ts +21 -46
- package/ui.navigation-tabs/tests/UTabs.test.ts +13 -30
- package/ui.other-chip/tests/UChip.test.ts +13 -29
- package/ui.other-dot/tests/UDot.test.ts +4 -10
- package/ui.other-theme-color-toggle/tests/UThemeColorToggle.test.ts +13 -29
- package/ui.skeleton/config.ts +1 -13
- package/ui.skeleton/storybook/stories.ts +3 -20
- package/ui.skeleton/tests/USkeleton.test.ts +2 -27
- package/ui.skeleton/types.ts +0 -5
- package/ui.skeleton-choice/USkeletonChoice.vue +2 -2
- package/ui.skeleton-choice/config.ts +0 -1
- package/ui.skeleton-choice/storybook/stories.ts +3 -6
- package/ui.skeleton-choice/tests/USkeletonChoice.test.ts +7 -35
- package/ui.skeleton-choice/types.ts +0 -5
- package/ui.skeleton-input/USkeletonInput.vue +3 -3
- package/ui.skeleton-input/config.ts +0 -1
- package/ui.skeleton-input/storybook/stories.ts +4 -7
- package/ui.skeleton-input/tests/USkeletonInput.test.ts +11 -48
- package/ui.skeleton-input/types.ts +0 -5
- package/ui.skeleton-text/USkeletonText.vue +2 -2
- package/ui.skeleton-text/config.ts +0 -1
- package/ui.skeleton-text/storybook/stories.ts +1 -4
- package/ui.skeleton-text/tests/USkeletonText.test.ts +5 -32
- package/ui.skeleton-text/types.ts +0 -5
- package/ui.text-alert/tests/UAlert.test.ts +17 -38
- package/ui.text-badge/tests/UBadge.test.ts +19 -42
- package/ui.text-block/tests/UText.test.ts +12 -27
- package/ui.text-empty/tests/UEmpty.test.ts +14 -31
- package/ui.text-file/tests/UFile.test.ts +13 -30
- package/ui.text-files/tests/UFiles.test.ts +14 -32
- package/ui.text-header/tests/UHeader.test.ts +10 -23
- package/ui.text-notify/tests/UNotify.test.ts +12 -26
- package/ui.text-number/tests/UNumber.test.ts +16 -35
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Markdown } from "@storybook/addon-docs/blocks";
|
|
2
|
+
|
|
3
|
+
## Option meta keys
|
|
4
|
+
Keys you may/have to provide to the component in an option object.
|
|
5
|
+
|
|
6
|
+
<Markdown>
|
|
7
|
+
{`
|
|
8
|
+
| Key name | Description | Type |
|
|
9
|
+
| ------------------| ---------------------------------------| ---------------------------------------|
|
|
10
|
+
| value | Native value attribute | Boolean, String, Number, Array, Object |
|
|
11
|
+
| trueValue | Own value for checkbox checked state | Boolean, String, Number, Array, Object |
|
|
12
|
+
| falseValue | Own value for checkbox unchecked state | Boolean, String, Number, Array, Object |
|
|
13
|
+
| label | Option label | String |
|
|
14
|
+
| icon | Option icon | String |
|
|
15
|
+
| description | Option description | Number |
|
|
16
|
+
`}
|
|
17
|
+
</Markdown>
|
|
@@ -158,9 +158,7 @@ export const BottomSlot = DefaultTemplate.bind({});
|
|
|
158
158
|
BottomSlot.args = {
|
|
159
159
|
slotTemplate: `
|
|
160
160
|
<template #bottom>
|
|
161
|
-
<
|
|
162
|
-
<ULink label="Learn more" size="sm" class="mr-1.5" />
|
|
163
|
-
</UChip>
|
|
161
|
+
<ULink label="Learn more" size="sm" class="mr-1.5" />
|
|
164
162
|
</template>
|
|
165
163
|
`,
|
|
166
164
|
};
|
|
@@ -3,6 +3,7 @@ import { getSource } from "../../utils/storybook";
|
|
|
3
3
|
|
|
4
4
|
import * as stories from "./stories";
|
|
5
5
|
import defaultConfig from "../config?raw"
|
|
6
|
+
import CheckboxOptionKeys from "../../ui.form-checkbox/storybook/optionKeys.mdx"
|
|
6
7
|
|
|
7
8
|
<Meta of={stories} />
|
|
8
9
|
<Title of={stories} />
|
|
@@ -12,8 +13,7 @@ import defaultConfig from "../config?raw"
|
|
|
12
13
|
<Controls of={stories.Default} />
|
|
13
14
|
<Stories of={stories} />
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
Full list of keys you may/have to provide to the component in an option object can be found here: <a href="https://ui.vueless.com/?path=/docs/3100--docs" target="_blank">UCheckbox docs</a>.
|
|
16
|
+
<CheckboxOptionKeys />
|
|
17
17
|
|
|
18
18
|
## Default config
|
|
19
19
|
<Source code={getSource(defaultConfig)} language="jsx" dark />
|
|
@@ -3,6 +3,7 @@ import { getSource } from "../../utils/storybook";
|
|
|
3
3
|
|
|
4
4
|
import * as stories from "./stories";
|
|
5
5
|
import defaultConfig from "../config?raw"
|
|
6
|
+
import CheckboxOptionKeys from "../../ui.form-checkbox/storybook/optionKeys.mdx"
|
|
6
7
|
|
|
7
8
|
<Meta of={stories} />
|
|
8
9
|
<Title of={stories} />
|
|
@@ -12,5 +13,7 @@ import defaultConfig from "../config?raw"
|
|
|
12
13
|
<Controls of={stories.Default} />
|
|
13
14
|
<Stories of={stories} />
|
|
14
15
|
|
|
16
|
+
<CheckboxOptionKeys />
|
|
17
|
+
|
|
15
18
|
## Default config
|
|
16
19
|
<Source code={getSource(defaultConfig)} language="jsx" dark />
|
package/ui.loader/ULoader.vue
CHANGED
|
@@ -4,6 +4,8 @@ import { useTemplateRef } from "vue";
|
|
|
4
4
|
import { useUI } from "../composables/useUI";
|
|
5
5
|
import { getDefaults } from "../utils/ui";
|
|
6
6
|
|
|
7
|
+
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
8
|
+
|
|
7
9
|
import { COMPONENT_NAME, ELLIPSES_AMOUNT } from "./constants";
|
|
8
10
|
import defaultConfig from "./config";
|
|
9
11
|
|
|
@@ -29,7 +31,8 @@ defineExpose({
|
|
|
29
31
|
* Get element / nested component attributes for each config token ✨
|
|
30
32
|
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
31
33
|
*/
|
|
32
|
-
const { getDataTest, config, loaderAttrs, ellipseAttrs } =
|
|
34
|
+
const { getDataTest, config, loaderAttrs, ellipseAttrs, spinnerIconAttrs } =
|
|
35
|
+
useUI<Config>(defaultConfig);
|
|
33
36
|
</script>
|
|
34
37
|
|
|
35
38
|
<template>
|
|
@@ -37,7 +40,12 @@ const { getDataTest, config, loaderAttrs, ellipseAttrs } = useUI<Config>(default
|
|
|
37
40
|
<div v-if="loading" ref="loader" v-bind="loaderAttrs" :data-test="getDataTest()">
|
|
38
41
|
<!-- @slot Use it to add something instead of the default loader. -->
|
|
39
42
|
<slot>
|
|
40
|
-
<
|
|
43
|
+
<template v-if="variant === 'spinner'">
|
|
44
|
+
<UIcon :name="config.defaults.spinnerIcon" :color="color" v-bind="spinnerIconAttrs" />
|
|
45
|
+
</template>
|
|
46
|
+
<template v-else>
|
|
47
|
+
<div v-for="ellipse in ELLIPSES_AMOUNT" :key="ellipse" v-bind="ellipseAttrs" />
|
|
48
|
+
</template>
|
|
41
49
|
</slot>
|
|
42
50
|
</div>
|
|
43
51
|
</Transition>
|
package/ui.loader/config.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
loader: {
|
|
3
|
-
base: "relative flex items-center",
|
|
3
|
+
base: "relative flex items-center justify-center",
|
|
4
4
|
variants: {
|
|
5
5
|
size: {
|
|
6
6
|
sm: "h-1.5 w-9",
|
|
@@ -49,9 +49,22 @@ export default /*tw*/ {
|
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
51
|
},
|
|
52
|
+
spinnerIcon: {
|
|
53
|
+
base: "{UIcon} animate-spin",
|
|
54
|
+
defaults: {
|
|
55
|
+
size: {
|
|
56
|
+
sm: "sm",
|
|
57
|
+
md: "md",
|
|
58
|
+
lg: "lg",
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
52
62
|
defaults: {
|
|
53
63
|
color: "primary",
|
|
64
|
+
variant: "dots",
|
|
54
65
|
size: "md",
|
|
55
66
|
loading: false,
|
|
67
|
+
/* icons */
|
|
68
|
+
spinnerIcon: "progress_activity",
|
|
56
69
|
},
|
|
57
70
|
};
|
|
@@ -16,7 +16,7 @@ import type { Props } from "../types";
|
|
|
16
16
|
|
|
17
17
|
interface ULoaderArgs extends Props {
|
|
18
18
|
slotTemplate?: string;
|
|
19
|
-
enum: "size" | "color";
|
|
19
|
+
enum: "size" | "color" | "variant";
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export default {
|
|
@@ -82,6 +82,9 @@ const LoadingTemplate: StoryFn<ULoaderArgs> = (args: ULoaderArgs) => ({
|
|
|
82
82
|
export const Default = DefaultTemplate.bind({});
|
|
83
83
|
Default.args = {};
|
|
84
84
|
|
|
85
|
+
export const Variants = EnumTemplate.bind({});
|
|
86
|
+
Variants.args = { enum: "variant" };
|
|
87
|
+
|
|
85
88
|
export const Sizes = EnumTemplate.bind({});
|
|
86
89
|
Sizes.args = { enum: "size" };
|
|
87
90
|
|
|
@@ -2,14 +2,13 @@ import { mount } from "@vue/test-utils";
|
|
|
2
2
|
import { describe, it, expect } from "vitest";
|
|
3
3
|
|
|
4
4
|
import ULoader from "../ULoader.vue";
|
|
5
|
+
import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
5
6
|
|
|
6
7
|
import type { Props } from "../types";
|
|
7
8
|
|
|
8
9
|
describe("ULoader.vue", () => {
|
|
9
|
-
// Props tests
|
|
10
10
|
describe("Props", () => {
|
|
11
|
-
|
|
12
|
-
it("shows loader when loading prop is true", () => {
|
|
11
|
+
it("Loading – shows loader when loading prop is true", () => {
|
|
13
12
|
const loading = true;
|
|
14
13
|
|
|
15
14
|
const component = mount(ULoader, {
|
|
@@ -21,8 +20,7 @@ describe("ULoader.vue", () => {
|
|
|
21
20
|
expect(component.find("[vl-key='loader']").exists()).toBe(true);
|
|
22
21
|
});
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
it("hides loader when loading prop is false", () => {
|
|
23
|
+
it("Loading – hides loader when loading prop is false", () => {
|
|
26
24
|
const loading = false;
|
|
27
25
|
|
|
28
26
|
const component = mount(ULoader, {
|
|
@@ -34,8 +32,7 @@ describe("ULoader.vue", () => {
|
|
|
34
32
|
expect(component.find("[vl-key='loader']").exists()).toBe(false);
|
|
35
33
|
});
|
|
36
34
|
|
|
37
|
-
|
|
38
|
-
it("applies the correct color to the loader", () => {
|
|
35
|
+
it("Color – applies the correct color to the loader", () => {
|
|
39
36
|
const colors = [
|
|
40
37
|
"primary",
|
|
41
38
|
"secondary",
|
|
@@ -68,8 +65,7 @@ describe("ULoader.vue", () => {
|
|
|
68
65
|
});
|
|
69
66
|
});
|
|
70
67
|
|
|
71
|
-
|
|
72
|
-
it("applies the correct size to the loader", () => {
|
|
68
|
+
it("Size – applies the correct size to the loader", () => {
|
|
73
69
|
const sizeVariants = {
|
|
74
70
|
sm: "vueless-loader-ellipse-sm",
|
|
75
71
|
md: "vueless-loader-ellipse-md",
|
|
@@ -93,8 +89,73 @@ describe("ULoader.vue", () => {
|
|
|
93
89
|
});
|
|
94
90
|
});
|
|
95
91
|
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
it("Variant – renders dots variant by default", () => {
|
|
93
|
+
const component = mount(ULoader, {
|
|
94
|
+
props: {
|
|
95
|
+
loading: true,
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
expect(component.findAll("[vl-key='ellipse']").length).toBe(4);
|
|
100
|
+
expect(component.findComponent(UIcon).exists()).toBe(false);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it("Variant – renders spinner variant when variant prop is 'spinner'", () => {
|
|
104
|
+
const component = mount(ULoader, {
|
|
105
|
+
props: {
|
|
106
|
+
loading: true,
|
|
107
|
+
variant: "spinner",
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
expect(component.findComponent(UIcon).exists()).toBe(true);
|
|
112
|
+
expect(component.findAll("[vl-key='ellipse']").length).toBe(0);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it("Variant – applies color to spinner variant", () => {
|
|
116
|
+
const component = mount(ULoader, {
|
|
117
|
+
props: {
|
|
118
|
+
loading: true,
|
|
119
|
+
variant: "spinner",
|
|
120
|
+
color: "error",
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
expect(component.findComponent(UIcon).props("color")).toBe("error");
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it("Variant – applies correct size to spinner variant", () => {
|
|
128
|
+
const sizeVariants = {
|
|
129
|
+
sm: "sm",
|
|
130
|
+
md: "md",
|
|
131
|
+
lg: "lg",
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
Object.entries(sizeVariants).forEach(([size, iconSize]) => {
|
|
135
|
+
const component = mount(ULoader, {
|
|
136
|
+
props: {
|
|
137
|
+
loading: true,
|
|
138
|
+
variant: "spinner",
|
|
139
|
+
size: size as Props["size"],
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
expect(component.findComponent(UIcon).props("size")).toBe(iconSize);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it("Variant – renders spinner variant with correct icon name", () => {
|
|
148
|
+
const component = mount(ULoader, {
|
|
149
|
+
props: {
|
|
150
|
+
loading: true,
|
|
151
|
+
variant: "spinner",
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
expect(component.findComponent(UIcon).exists()).toBe(true);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it("Data Test – applies the correct data-test attribute", () => {
|
|
98
159
|
const dataTest = "test-loader";
|
|
99
160
|
|
|
100
161
|
const component = mount(ULoader, {
|
|
@@ -108,10 +169,8 @@ describe("ULoader.vue", () => {
|
|
|
108
169
|
});
|
|
109
170
|
});
|
|
110
171
|
|
|
111
|
-
// Slots tests
|
|
112
172
|
describe("Slots", () => {
|
|
113
|
-
|
|
114
|
-
it("renders content from default slot", () => {
|
|
173
|
+
it("Default – renders content from default slot", () => {
|
|
115
174
|
const slotContent = "Custom Loader";
|
|
116
175
|
const slotClass = "custom-loader";
|
|
117
176
|
|
|
@@ -130,10 +189,8 @@ describe("ULoader.vue", () => {
|
|
|
130
189
|
});
|
|
131
190
|
});
|
|
132
191
|
|
|
133
|
-
// Exposed refs tests
|
|
134
192
|
describe("Exposed refs", () => {
|
|
135
|
-
|
|
136
|
-
it("exposes loaderRef", () => {
|
|
193
|
+
it("loaderRef – exposes loaderRef", () => {
|
|
137
194
|
const component = mount(ULoader, {
|
|
138
195
|
props: {
|
|
139
196
|
loading: true,
|
package/ui.loader/types.ts
CHANGED
|
@@ -16,10 +16,8 @@ describe("ULoaderOverlay.vue", () => {
|
|
|
16
16
|
},
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
// Props tests
|
|
20
19
|
describe("Props", () => {
|
|
21
|
-
|
|
22
|
-
it("shows overlay when loading prop is true", () => {
|
|
20
|
+
it("Loading – shows overlay when loading prop is true", () => {
|
|
23
21
|
const loading = true;
|
|
24
22
|
|
|
25
23
|
const component = mount(ULoaderOverlay, {
|
|
@@ -33,8 +31,7 @@ describe("ULoaderOverlay.vue", () => {
|
|
|
33
31
|
expect(component.findComponent(ULoader).exists()).toBe(true);
|
|
34
32
|
});
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
it("hides overlay when loading prop is false", () => {
|
|
34
|
+
it("Loading – hides overlay when loading prop is false", () => {
|
|
38
35
|
const loading = false;
|
|
39
36
|
|
|
40
37
|
const component = mount(ULoaderOverlay, {
|
|
@@ -47,8 +44,7 @@ describe("ULoaderOverlay.vue", () => {
|
|
|
47
44
|
expect(component.find("[vl-key='overlay']").exists()).toBe(false);
|
|
48
45
|
});
|
|
49
46
|
|
|
50
|
-
|
|
51
|
-
it("applies the correct color to the loader", () => {
|
|
47
|
+
it("Color – applies the correct color to the loader", () => {
|
|
52
48
|
const colors = [
|
|
53
49
|
"primary",
|
|
54
50
|
"secondary",
|
|
@@ -76,8 +72,7 @@ describe("ULoaderOverlay.vue", () => {
|
|
|
76
72
|
});
|
|
77
73
|
});
|
|
78
74
|
|
|
79
|
-
|
|
80
|
-
it("applies the correct data-test attribute", () => {
|
|
75
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
81
76
|
const dataTest = "test-loader-overlay";
|
|
82
77
|
|
|
83
78
|
const component = mount(ULoaderOverlay, {
|
|
@@ -92,10 +87,8 @@ describe("ULoaderOverlay.vue", () => {
|
|
|
92
87
|
});
|
|
93
88
|
});
|
|
94
89
|
|
|
95
|
-
// Slots tests
|
|
96
90
|
describe("Slots", () => {
|
|
97
|
-
|
|
98
|
-
it("renders content from default slot", () => {
|
|
91
|
+
it("Default – renders content from default slot", () => {
|
|
99
92
|
const slotContent = "Custom Loader";
|
|
100
93
|
const slotClass = "custom-loader";
|
|
101
94
|
|
|
@@ -151,10 +144,8 @@ describe("ULoaderOverlay.vue", () => {
|
|
|
151
144
|
});
|
|
152
145
|
});
|
|
153
146
|
|
|
154
|
-
// Exposed refs tests
|
|
155
147
|
describe("Exposed refs", () => {
|
|
156
|
-
|
|
157
|
-
it("exposes overlayRef", () => {
|
|
148
|
+
it("overlayRef – exposes overlayRef", () => {
|
|
158
149
|
const component = mount(ULoaderOverlay, {
|
|
159
150
|
props: {
|
|
160
151
|
loading,
|
|
@@ -28,10 +28,8 @@ describe("ULoaderProgress.vue", () => {
|
|
|
28
28
|
vi.useRealTimers();
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
// Props tests
|
|
32
31
|
describe("Props", () => {
|
|
33
|
-
|
|
34
|
-
it("accepts loading prop and starts the loader", () => {
|
|
32
|
+
it("Loading – accepts loading prop and starts the loader", () => {
|
|
35
33
|
const loadings = [true, false];
|
|
36
34
|
|
|
37
35
|
loadings.forEach(async (loading) => {
|
|
@@ -47,8 +45,7 @@ describe("ULoaderProgress.vue", () => {
|
|
|
47
45
|
});
|
|
48
46
|
});
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
it("applies the correct color class", () => {
|
|
48
|
+
it("Color – applies the correct color class", () => {
|
|
52
49
|
const colors = [
|
|
53
50
|
"primary",
|
|
54
51
|
"secondary",
|
|
@@ -75,8 +72,7 @@ describe("ULoaderProgress.vue", () => {
|
|
|
75
72
|
});
|
|
76
73
|
});
|
|
77
74
|
|
|
78
|
-
|
|
79
|
-
it("applies the correct size class", () => {
|
|
75
|
+
it("Size – applies the correct size class", () => {
|
|
80
76
|
const sizes = {
|
|
81
77
|
xs: "h-px",
|
|
82
78
|
sm: "h-0.5",
|
|
@@ -98,8 +94,7 @@ describe("ULoaderProgress.vue", () => {
|
|
|
98
94
|
});
|
|
99
95
|
});
|
|
100
96
|
|
|
101
|
-
|
|
102
|
-
it("accepts dataTest prop", () => {
|
|
97
|
+
it("DataTest – accepts dataTest prop", () => {
|
|
103
98
|
const dataTest = "test-loader-progress";
|
|
104
99
|
|
|
105
100
|
const component = mount(ULoaderProgress, {
|
|
@@ -113,10 +108,8 @@ describe("ULoaderProgress.vue", () => {
|
|
|
113
108
|
});
|
|
114
109
|
});
|
|
115
110
|
|
|
116
|
-
// Exposed methods and refs tests
|
|
117
111
|
describe("Exposed methods and refs", () => {
|
|
118
|
-
|
|
119
|
-
it("exposes start method", () => {
|
|
112
|
+
it("start – exposes start method", () => {
|
|
120
113
|
const expectedType = "function";
|
|
121
114
|
|
|
122
115
|
const component = mount(ULoaderProgress, {
|
|
@@ -128,8 +121,7 @@ describe("ULoaderProgress.vue", () => {
|
|
|
128
121
|
expect(() => component.vm.start()).not.toThrow();
|
|
129
122
|
});
|
|
130
123
|
|
|
131
|
-
|
|
132
|
-
it("exposes stop method", () => {
|
|
124
|
+
it("stop – exposes stop method", () => {
|
|
133
125
|
const expectedType = "function";
|
|
134
126
|
|
|
135
127
|
const component = mount(ULoaderProgress, {
|
|
@@ -141,8 +133,7 @@ describe("ULoaderProgress.vue", () => {
|
|
|
141
133
|
expect(() => component.vm.stop()).not.toThrow();
|
|
142
134
|
});
|
|
143
135
|
|
|
144
|
-
|
|
145
|
-
it("exposes isLoading computed property", () => {
|
|
136
|
+
it("isLoading – exposes isLoading computed property", () => {
|
|
146
137
|
const component = mount(ULoaderProgress, {
|
|
147
138
|
global,
|
|
148
139
|
});
|
|
@@ -150,8 +141,7 @@ describe("ULoaderProgress.vue", () => {
|
|
|
150
141
|
expect(component.vm.isLoading).toBeDefined();
|
|
151
142
|
});
|
|
152
143
|
|
|
153
|
-
|
|
154
|
-
it("exposes progressRef", () => {
|
|
144
|
+
it("progressRef – progressRef – exposes progressRef", () => {
|
|
155
145
|
const component = mount(ULoaderProgress, {
|
|
156
146
|
props: {
|
|
157
147
|
loading,
|
|
@@ -31,10 +31,8 @@ const mountWithRouter = (component: unknown, options: UnknownObject) => {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
describe("UBreadcrumbs.vue", () => {
|
|
34
|
-
// Props tests
|
|
35
34
|
describe("Props", () => {
|
|
36
|
-
|
|
37
|
-
it("renders the correct number of links", () => {
|
|
35
|
+
it("Links – renders the correct number of links", () => {
|
|
38
36
|
const links: UBreadcrumb[] = [
|
|
39
37
|
{ label: "Home", to: "/" },
|
|
40
38
|
{ label: "Products", to: "/products" },
|
|
@@ -57,8 +55,7 @@ describe("UBreadcrumbs.vue", () => {
|
|
|
57
55
|
});
|
|
58
56
|
});
|
|
59
57
|
|
|
60
|
-
|
|
61
|
-
it("renders nothing when links array is empty", () => {
|
|
58
|
+
it("Empty – renders nothing when links array is empty", () => {
|
|
62
59
|
const component = mountWithRouter(UBreadcrumbs, {
|
|
63
60
|
props: {
|
|
64
61
|
links: [],
|
|
@@ -70,8 +67,7 @@ describe("UBreadcrumbs.vue", () => {
|
|
|
70
67
|
expect(linkComponents.length).toBe(0);
|
|
71
68
|
});
|
|
72
69
|
|
|
73
|
-
|
|
74
|
-
it("disables link when disabled key is true", () => {
|
|
70
|
+
it("Disabled – disables link when disabled key is true", () => {
|
|
75
71
|
const links: UBreadcrumb[] = [
|
|
76
72
|
{ label: "Home", to: "/", disabled: true },
|
|
77
73
|
{ label: "Products", to: "/products" },
|
|
@@ -89,8 +85,7 @@ describe("UBreadcrumbs.vue", () => {
|
|
|
89
85
|
expect(linkComponents[1].props("disabled")).toBe(false);
|
|
90
86
|
});
|
|
91
87
|
|
|
92
|
-
|
|
93
|
-
it("disables link when it has no to or href", () => {
|
|
88
|
+
it("Link – disables link when it has no to or href", () => {
|
|
94
89
|
const links: UBreadcrumb[] = [{ label: "Home" }, { label: "Products", to: "/products" }];
|
|
95
90
|
|
|
96
91
|
const component = mountWithRouter(UBreadcrumbs, {
|
|
@@ -105,8 +100,7 @@ describe("UBreadcrumbs.vue", () => {
|
|
|
105
100
|
expect(linkComponents[1].props("disabled")).toBe(false);
|
|
106
101
|
});
|
|
107
102
|
|
|
108
|
-
|
|
109
|
-
it("applies the correct size to links", () => {
|
|
103
|
+
it("Size – applies the correct size to links", () => {
|
|
110
104
|
const sizes = ["sm", "md", "lg"];
|
|
111
105
|
const links: UBreadcrumb[] = [
|
|
112
106
|
{ label: "Home", to: "/" },
|
|
@@ -130,8 +124,7 @@ describe("UBreadcrumbs.vue", () => {
|
|
|
130
124
|
});
|
|
131
125
|
});
|
|
132
126
|
|
|
133
|
-
|
|
134
|
-
it("applies the correct color to links", () => {
|
|
127
|
+
it("Color – applies the correct color to links", () => {
|
|
135
128
|
const colors = [
|
|
136
129
|
"primary",
|
|
137
130
|
"secondary",
|
|
@@ -166,8 +159,7 @@ describe("UBreadcrumbs.vue", () => {
|
|
|
166
159
|
});
|
|
167
160
|
});
|
|
168
161
|
|
|
169
|
-
|
|
170
|
-
it("applies the correct target to links", () => {
|
|
162
|
+
it("Target – applies the correct target to links", () => {
|
|
171
163
|
const target = "_blank";
|
|
172
164
|
const links: UBreadcrumb[] = [
|
|
173
165
|
{ label: "Home", to: "/" },
|
|
@@ -189,8 +181,7 @@ describe("UBreadcrumbs.vue", () => {
|
|
|
189
181
|
});
|
|
190
182
|
});
|
|
191
183
|
|
|
192
|
-
|
|
193
|
-
it("applies underlined style to links when underlined prop is true", () => {
|
|
184
|
+
it("Underlined – applies underlined style to links when underlined prop is true", () => {
|
|
194
185
|
const underlined = true;
|
|
195
186
|
const links: UBreadcrumb[] = [
|
|
196
187
|
{ label: "Home", to: "/" },
|
|
@@ -212,8 +203,7 @@ describe("UBreadcrumbs.vue", () => {
|
|
|
212
203
|
});
|
|
213
204
|
});
|
|
214
205
|
|
|
215
|
-
|
|
216
|
-
it("applies dashed style to links when dashed prop is true", () => {
|
|
206
|
+
it("Dashed – applies dashed style to links when dashed prop is true", () => {
|
|
217
207
|
const dashed = true;
|
|
218
208
|
const links: UBreadcrumb[] = [
|
|
219
209
|
{ label: "Home", to: "/" },
|
|
@@ -235,8 +225,7 @@ describe("UBreadcrumbs.vue", () => {
|
|
|
235
225
|
});
|
|
236
226
|
});
|
|
237
227
|
|
|
238
|
-
|
|
239
|
-
it("applies the correct data-test attribute", () => {
|
|
228
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
240
229
|
const dataTest = "test-breadcrumbs";
|
|
241
230
|
const links: UBreadcrumb[] = [
|
|
242
231
|
{ label: "Home", to: "/" },
|
|
@@ -258,8 +247,7 @@ describe("UBreadcrumbs.vue", () => {
|
|
|
258
247
|
});
|
|
259
248
|
});
|
|
260
249
|
|
|
261
|
-
|
|
262
|
-
it("renders icon when link has icon prop", () => {
|
|
250
|
+
it("Link – renders icon when link has icon prop", () => {
|
|
263
251
|
const links: UBreadcrumb[] = [
|
|
264
252
|
{ label: "Home", to: "/", icon: "home" },
|
|
265
253
|
{ label: "Products", to: "/products" },
|
|
@@ -278,8 +266,7 @@ describe("UBreadcrumbs.vue", () => {
|
|
|
278
266
|
expect(iconComponents[0].props("name")).toBe("home");
|
|
279
267
|
});
|
|
280
268
|
|
|
281
|
-
|
|
282
|
-
it("renders divider icons between links", () => {
|
|
269
|
+
it("Divider – renders divider icons between links", () => {
|
|
283
270
|
const links: UBreadcrumb[] = [
|
|
284
271
|
{ label: "Home", to: "/" },
|
|
285
272
|
{ label: "Products", to: "/products" },
|
|
@@ -301,10 +288,8 @@ describe("UBreadcrumbs.vue", () => {
|
|
|
301
288
|
});
|
|
302
289
|
});
|
|
303
290
|
|
|
304
|
-
// Slots tests
|
|
305
291
|
describe("Slots", () => {
|
|
306
|
-
|
|
307
|
-
it("renders content from before-link slot", () => {
|
|
292
|
+
it("Before – renders content from before-link slot", () => {
|
|
308
293
|
const links: UBreadcrumb[] = [
|
|
309
294
|
{ label: "Home", to: "/", icon: "home" },
|
|
310
295
|
{ label: "Products", to: "/products" },
|
|
@@ -325,8 +310,7 @@ describe("UBreadcrumbs.vue", () => {
|
|
|
325
310
|
expect(component.find(`.${slotClass}`).text()).toBe(slotContent);
|
|
326
311
|
});
|
|
327
312
|
|
|
328
|
-
|
|
329
|
-
it("renders content from after-link slot", () => {
|
|
313
|
+
it("After – renders content from after-link slot", () => {
|
|
330
314
|
const links: UBreadcrumb[] = [
|
|
331
315
|
{ label: "Home", to: "/", icon: "home" },
|
|
332
316
|
{ label: "Products", to: "/products" },
|
|
@@ -347,8 +331,7 @@ describe("UBreadcrumbs.vue", () => {
|
|
|
347
331
|
expect(component.find(`.${slotClass}`).text()).toBe(slotContent);
|
|
348
332
|
});
|
|
349
333
|
|
|
350
|
-
|
|
351
|
-
it("renders content from label slot", () => {
|
|
334
|
+
it("Label – renders content from label slot", () => {
|
|
352
335
|
const links: UBreadcrumb[] = [
|
|
353
336
|
{ label: "Home", to: "/" },
|
|
354
337
|
{ label: "Products", to: "/products" },
|
|
@@ -369,8 +352,7 @@ describe("UBreadcrumbs.vue", () => {
|
|
|
369
352
|
expect(component.find(`.${slotClass}`).text()).toBe(slotContent);
|
|
370
353
|
});
|
|
371
354
|
|
|
372
|
-
|
|
373
|
-
it("renders content from divider slot", () => {
|
|
355
|
+
it("Divider – renders content from divider slot", () => {
|
|
374
356
|
const links: UBreadcrumb[] = [
|
|
375
357
|
{ label: "Home", to: "/" },
|
|
376
358
|
{ label: "Products", to: "/products" },
|
|
@@ -392,10 +374,8 @@ describe("UBreadcrumbs.vue", () => {
|
|
|
392
374
|
});
|
|
393
375
|
});
|
|
394
376
|
|
|
395
|
-
// Events tests
|
|
396
377
|
describe("Events", () => {
|
|
397
|
-
|
|
398
|
-
it("emits clickLink event when link is clicked", async () => {
|
|
378
|
+
it("clickLink – emits clickLink event when link is clicked", async () => {
|
|
399
379
|
const links: UBreadcrumb[] = [
|
|
400
380
|
{ label: "Home", to: "/" },
|
|
401
381
|
{ label: "Products", to: "/products" },
|
|
@@ -418,10 +398,8 @@ describe("UBreadcrumbs.vue", () => {
|
|
|
418
398
|
});
|
|
419
399
|
});
|
|
420
400
|
|
|
421
|
-
// Exposed refs tests
|
|
422
401
|
describe("Exposed refs", () => {
|
|
423
|
-
|
|
424
|
-
it("exposes breadcrumbsRef", () => {
|
|
402
|
+
it("breadcrumbsRef – exposes breadcrumbsRef", () => {
|
|
425
403
|
const links: UBreadcrumb[] = [
|
|
426
404
|
{ label: "Home", to: "/" },
|
|
427
405
|
{ label: "Products", to: "/products" },
|