sm-click-library-ui 0.0.305 → 0.0.308
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/README.md +3 -3
- package/dist/sm-click-library-ui.es.js +378 -383
- package/dist/sm-click-library-ui.umd.js +2 -2
- package/dist/style.css +1 -1
- package/dist/tailwind.css +219 -270
- package/package.json +2 -1
- package/src/test-utils/components/selects/attendanceSelect.test.js +106 -106
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sm-click-library-ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.308",
|
|
5
5
|
"main": "dist/sm-click-library-ui.es.js",
|
|
6
6
|
"module": "dist/sm-click-library-ui.umd.js",
|
|
7
7
|
"private": false,
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"tailwind-scrollbar": "^3.1.0",
|
|
29
29
|
"uuid": "^10.0.0",
|
|
30
30
|
"v3-infinite-loading": "^1.3.2",
|
|
31
|
+
"vite-plugin-static-copy": "^2.2.0",
|
|
31
32
|
"vue": "^3.4.29",
|
|
32
33
|
"vue-debounce": "^5.0.1",
|
|
33
34
|
"vue3-popper": "^1.5.0"
|
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach } from "vitest";
|
|
2
|
-
import { mount } from "@vue/test-utils";
|
|
3
|
-
import AttendantSelect from "~/components/selects/attendantSelect/attendantSelect.vue";
|
|
4
|
-
import { createTestingPinia } from "@pinia/testing";
|
|
5
|
-
|
|
6
|
-
const attendantsMock = [
|
|
7
|
-
{
|
|
8
|
-
id: 1,
|
|
9
|
-
name: "John Doe",
|
|
10
|
-
status: true,
|
|
11
|
-
department: [{ id: "dept1" }],
|
|
12
|
-
photo: "",
|
|
13
|
-
selected: false,
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
id: 2,
|
|
17
|
-
name: "Jane Smith",
|
|
18
|
-
status: true,
|
|
19
|
-
department: [{ id: "dept1" }],
|
|
20
|
-
photo: "",
|
|
21
|
-
selected: false,
|
|
22
|
-
},
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
describe("AttendantSelect Component", () => {
|
|
26
|
-
let wrapper;
|
|
27
|
-
beforeEach(() => {
|
|
28
|
-
wrapper = mount(AttendantSelect, {
|
|
29
|
-
props: {
|
|
30
|
-
attendance: [],
|
|
31
|
-
multiSelect: true,
|
|
32
|
-
department: [{ id: "dept1" }],
|
|
33
|
-
modal_filter: null,
|
|
34
|
-
attDel: { id: null },
|
|
35
|
-
method: null,
|
|
36
|
-
},
|
|
37
|
-
global: {
|
|
38
|
-
plugins: [
|
|
39
|
-
createTestingPinia({
|
|
40
|
-
initialState: {
|
|
41
|
-
attendant: {
|
|
42
|
-
attendants: attendantsMock,
|
|
43
|
-
loaded: true,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
stubActions: false,
|
|
47
|
-
}),
|
|
48
|
-
],
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it("renders the correct number of attendants", () => {
|
|
54
|
-
const attendantItems = wrapper.findAll(".department-item");
|
|
55
|
-
expect(attendantItems.length).toBe(2);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it("selects an attendant on click", async () => {
|
|
59
|
-
// Instead of triggering click on the .department-item,
|
|
60
|
-
// we find the .department-name element inside it:
|
|
61
|
-
const firstItemName = wrapper
|
|
62
|
-
.findAll(".department-item")
|
|
63
|
-
.at(0)
|
|
64
|
-
.find(".department-name");
|
|
65
|
-
|
|
66
|
-
await firstItemName.trigger("click");
|
|
67
|
-
|
|
68
|
-
const emits = wrapper.emitted("attend");
|
|
69
|
-
expect(emits).toBeDefined();
|
|
70
|
-
|
|
71
|
-
const selected = emits[emits.length - 1][0];
|
|
72
|
-
expect(selected).toHaveLength(1); // ...
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it("removes an attendant when the erase button is clicked", async () => {
|
|
76
|
-
// Find the correct child that has the @click.
|
|
77
|
-
const firstItemName = wrapper
|
|
78
|
-
.findAll(".department-item")
|
|
79
|
-
.at(0)
|
|
80
|
-
.find(".department-name");
|
|
81
|
-
await firstItemName.trigger("click");
|
|
82
|
-
|
|
83
|
-
// Wait for selection to render
|
|
84
|
-
await wrapper.vm.$nextTick();
|
|
85
|
-
|
|
86
|
-
// Now .close-btn should appear
|
|
87
|
-
const eraseButton = wrapper.find(".close-btn");
|
|
88
|
-
await eraseButton.trigger("click");
|
|
89
|
-
|
|
90
|
-
// Check latest emitted array
|
|
91
|
-
const emits = wrapper.emitted("attend");
|
|
92
|
-
const currentSelection = emits[emits.length - 1][0];
|
|
93
|
-
expect(currentSelection).toHaveLength(0);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it("filters attendants based on the search input", async () => {
|
|
97
|
-
const input = wrapper.find("input");
|
|
98
|
-
await input.setValue("Jane");
|
|
99
|
-
await wrapper.vm.$nextTick();
|
|
100
|
-
|
|
101
|
-
// After filtering, only Jane Smith should be displayed.
|
|
102
|
-
const filteredItems = wrapper.findAll(".department-item");
|
|
103
|
-
expect(filteredItems.length).toBe(1);
|
|
104
|
-
expect(filteredItems[0].text()).toContain("Jane Smith");
|
|
105
|
-
});
|
|
106
|
-
});
|
|
1
|
+
import { describe, it, expect, beforeEach } from "vitest";
|
|
2
|
+
import { mount } from "@vue/test-utils";
|
|
3
|
+
import AttendantSelect from "~/components/selects/attendantSelect/attendantSelect.vue";
|
|
4
|
+
import { createTestingPinia } from "@pinia/testing";
|
|
5
|
+
|
|
6
|
+
const attendantsMock = [
|
|
7
|
+
{
|
|
8
|
+
id: 1,
|
|
9
|
+
name: "John Doe",
|
|
10
|
+
status: true,
|
|
11
|
+
department: [{ id: "dept1" }],
|
|
12
|
+
photo: "",
|
|
13
|
+
selected: false,
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: 2,
|
|
17
|
+
name: "Jane Smith",
|
|
18
|
+
status: true,
|
|
19
|
+
department: [{ id: "dept1" }],
|
|
20
|
+
photo: "",
|
|
21
|
+
selected: false,
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
describe("AttendantSelect Component", () => {
|
|
26
|
+
let wrapper;
|
|
27
|
+
beforeEach(() => {
|
|
28
|
+
wrapper = mount(AttendantSelect, {
|
|
29
|
+
props: {
|
|
30
|
+
attendance: [],
|
|
31
|
+
multiSelect: true,
|
|
32
|
+
department: [{ id: "dept1" }],
|
|
33
|
+
modal_filter: null,
|
|
34
|
+
attDel: { id: null },
|
|
35
|
+
method: null,
|
|
36
|
+
},
|
|
37
|
+
global: {
|
|
38
|
+
plugins: [
|
|
39
|
+
createTestingPinia({
|
|
40
|
+
initialState: {
|
|
41
|
+
attendant: {
|
|
42
|
+
attendants: attendantsMock,
|
|
43
|
+
loaded: true,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
stubActions: false,
|
|
47
|
+
}),
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("renders the correct number of attendants", () => {
|
|
54
|
+
const attendantItems = wrapper.findAll(".department-item");
|
|
55
|
+
expect(attendantItems.length).toBe(2);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("selects an attendant on click", async () => {
|
|
59
|
+
// Instead of triggering click on the .department-item,
|
|
60
|
+
// we find the .department-name element inside it:
|
|
61
|
+
const firstItemName = wrapper
|
|
62
|
+
.findAll(".department-item")
|
|
63
|
+
.at(0)
|
|
64
|
+
.find(".department-name");
|
|
65
|
+
|
|
66
|
+
await firstItemName.trigger("click");
|
|
67
|
+
|
|
68
|
+
const emits = wrapper.emitted("attend");
|
|
69
|
+
expect(emits).toBeDefined();
|
|
70
|
+
|
|
71
|
+
const selected = emits[emits.length - 1][0];
|
|
72
|
+
expect(selected).toHaveLength(1); // ...
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("removes an attendant when the erase button is clicked", async () => {
|
|
76
|
+
// Find the correct child that has the @click.
|
|
77
|
+
const firstItemName = wrapper
|
|
78
|
+
.findAll(".department-item")
|
|
79
|
+
.at(0)
|
|
80
|
+
.find(".department-name");
|
|
81
|
+
await firstItemName.trigger("click");
|
|
82
|
+
|
|
83
|
+
// Wait for selection to render
|
|
84
|
+
await wrapper.vm.$nextTick();
|
|
85
|
+
|
|
86
|
+
// Now .close-btn should appear
|
|
87
|
+
const eraseButton = wrapper.find(".close-btn");
|
|
88
|
+
await eraseButton.trigger("click");
|
|
89
|
+
|
|
90
|
+
// Check latest emitted array
|
|
91
|
+
const emits = wrapper.emitted("attend");
|
|
92
|
+
const currentSelection = emits[emits.length - 1][0];
|
|
93
|
+
expect(currentSelection).toHaveLength(0);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("filters attendants based on the search input", async () => {
|
|
97
|
+
const input = wrapper.find("input");
|
|
98
|
+
await input.setValue("Jane");
|
|
99
|
+
await wrapper.vm.$nextTick();
|
|
100
|
+
|
|
101
|
+
// After filtering, only Jane Smith should be displayed.
|
|
102
|
+
const filteredItems = wrapper.findAll(".department-item");
|
|
103
|
+
expect(filteredItems.length).toBe(1);
|
|
104
|
+
expect(filteredItems[0].text()).toContain("Jane Smith");
|
|
105
|
+
});
|
|
106
|
+
});
|