@etsoo/notificationbase 1.1.53 → 1.1.55
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/__tests__/Notification.ts +8 -10
- package/__tests__/tsconfig.json +5 -4
- package/package.json +47 -66
- package/tsconfig.cjs.json +1 -1
- package/tsconfig.json +3 -3
- package/vite.config.mts +11 -0
|
@@ -33,7 +33,7 @@ var container = new NotificationContainerTest((update) => {});
|
|
|
33
33
|
|
|
34
34
|
// Timer mock
|
|
35
35
|
// https://jestjs.io/docs/en/timer-mocks
|
|
36
|
-
|
|
36
|
+
vi.useFakeTimers();
|
|
37
37
|
|
|
38
38
|
test("Tests for basic data", () => {
|
|
39
39
|
expect(Object.keys(container.notifications).length).toBe(
|
|
@@ -46,13 +46,13 @@ test("Tests for notification dismiss", () => {
|
|
|
46
46
|
const n = new NotificationTest(NotificationType.Loading, "Test");
|
|
47
47
|
|
|
48
48
|
// Spy on the method
|
|
49
|
-
const spy =
|
|
49
|
+
const spy = vi.spyOn(n, "dismiss");
|
|
50
50
|
|
|
51
51
|
// Act
|
|
52
52
|
n.dismiss(2);
|
|
53
53
|
|
|
54
54
|
// Fast forward
|
|
55
|
-
|
|
55
|
+
vi.runOnlyPendingTimers();
|
|
56
56
|
|
|
57
57
|
// dismiss should be called 2 times
|
|
58
58
|
expect(spy).toHaveBeenCalledTimes(2);
|
|
@@ -74,13 +74,13 @@ test("Tests for notification container add", () => {
|
|
|
74
74
|
expect(n.open).toBe(false);
|
|
75
75
|
|
|
76
76
|
// Fast forward
|
|
77
|
-
|
|
77
|
+
vi.runOnlyPendingTimers();
|
|
78
78
|
|
|
79
79
|
// Will be totally removed from the collection
|
|
80
80
|
expect(container.alignCount(n.align)).toBe(0);
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
-
test("Tests for notification container remove", (
|
|
83
|
+
test("Tests for notification container remove", () => {
|
|
84
84
|
// Arrange
|
|
85
85
|
// Reset
|
|
86
86
|
container.dispose();
|
|
@@ -98,7 +98,7 @@ test("Tests for notification container remove", (done) => {
|
|
|
98
98
|
container.add(newNotification);
|
|
99
99
|
|
|
100
100
|
// Fast forward
|
|
101
|
-
|
|
101
|
+
vi.runOnlyPendingTimers();
|
|
102
102
|
|
|
103
103
|
// Clear tests
|
|
104
104
|
expect(container.alignCount(NotificationAlign.Unknown)).toBe(1);
|
|
@@ -106,8 +106,6 @@ test("Tests for notification container remove", (done) => {
|
|
|
106
106
|
container.clear();
|
|
107
107
|
|
|
108
108
|
expect(container.alignCount(NotificationAlign.Unknown)).toBe(1);
|
|
109
|
-
|
|
110
|
-
done();
|
|
111
109
|
};
|
|
112
110
|
n.timespan = 3;
|
|
113
111
|
|
|
@@ -120,7 +118,7 @@ test("Tests for notification container remove", (done) => {
|
|
|
120
118
|
expect(container.isModeling).toBeTruthy();
|
|
121
119
|
|
|
122
120
|
// Fast forward
|
|
123
|
-
|
|
121
|
+
vi.runOnlyPendingTimers();
|
|
124
122
|
});
|
|
125
123
|
|
|
126
|
-
|
|
124
|
+
vi.clearAllTimers();
|
package/__tests__/tsconfig.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "ES2020",
|
|
4
|
-
"module": "
|
|
5
|
-
"moduleResolution": "
|
|
4
|
+
"module": "ES2020",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
6
|
"allowJs": false,
|
|
7
|
-
"skipLibCheck":
|
|
7
|
+
"skipLibCheck": false,
|
|
8
8
|
"esModuleInterop": true,
|
|
9
9
|
"allowSyntheticDefaultImports": true,
|
|
10
10
|
"strict": true,
|
|
11
11
|
"forceConsistentCasingInFileNames": true,
|
|
12
12
|
"isolatedModules": true,
|
|
13
13
|
"noEmit": true,
|
|
14
|
-
"declaration": true
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"types": ["vitest/globals"]
|
|
15
16
|
},
|
|
16
17
|
"include": [".."]
|
|
17
18
|
}
|
package/package.json
CHANGED
|
@@ -1,69 +1,50 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json",
|
|
16
|
-
"format": "prettier --write src/**/*.ts",
|
|
17
|
-
"lint": "eslint --ext .ts src/",
|
|
18
|
-
"test": "jest",
|
|
19
|
-
"test:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand"
|
|
20
|
-
},
|
|
21
|
-
"jest": {
|
|
22
|
-
"automock": false,
|
|
23
|
-
"testMatch": [
|
|
24
|
-
"<rootDir>/__tests__/**/*.ts"
|
|
25
|
-
],
|
|
26
|
-
"testEnvironment": "jsdom",
|
|
27
|
-
"transform": {
|
|
28
|
-
".+\\.jsx?$": "babel-jest",
|
|
29
|
-
".+\\.tsx?$": "ts-jest"
|
|
30
|
-
},
|
|
31
|
-
"transformIgnorePatterns": [
|
|
32
|
-
"/node_modules/(?!@etsoo/).+\\.js$"
|
|
33
|
-
]
|
|
34
|
-
},
|
|
35
|
-
"repository": {
|
|
36
|
-
"type": "git",
|
|
37
|
-
"url": "git+https://github.com/ETSOO/NotificationBase.git"
|
|
38
|
-
},
|
|
39
|
-
"keywords": [
|
|
40
|
-
"notification",
|
|
41
|
-
"TypeScript",
|
|
42
|
-
"ETSOO",
|
|
43
|
-
"SmartERP",
|
|
44
|
-
"司友云平台",
|
|
45
|
-
"青岛亿速思维",
|
|
46
|
-
"上海亿商"
|
|
47
|
-
],
|
|
48
|
-
"author": "Garry Xiao",
|
|
49
|
-
"license": "MIT",
|
|
50
|
-
"bugs": {
|
|
51
|
-
"url": "https://github.com/ETSOO/NotificationBase/issues"
|
|
52
|
-
},
|
|
53
|
-
"homepage": "https://github.com/ETSOO/NotificationBase#readme",
|
|
54
|
-
"dependencies": {
|
|
55
|
-
"@etsoo/shared": "^1.2.54"
|
|
56
|
-
},
|
|
57
|
-
"devDependencies": {
|
|
58
|
-
"@babel/core": "^7.26.0",
|
|
59
|
-
"@babel/plugin-transform-runtime": "^7.25.9",
|
|
60
|
-
"@babel/preset-env": "^7.26.0",
|
|
61
|
-
"@babel/runtime-corejs3": "^7.26.0",
|
|
62
|
-
"@types/jest": "^29.5.14",
|
|
63
|
-
"babel-jest": "^29.7.0",
|
|
64
|
-
"jest": "^29.7.0",
|
|
65
|
-
"jest-environment-jsdom": "^29.7.0",
|
|
66
|
-
"ts-jest": "^29.2.5",
|
|
67
|
-
"typescript": "^5.6.3"
|
|
2
|
+
"name": "@etsoo/notificationbase",
|
|
3
|
+
"version": "1.1.55",
|
|
4
|
+
"description": "TypeScript notification component for extending with all features described and partially implemented",
|
|
5
|
+
"main": "lib/cjs/index.js",
|
|
6
|
+
"module": "lib/mjs/index.js",
|
|
7
|
+
"types": "lib/mjs/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./lib/mjs/index.js",
|
|
11
|
+
"require": "./lib/cjs/index.js"
|
|
68
12
|
}
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json",
|
|
16
|
+
"test": "vitest"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/ETSOO/NotificationBase.git"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"notification",
|
|
24
|
+
"TypeScript",
|
|
25
|
+
"ETSOO",
|
|
26
|
+
"SmartERP",
|
|
27
|
+
"司友云平台",
|
|
28
|
+
"青岛亿速思维",
|
|
29
|
+
"上海亿商"
|
|
30
|
+
],
|
|
31
|
+
"author": "Garry Xiao",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/ETSOO/NotificationBase/issues"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/ETSOO/NotificationBase#readme",
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@etsoo/shared": "^1.2.57"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@babel/core": "^7.26.0",
|
|
42
|
+
"@babel/plugin-transform-runtime": "^7.25.9",
|
|
43
|
+
"@babel/preset-env": "^7.26.0",
|
|
44
|
+
"@babel/runtime-corejs3": "^7.26.0",
|
|
45
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
46
|
+
"jsdom": "^26.0.0",
|
|
47
|
+
"typescript": "^5.7.3",
|
|
48
|
+
"vitest": "^2.1.8"
|
|
49
|
+
}
|
|
69
50
|
}
|
package/tsconfig.cjs.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
4
|
"target": "ES2020",
|
|
5
|
-
"module": "
|
|
6
|
-
"moduleResolution": "
|
|
5
|
+
"module": "ES2020",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
7
|
"isolatedModules": true,
|
|
8
8
|
"outDir": "./lib/mjs",
|
|
9
9
|
"noEmit": false,
|
|
10
10
|
"declaration": true,
|
|
11
11
|
"strict": true,
|
|
12
12
|
"esModuleInterop": true,
|
|
13
|
-
"skipLibCheck":
|
|
13
|
+
"skipLibCheck": false,
|
|
14
14
|
"forceConsistentCasingInFileNames": true
|
|
15
15
|
},
|
|
16
16
|
"include": ["src"]
|
package/vite.config.mts
ADDED