sm-click-library-ui 0.0.442 → 0.0.443

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.
@@ -1,65 +1,65 @@
1
- import { JSDOM } from "jsdom";
2
- import { config } from "@vue/test-utils";
3
- import { setActivePinia, createPinia } from "pinia";
4
-
5
- // Cria um DOM simulado
6
- const dom = new JSDOM(`<!DOCTYPE html><html><body></body></html>`, {
7
- url: "http://localhost",
8
- });
9
-
10
- // Configura `window` e `document`
11
- global.window = dom.window;
12
- global.document = dom.window.document;
13
- global.navigator = dom.window.navigator;
14
-
15
- // Mock de métodos do DOM que podem ser necessários
16
- global.window.HTMLElement = dom.window.HTMLElement;
17
- global.window.requestAnimationFrame = (cb) => setTimeout(cb, 0);
18
- global.window.cancelAnimationFrame = (id) => clearTimeout(id);
19
-
20
- global.ResizeObserver = vi.fn().mockImplementation(() => ({
21
- observe: vi.fn(),
22
- unobserve: vi.fn(),
23
- disconnect: vi.fn(),
24
- }));
25
-
26
- global.window.matchMedia = vi.fn().mockImplementation(() => ({
27
- matches: false,
28
- addListener: vi.fn(),
29
- removeListener: vi.fn(),
30
- }));
31
-
32
- // Configuração global do Vue Test Utils
33
- config.global.stubs = {
34
- Popper: true, // Evita erro de componente não encontrado
35
- VueAwesomePaginate: true, // Stub para VueAwesomePaginate
36
- SimpleModal: true, // Stub para SimpleModal
37
- datepicker: true, // Stub para datepicker,
38
- Svg: { template: "<svg></svg>" },
39
- Popper: { template: "<div><slot /></div>" },
40
- putVideo: { template: "<div></div>" },
41
- VueAwesomePaginate: { template: "<div></div>" },
42
- };
43
-
44
- config.global.directives = {
45
- lazy: () => {},
46
- };
47
-
48
- // Ativando Pinia para os testes
49
- setActivePinia(createPinia()); // Certifica que Pinia está disponível nos testes
50
-
51
- // Mock de axios para evitar chamadas reais de API
52
- import { vi } from "vitest";
53
-
54
- vi.mock("@/router/axios", () => ({
55
- default: {
56
- get: vi.fn().mockResolvedValue({ data: [] }), // Return an empty array (or any default data)
57
- post: vi.fn(),
58
- delete: vi.fn(),
59
- patch: vi.fn(),
60
- },
61
- }));
62
- // Mock de notiwind para evitar notificações em testes
63
- vi.mock("notiwind", () => ({
64
- notify: vi.fn(),
65
- }));
1
+ import { JSDOM } from "jsdom";
2
+ import { config } from "@vue/test-utils";
3
+ import { setActivePinia, createPinia } from "pinia";
4
+
5
+ // Cria um DOM simulado
6
+ const dom = new JSDOM(`<!DOCTYPE html><html><body></body></html>`, {
7
+ url: "http://localhost",
8
+ });
9
+
10
+ // Configura `window` e `document`
11
+ global.window = dom.window;
12
+ global.document = dom.window.document;
13
+ global.navigator = dom.window.navigator;
14
+
15
+ // Mock de métodos do DOM que podem ser necessários
16
+ global.window.HTMLElement = dom.window.HTMLElement;
17
+ global.window.requestAnimationFrame = (cb) => setTimeout(cb, 0);
18
+ global.window.cancelAnimationFrame = (id) => clearTimeout(id);
19
+
20
+ global.ResizeObserver = vi.fn().mockImplementation(() => ({
21
+ observe: vi.fn(),
22
+ unobserve: vi.fn(),
23
+ disconnect: vi.fn(),
24
+ }));
25
+
26
+ global.window.matchMedia = vi.fn().mockImplementation(() => ({
27
+ matches: false,
28
+ addListener: vi.fn(),
29
+ removeListener: vi.fn(),
30
+ }));
31
+
32
+ // Configuração global do Vue Test Utils
33
+ config.global.stubs = {
34
+ Popper: true, // Evita erro de componente não encontrado
35
+ VueAwesomePaginate: true, // Stub para VueAwesomePaginate
36
+ SimpleModal: true, // Stub para SimpleModal
37
+ datepicker: true, // Stub para datepicker,
38
+ Svg: { template: "<svg></svg>" },
39
+ Popper: { template: "<div><slot /></div>" },
40
+ putVideo: { template: "<div></div>" },
41
+ VueAwesomePaginate: { template: "<div></div>" },
42
+ };
43
+
44
+ config.global.directives = {
45
+ lazy: () => {},
46
+ };
47
+
48
+ // Ativando Pinia para os testes
49
+ setActivePinia(createPinia()); // Certifica que Pinia está disponível nos testes
50
+
51
+ // Mock de axios para evitar chamadas reais de API
52
+ import { vi } from "vitest";
53
+
54
+ vi.mock("@/router/axios", () => ({
55
+ default: {
56
+ get: vi.fn().mockResolvedValue({ data: [] }), // Return an empty array (or any default data)
57
+ post: vi.fn(),
58
+ delete: vi.fn(),
59
+ patch: vi.fn(),
60
+ },
61
+ }));
62
+ // Mock de notiwind para evitar notificações em testes
63
+ vi.mock("notiwind", () => ({
64
+ notify: vi.fn(),
65
+ }));
@@ -1,5 +1,5 @@
1
- import { W as P, b as x } from "./index-CbprpAaO.js";
2
- import { E } from "./web-CyIQQOFE.js";
1
+ import { W as P, b as x } from "./index-BuojIsw4.js";
2
+ import { E } from "./web-JXRKfr2o.js";
3
3
  function m(w) {
4
4
  const e = w.split("/").filter((t) => t !== "."), r = [];
5
5
  return e.forEach((t) => {
@@ -1,4 +1,4 @@
1
- import { r as le, C as ge, W as me } from "./index-CbprpAaO.js";
1
+ import { r as le, C as ge, W as me } from "./index-BuojIsw4.js";
2
2
  const F = {
3
3
  RECORDING: "RECORDING",
4
4
  PAUSED: "PAUSED",
@@ -58,7 +58,7 @@ var te;
58
58
  n.UTF8 = "utf8", n.ASCII = "ascii", n.UTF16 = "utf16";
59
59
  })(te || (te = {}));
60
60
  const k = le("Filesystem", {
61
- web: () => import("./web-BLBNNkkD.js").then((n) => new n.FilesystemWeb())
61
+ web: () => import("./web-4JIZTmpG.js").then((n) => new n.FilesystemWeb())
62
62
  });
63
63
  ye();
64
64
  const Ee = le("BlobWriter");
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "dist",
6
6
  "src/test-utils"
7
7
  ],
8
- "version": "0.0.442",
8
+ "version": "0.0.443",
9
9
  "main": "dist/sm-click-library-ui.es.js",
10
10
  "module": "dist/sm-click-library-ui.umd.js",
11
11
  "private": false,
@@ -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
+ });
@@ -1,65 +1,65 @@
1
- import { JSDOM } from "jsdom";
2
- import { config } from "@vue/test-utils";
3
- import { setActivePinia, createPinia } from "pinia";
4
-
5
- // Cria um DOM simulado
6
- const dom = new JSDOM(`<!DOCTYPE html><html><body></body></html>`, {
7
- url: "http://localhost",
8
- });
9
-
10
- // Configura `window` e `document`
11
- global.window = dom.window;
12
- global.document = dom.window.document;
13
- global.navigator = dom.window.navigator;
14
-
15
- // Mock de métodos do DOM que podem ser necessários
16
- global.window.HTMLElement = dom.window.HTMLElement;
17
- global.window.requestAnimationFrame = (cb) => setTimeout(cb, 0);
18
- global.window.cancelAnimationFrame = (id) => clearTimeout(id);
19
-
20
- global.ResizeObserver = vi.fn().mockImplementation(() => ({
21
- observe: vi.fn(),
22
- unobserve: vi.fn(),
23
- disconnect: vi.fn(),
24
- }));
25
-
26
- global.window.matchMedia = vi.fn().mockImplementation(() => ({
27
- matches: false,
28
- addListener: vi.fn(),
29
- removeListener: vi.fn(),
30
- }));
31
-
32
- // Configuração global do Vue Test Utils
33
- config.global.stubs = {
34
- Popper: true, // Evita erro de componente não encontrado
35
- VueAwesomePaginate: true, // Stub para VueAwesomePaginate
36
- SimpleModal: true, // Stub para SimpleModal
37
- datepicker: true, // Stub para datepicker,
38
- Svg: { template: "<svg></svg>" },
39
- Popper: { template: "<div><slot /></div>" },
40
- putVideo: { template: "<div></div>" },
41
- VueAwesomePaginate: { template: "<div></div>" },
42
- };
43
-
44
- config.global.directives = {
45
- lazy: () => {},
46
- };
47
-
48
- // Ativando Pinia para os testes
49
- setActivePinia(createPinia()); // Certifica que Pinia está disponível nos testes
50
-
51
- // Mock de axios para evitar chamadas reais de API
52
- import { vi } from "vitest";
53
-
54
- vi.mock("@/router/axios", () => ({
55
- default: {
56
- get: vi.fn().mockResolvedValue({ data: [] }), // Return an empty array (or any default data)
57
- post: vi.fn(),
58
- delete: vi.fn(),
59
- patch: vi.fn(),
60
- },
61
- }));
62
- // Mock de notiwind para evitar notificações em testes
63
- vi.mock("notiwind", () => ({
64
- notify: vi.fn(),
65
- }));
1
+ import { JSDOM } from "jsdom";
2
+ import { config } from "@vue/test-utils";
3
+ import { setActivePinia, createPinia } from "pinia";
4
+
5
+ // Cria um DOM simulado
6
+ const dom = new JSDOM(`<!DOCTYPE html><html><body></body></html>`, {
7
+ url: "http://localhost",
8
+ });
9
+
10
+ // Configura `window` e `document`
11
+ global.window = dom.window;
12
+ global.document = dom.window.document;
13
+ global.navigator = dom.window.navigator;
14
+
15
+ // Mock de métodos do DOM que podem ser necessários
16
+ global.window.HTMLElement = dom.window.HTMLElement;
17
+ global.window.requestAnimationFrame = (cb) => setTimeout(cb, 0);
18
+ global.window.cancelAnimationFrame = (id) => clearTimeout(id);
19
+
20
+ global.ResizeObserver = vi.fn().mockImplementation(() => ({
21
+ observe: vi.fn(),
22
+ unobserve: vi.fn(),
23
+ disconnect: vi.fn(),
24
+ }));
25
+
26
+ global.window.matchMedia = vi.fn().mockImplementation(() => ({
27
+ matches: false,
28
+ addListener: vi.fn(),
29
+ removeListener: vi.fn(),
30
+ }));
31
+
32
+ // Configuração global do Vue Test Utils
33
+ config.global.stubs = {
34
+ Popper: true, // Evita erro de componente não encontrado
35
+ VueAwesomePaginate: true, // Stub para VueAwesomePaginate
36
+ SimpleModal: true, // Stub para SimpleModal
37
+ datepicker: true, // Stub para datepicker,
38
+ Svg: { template: "<svg></svg>" },
39
+ Popper: { template: "<div><slot /></div>" },
40
+ putVideo: { template: "<div></div>" },
41
+ VueAwesomePaginate: { template: "<div></div>" },
42
+ };
43
+
44
+ config.global.directives = {
45
+ lazy: () => {},
46
+ };
47
+
48
+ // Ativando Pinia para os testes
49
+ setActivePinia(createPinia()); // Certifica que Pinia está disponível nos testes
50
+
51
+ // Mock de axios para evitar chamadas reais de API
52
+ import { vi } from "vitest";
53
+
54
+ vi.mock("@/router/axios", () => ({
55
+ default: {
56
+ get: vi.fn().mockResolvedValue({ data: [] }), // Return an empty array (or any default data)
57
+ post: vi.fn(),
58
+ delete: vi.fn(),
59
+ patch: vi.fn(),
60
+ },
61
+ }));
62
+ // Mock de notiwind para evitar notificações em testes
63
+ vi.mock("notiwind", () => ({
64
+ notify: vi.fn(),
65
+ }));