@knowark/componarkjs 1.13.4 → 1.14.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/lib/base/component/component.js +17 -1
- package/lib/base/component/component.test.js +475 -389
- package/lib/base/utils/define.js +28 -6
- package/lib/base/utils/define.test.js +129 -42
- package/lib/base/utils/format.test.js +16 -16
- package/lib/base/utils/helpers.js +11 -4
- package/lib/base/utils/helpers.test.js +134 -115
- package/lib/base/utils/slots.test.js +38 -38
- package/lib/base/utils/uuid.test.js +13 -13
- package/lib/components/audio/components/audio.js +19 -1
- package/lib/components/audio/components/audio.test.js +120 -90
- package/lib/components/camera/components/camera.js +5 -0
- package/lib/components/camera/components/camera.test.js +96 -91
- package/lib/components/capture/components/capture.js +30 -2
- package/lib/components/capture/components/capture.test.js +165 -97
- package/lib/components/droparea/components/droparea-preview.js +58 -8
- package/lib/components/droparea/components/droparea-preview.test.js +262 -80
- package/lib/components/droparea/components/droparea.js +41 -4
- package/lib/components/droparea/components/droparea.test.js +309 -299
- package/lib/components/emit/components/emit.js +23 -3
- package/lib/components/emit/components/emit.test.js +192 -134
- package/lib/components/list/components/item.test.js +69 -68
- package/lib/components/list/components/list.js +33 -3
- package/lib/components/list/components/list.test.js +358 -227
- package/lib/components/paginator/components/paginator.test.js +146 -143
- package/lib/components/spinner/components/spinner.test.js +36 -41
- package/lib/components/splitview/components/splitview.detail.test.js +75 -73
- package/lib/components/splitview/components/splitview.js +36 -8
- package/lib/components/splitview/components/splitview.master.js +27 -2
- package/lib/components/splitview/components/splitview.master.test.js +52 -52
- package/lib/components/splitview/components/splitview.test.js +135 -31
- package/lib/components/translate/components/translate.js +28 -8
- package/lib/components/translate/components/translate.test.js +492 -133
- package/package.json +3 -27
- package/scripts/node-test-setup.js +94 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knowark/componarkjs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"author": "Knowark",
|
|
5
5
|
"description": "Knowark's Web Components Library",
|
|
6
6
|
"license": "ISC",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"types": "types/index.d.ts",
|
|
10
10
|
"scripts": {
|
|
11
|
-
"test": "NODE_OPTIONS='--experimental-
|
|
11
|
+
"test": "NODE_OPTIONS='--no-warnings' node --test --experimental-test-coverage --test-coverage-include='lib/**/*.js' --test-coverage-exclude='**/*.test.js' --import ./scripts/node-test-setup.js",
|
|
12
12
|
"dev": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' webpack serve --mode development --env development",
|
|
13
13
|
"prod": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' webpack --mode production --env production"
|
|
14
14
|
},
|
|
@@ -23,14 +23,10 @@
|
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@knowark/injectarkjs": "^0.10.6",
|
|
25
25
|
"@knowark/routarkjs": "^0.6.6",
|
|
26
|
-
"@types/jest": "^29.5.11",
|
|
27
26
|
"clean-webpack-plugin": "^4.0.0",
|
|
28
27
|
"copy-webpack-plugin": "^12.0.2",
|
|
29
28
|
"file-loader": "^6.2.0",
|
|
30
29
|
"html-webpack-plugin": "^5.6.0",
|
|
31
|
-
"jest": "^29.7.0",
|
|
32
|
-
"jest-canvas-mock": "^2.5.2",
|
|
33
|
-
"jest-environment-jsdom": "^29.7.0",
|
|
34
30
|
"jsdom": "^24.0.0",
|
|
35
31
|
"npm-check-updates": "^16.14.12",
|
|
36
32
|
"webpack": "^5.90.0",
|
|
@@ -42,27 +38,7 @@
|
|
|
42
38
|
},
|
|
43
39
|
"standard": {
|
|
44
40
|
"env": [
|
|
45
|
-
"
|
|
46
|
-
]
|
|
47
|
-
},
|
|
48
|
-
"jest": {
|
|
49
|
-
"verbose": true,
|
|
50
|
-
"clearMocks": true,
|
|
51
|
-
"testEnvironment": "jsdom",
|
|
52
|
-
"transform": {},
|
|
53
|
-
"setupFiles": [
|
|
54
|
-
"jest-canvas-mock"
|
|
55
|
-
],
|
|
56
|
-
"moduleDirectories": [
|
|
57
|
-
"node_modules",
|
|
58
|
-
"lib"
|
|
59
|
-
],
|
|
60
|
-
"collectCoverageFrom": [
|
|
61
|
-
"**/lib/**",
|
|
62
|
-
"!**/showcase/**"
|
|
63
|
-
],
|
|
64
|
-
"transformIgnorePatterns": [
|
|
65
|
-
"node_modules/(?!@knowark)"
|
|
41
|
+
"node"
|
|
66
42
|
]
|
|
67
43
|
},
|
|
68
44
|
"imports": {
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { JSDOM } from 'jsdom'
|
|
2
|
+
|
|
3
|
+
const dom = new JSDOM('<!doctype html><html><head></head><body></body></html>', {
|
|
4
|
+
url: 'http://localhost'
|
|
5
|
+
})
|
|
6
|
+
|
|
7
|
+
const { window } = dom
|
|
8
|
+
|
|
9
|
+
globalThis.window = window
|
|
10
|
+
globalThis.document = window.document
|
|
11
|
+
globalThis.self = window
|
|
12
|
+
globalThis.global = globalThis
|
|
13
|
+
globalThis.addEventListener = window.addEventListener.bind(window)
|
|
14
|
+
globalThis.removeEventListener = window.removeEventListener.bind(window)
|
|
15
|
+
globalThis.dispatchEvent = window.dispatchEvent.bind(window)
|
|
16
|
+
|
|
17
|
+
Object.defineProperty(globalThis, 'navigator', {
|
|
18
|
+
configurable: true,
|
|
19
|
+
value: window.navigator
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const forceGlobals = [
|
|
23
|
+
'Event',
|
|
24
|
+
'CustomEvent',
|
|
25
|
+
'InputEvent',
|
|
26
|
+
'MouseEvent',
|
|
27
|
+
'KeyboardEvent',
|
|
28
|
+
'EventTarget',
|
|
29
|
+
'HTMLElement',
|
|
30
|
+
'Element',
|
|
31
|
+
'Node',
|
|
32
|
+
'NodeList',
|
|
33
|
+
'DocumentFragment',
|
|
34
|
+
'DOMParser',
|
|
35
|
+
'MutationObserver',
|
|
36
|
+
'CustomElementRegistry',
|
|
37
|
+
'CSSStyleSheet',
|
|
38
|
+
'URL',
|
|
39
|
+
'File',
|
|
40
|
+
'Blob',
|
|
41
|
+
'MediaStream'
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
for (const key of forceGlobals) {
|
|
45
|
+
if (!window[key]) continue
|
|
46
|
+
globalThis[key] = window[key]
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
for (const key of Object.getOwnPropertyNames(window)) {
|
|
50
|
+
if (key in globalThis) continue
|
|
51
|
+
globalThis[key] = window[key]
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (!globalThis.requestAnimationFrame) {
|
|
55
|
+
globalThis.requestAnimationFrame = (callback) => {
|
|
56
|
+
return setTimeout(() => callback(Date.now()), 0)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!globalThis.cancelAnimationFrame) {
|
|
61
|
+
globalThis.cancelAnimationFrame = (id) => clearTimeout(id)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (globalThis.HTMLCanvasElement) {
|
|
65
|
+
globalThis.HTMLCanvasElement.prototype.getContext = () => ({
|
|
66
|
+
drawImage: () => {},
|
|
67
|
+
clearRect: () => {},
|
|
68
|
+
fillRect: () => {},
|
|
69
|
+
getImageData: () => ({ data: [] }),
|
|
70
|
+
putImageData: () => {},
|
|
71
|
+
createImageData: () => [],
|
|
72
|
+
setTransform: () => {},
|
|
73
|
+
resetTransform: () => {},
|
|
74
|
+
fillText: () => {},
|
|
75
|
+
measureText: () => ({ width: 0 }),
|
|
76
|
+
save: () => {},
|
|
77
|
+
restore: () => {},
|
|
78
|
+
beginPath: () => {},
|
|
79
|
+
moveTo: () => {},
|
|
80
|
+
lineTo: () => {},
|
|
81
|
+
closePath: () => {},
|
|
82
|
+
stroke: () => {},
|
|
83
|
+
translate: () => {},
|
|
84
|
+
scale: () => {},
|
|
85
|
+
rotate: () => {},
|
|
86
|
+
arc: () => {},
|
|
87
|
+
fill: () => {}
|
|
88
|
+
})
|
|
89
|
+
globalThis.HTMLCanvasElement.prototype.toDataURL = () => 'data:image/png;base64,mock'
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (!globalThis.URL.createObjectURL) {
|
|
93
|
+
globalThis.URL.createObjectURL = () => 'mock://data/url'
|
|
94
|
+
}
|