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
|
@@ -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" },
|
|
@@ -8,10 +8,8 @@ import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
|
8
8
|
import type { Props } from "../types";
|
|
9
9
|
|
|
10
10
|
describe("UPagination.vue", () => {
|
|
11
|
-
// Props tests
|
|
12
11
|
describe("Props", () => {
|
|
13
|
-
|
|
14
|
-
it("applies the correct variant to buttons", async () => {
|
|
12
|
+
it("Variant – applies the correct variant to buttons", async () => {
|
|
15
13
|
const variants = ["solid", "outlined", "subtle", "soft", "ghost"];
|
|
16
14
|
|
|
17
15
|
variants.forEach((variant) => {
|
|
@@ -32,8 +30,7 @@ describe("UPagination.vue", () => {
|
|
|
32
30
|
});
|
|
33
31
|
});
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
it("applies the correct size to buttons", async () => {
|
|
33
|
+
it("Size – applies the correct size to buttons", async () => {
|
|
37
34
|
const sizes = {
|
|
38
35
|
sm: "text-small",
|
|
39
36
|
md: "text-medium",
|
|
@@ -59,8 +56,7 @@ describe("UPagination.vue", () => {
|
|
|
59
56
|
});
|
|
60
57
|
});
|
|
61
58
|
|
|
62
|
-
|
|
63
|
-
it("correctly highlights the current page", () => {
|
|
59
|
+
it("ModelValue – correctly highlights the current page", () => {
|
|
64
60
|
const currentPage = 3;
|
|
65
61
|
|
|
66
62
|
const component = mount(UPagination, {
|
|
@@ -78,8 +74,7 @@ describe("UPagination.vue", () => {
|
|
|
78
74
|
expect(activeButton?.props("variant")).toBe("solid");
|
|
79
75
|
});
|
|
80
76
|
|
|
81
|
-
|
|
82
|
-
it("calculates the correct number of pages", () => {
|
|
77
|
+
it("Total – calculates the correct number of pages", () => {
|
|
83
78
|
const total = 100;
|
|
84
79
|
const perPage = 10;
|
|
85
80
|
|
|
@@ -104,8 +99,7 @@ describe("UPagination.vue", () => {
|
|
|
104
99
|
expect(pageButtons.length).toBeLessThanOrEqual(expectedAmountOfButtons);
|
|
105
100
|
});
|
|
106
101
|
|
|
107
|
-
|
|
108
|
-
it("respects the limit of visible pages", () => {
|
|
102
|
+
it("Limit – respects the limit of visible pages", () => {
|
|
109
103
|
const limit = 3;
|
|
110
104
|
|
|
111
105
|
const component = mount(UPagination, {
|
|
@@ -127,8 +121,7 @@ describe("UPagination.vue", () => {
|
|
|
127
121
|
expect(pageButtons.length).toBeLessThanOrEqual(limit);
|
|
128
122
|
});
|
|
129
123
|
|
|
130
|
-
|
|
131
|
-
it("displays custom navigation labels", () => {
|
|
124
|
+
it("FirstLabel, PrevLabel, NextLabel, LastLabel – displays custom navigation labels", () => {
|
|
132
125
|
const firstLabel = "First";
|
|
133
126
|
const prevLabel = "Prev";
|
|
134
127
|
const nextLabel = "Next";
|
|
@@ -154,8 +147,7 @@ describe("UPagination.vue", () => {
|
|
|
154
147
|
expect(buttons[buttons.length - 1].text()).toBe(lastLabel);
|
|
155
148
|
});
|
|
156
149
|
|
|
157
|
-
|
|
158
|
-
it("disables all buttons when disabled prop is true", () => {
|
|
150
|
+
it("Disabled – disables all buttons when disabled prop is true", () => {
|
|
159
151
|
const disabled = true;
|
|
160
152
|
|
|
161
153
|
const component = mount(UPagination, {
|
|
@@ -181,8 +173,7 @@ describe("UPagination.vue", () => {
|
|
|
181
173
|
});
|
|
182
174
|
});
|
|
183
175
|
|
|
184
|
-
|
|
185
|
-
it("shows ellipsis when ellipsis prop is true", () => {
|
|
176
|
+
it("Ellipsis – shows ellipsis when ellipsis prop is true", () => {
|
|
186
177
|
const ellipsis = true;
|
|
187
178
|
const expectedEllipsis = "…";
|
|
188
179
|
|
|
@@ -199,8 +190,7 @@ describe("UPagination.vue", () => {
|
|
|
199
190
|
expect(component.html()).toContain(expectedEllipsis);
|
|
200
191
|
});
|
|
201
192
|
|
|
202
|
-
|
|
203
|
-
it("hides first/last buttons when showFirst/showLast props are false", () => {
|
|
193
|
+
it("ShowFirst – hides first/last buttons when showFirst/showLast props are false", () => {
|
|
204
194
|
const component = mount(UPagination, {
|
|
205
195
|
props: {
|
|
206
196
|
modelValue: 5,
|
|
@@ -220,8 +210,7 @@ describe("UPagination.vue", () => {
|
|
|
220
210
|
expect(lastButton.findComponent(UIcon).props("name")).toContain("chevron_right");
|
|
221
211
|
});
|
|
222
212
|
|
|
223
|
-
|
|
224
|
-
it("applies the correct data-test attribute", () => {
|
|
213
|
+
it("DataTest – applies the correct data-test attribute", () => {
|
|
225
214
|
const dataTest = "test-pagination";
|
|
226
215
|
|
|
227
216
|
const component = mount(UPagination, {
|
|
@@ -240,10 +229,8 @@ describe("UPagination.vue", () => {
|
|
|
240
229
|
});
|
|
241
230
|
});
|
|
242
231
|
|
|
243
|
-
// Slots tests
|
|
244
232
|
describe("Slots", () => {
|
|
245
|
-
|
|
246
|
-
it("renders content from first slot", () => {
|
|
233
|
+
it("First – renders content from first slot", () => {
|
|
247
234
|
const slotContent = "Custom First";
|
|
248
235
|
const slotClass = "first-content";
|
|
249
236
|
|
|
@@ -262,8 +249,7 @@ describe("UPagination.vue", () => {
|
|
|
262
249
|
expect(component.find(`.${slotClass}`).text()).toBe(slotContent);
|
|
263
250
|
});
|
|
264
251
|
|
|
265
|
-
|
|
266
|
-
it("renders content from prev slot", () => {
|
|
252
|
+
it("Prev – renders content from prev slot", () => {
|
|
267
253
|
const slotContent = "Custom Prev";
|
|
268
254
|
const slotClass = "prev-content";
|
|
269
255
|
|
|
@@ -282,8 +268,7 @@ describe("UPagination.vue", () => {
|
|
|
282
268
|
expect(component.find(`.${slotClass}`).text()).toBe(slotContent);
|
|
283
269
|
});
|
|
284
270
|
|
|
285
|
-
|
|
286
|
-
it("renders content from ellipsis slot", () => {
|
|
271
|
+
it("Ellipsis – renders content from ellipsis slot", () => {
|
|
287
272
|
const slotContent = "......";
|
|
288
273
|
const slotClass = "ellipsis-content";
|
|
289
274
|
|
|
@@ -303,8 +288,7 @@ describe("UPagination.vue", () => {
|
|
|
303
288
|
expect(component.find(`.${slotClass}`).text()).toBe(slotContent);
|
|
304
289
|
});
|
|
305
290
|
|
|
306
|
-
|
|
307
|
-
it("renders content from next slot", () => {
|
|
291
|
+
it("Next – renders content from next slot", () => {
|
|
308
292
|
const slotContent = "Custom Next";
|
|
309
293
|
const slotClass = "next-content";
|
|
310
294
|
|
|
@@ -323,8 +307,7 @@ describe("UPagination.vue", () => {
|
|
|
323
307
|
expect(component.find(`.${slotClass}`).text()).toBe(slotContent);
|
|
324
308
|
});
|
|
325
309
|
|
|
326
|
-
|
|
327
|
-
it("renders content from last slot", () => {
|
|
310
|
+
it("Last – renders content from last slot", () => {
|
|
328
311
|
const slotContent = "Custom Last";
|
|
329
312
|
const slotClass = "last-content";
|
|
330
313
|
|
|
@@ -344,10 +327,8 @@ describe("UPagination.vue", () => {
|
|
|
344
327
|
});
|
|
345
328
|
});
|
|
346
329
|
|
|
347
|
-
// Events tests
|
|
348
330
|
describe("Events", () => {
|
|
349
|
-
|
|
350
|
-
it("emits update:modelValue event when page is changed", async () => {
|
|
331
|
+
it("Update:modelValue – emits update:modelValue event when page is changed", async () => {
|
|
351
332
|
const component = mount(UPagination, {
|
|
352
333
|
props: {
|
|
353
334
|
modelValue: 1,
|
|
@@ -370,8 +351,7 @@ describe("UPagination.vue", () => {
|
|
|
370
351
|
expect(component.emitted("update:modelValue")?.[0]).toEqual([2]); // Second button value
|
|
371
352
|
});
|
|
372
353
|
|
|
373
|
-
|
|
374
|
-
it("navigates to correct pages when navigation buttons are clicked", async () => {
|
|
354
|
+
it("Navigation – navigates to correct pages when navigation buttons are clicked", async () => {
|
|
375
355
|
const component = mount(UPagination, {
|
|
376
356
|
props: {
|
|
377
357
|
modelValue: 5,
|
|
@@ -400,10 +380,8 @@ describe("UPagination.vue", () => {
|
|
|
400
380
|
});
|
|
401
381
|
});
|
|
402
382
|
|
|
403
|
-
// Exposed refs tests
|
|
404
383
|
describe("Exposed refs", () => {
|
|
405
|
-
|
|
406
|
-
it("exposes paginationRef", () => {
|
|
384
|
+
it("paginationRef – exposes paginationRef", () => {
|
|
407
385
|
const component = mount(UPagination, {
|
|
408
386
|
props: {
|
|
409
387
|
modelValue: 1,
|