sm-click-library-ui 0.0.292 → 0.0.294
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/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sm-click-library-ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"
|
|
5
|
-
"dist"
|
|
6
|
-
],
|
|
7
|
-
"version": "0.0.292",
|
|
4
|
+
"version": "0.0.294",
|
|
8
5
|
"main": "dist/sm-click-library-ui.es.js",
|
|
9
6
|
"module": "dist/sm-click-library-ui.umd.js",
|
|
10
7
|
"private": false,
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"src/test-utils"
|
|
11
|
+
],
|
|
11
12
|
"exports": {
|
|
12
13
|
".": "./dist/sm-click-library-ui.es.js",
|
|
13
14
|
"./test-utils/setup": "./src/test-utils/setup.js"
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
"scripts": {
|
|
53
54
|
"dev": "vite",
|
|
54
55
|
"build": "pnpm run build:lib && pnpm run build:style",
|
|
56
|
+
"copy:test-utils": "cp src/test-utils/setup.js dist/test-utils/setup.js",
|
|
55
57
|
"build:lib": "vite build",
|
|
56
58
|
"build:style": "postcss src/styles/tailwind.css -o dist/tailwind.css",
|
|
57
59
|
"preview": "vite preview",
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
};
|
|
39
|
+
|
|
40
|
+
config.global.directives = {
|
|
41
|
+
lazy: () => { }
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Ativando Pinia para os testes
|
|
45
|
+
setActivePinia(createPinia()); // Certifica que Pinia está disponível nos testes
|
|
46
|
+
|
|
47
|
+
// Mock de axios para evitar chamadas reais de API
|
|
48
|
+
import { vi } from "vitest";
|
|
49
|
+
|
|
50
|
+
vi.mock("@/router/axios", () => ({
|
|
51
|
+
default: {
|
|
52
|
+
get: vi.fn(),
|
|
53
|
+
post: vi.fn(),
|
|
54
|
+
patch: vi.fn(),
|
|
55
|
+
delete: vi.fn()
|
|
56
|
+
}
|
|
57
|
+
}));
|
|
58
|
+
|
|
59
|
+
// Mock de notiwind para evitar notificações em testes
|
|
60
|
+
vi.mock("notiwind", () => ({
|
|
61
|
+
notify: vi.fn()
|
|
62
|
+
}));
|