@sankhyalabs/core 5.20.0-dev.62 → 5.20.0-dev.63
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/.docs/classes/LockManager.md +73 -15
- package/.docs/classes/UserAgentUtils.md +15 -1
- package/.docs/enumerations/LockManagerOperation.md +12 -0
- package/dist/utils/LockManager.d.ts +15 -3
- package/dist/utils/LockManager.js +52 -2
- package/dist/utils/LockManager.js.map +1 -1
- package/dist/utils/UserAgentUtils/index.d.ts +1 -0
- package/dist/utils/UserAgentUtils/index.js +5 -0
- package/dist/utils/UserAgentUtils/index.js.map +1 -1
- package/package.json +1 -1
- package/reports/test-report.xml +113 -113
- package/src/utils/LockManager.ts +63 -7
- package/src/utils/UserAgentUtils/index.ts +6 -1
|
@@ -26,7 +26,7 @@ Nome do atributo que será utilizado para controlar contexto de locks nos elemen
|
|
|
26
26
|
|
|
27
27
|
#### Source
|
|
28
28
|
|
|
29
|
-
src/utils/LockManager.ts:
|
|
29
|
+
src/utils/LockManager.ts:28
|
|
30
30
|
|
|
31
31
|
***
|
|
32
32
|
|
|
@@ -36,7 +36,7 @@ src/utils/LockManager.ts:24
|
|
|
36
36
|
|
|
37
37
|
#### Source
|
|
38
38
|
|
|
39
|
-
src/utils/LockManager.ts:
|
|
39
|
+
src/utils/LockManager.ts:23
|
|
40
40
|
|
|
41
41
|
## Methods
|
|
42
42
|
|
|
@@ -60,7 +60,7 @@ Elemento de de onde o lock deve começar.
|
|
|
60
60
|
|
|
61
61
|
#### Source
|
|
62
62
|
|
|
63
|
-
src/utils/LockManager.ts:
|
|
63
|
+
src/utils/LockManager.ts:87
|
|
64
64
|
|
|
65
65
|
***
|
|
66
66
|
|
|
@@ -74,7 +74,7 @@ src/utils/LockManager.ts:83
|
|
|
74
74
|
|
|
75
75
|
#### Source
|
|
76
76
|
|
|
77
|
-
src/utils/LockManager.ts:
|
|
77
|
+
src/utils/LockManager.ts:30
|
|
78
78
|
|
|
79
79
|
***
|
|
80
80
|
|
|
@@ -86,7 +86,7 @@ src/utils/LockManager.ts:26
|
|
|
86
86
|
|
|
87
87
|
• **ctxId**: `string` \| `HTMLElement`
|
|
88
88
|
|
|
89
|
-
• **operation**: [`
|
|
89
|
+
• **operation**: [`LockManagerOperation`](../enumerations/LockManagerOperation.md)
|
|
90
90
|
|
|
91
91
|
#### Returns
|
|
92
92
|
|
|
@@ -94,7 +94,7 @@ src/utils/LockManager.ts:26
|
|
|
94
94
|
|
|
95
95
|
#### Source
|
|
96
96
|
|
|
97
|
-
src/utils/LockManager.ts:
|
|
97
|
+
src/utils/LockManager.ts:34
|
|
98
98
|
|
|
99
99
|
***
|
|
100
100
|
|
|
@@ -112,13 +112,13 @@ src/utils/LockManager.ts:30
|
|
|
112
112
|
|
|
113
113
|
#### Source
|
|
114
114
|
|
|
115
|
-
src/utils/LockManager.ts:
|
|
115
|
+
src/utils/LockManager.ts:47
|
|
116
116
|
|
|
117
117
|
***
|
|
118
118
|
|
|
119
119
|
### lock()
|
|
120
120
|
|
|
121
|
-
> `static` **lock**(`id`, `operation`): `
|
|
121
|
+
> `static` **lock**(`id`, `operation`): () => `void`
|
|
122
122
|
|
|
123
123
|
Inicia um locker baseado em um contexto e uma operação.
|
|
124
124
|
|
|
@@ -128,19 +128,51 @@ Inicia um locker baseado em um contexto e uma operação.
|
|
|
128
128
|
|
|
129
129
|
Pode ser um ID do contexto de locker, ou, o elemento contendo um contexto de locker.
|
|
130
130
|
|
|
131
|
-
• **operation**: [`
|
|
131
|
+
• **operation**: [`LockManagerOperation`](../enumerations/LockManagerOperation.md)
|
|
132
132
|
|
|
133
133
|
Operação do contexto que o lock deve ser feito.
|
|
134
134
|
|
|
135
135
|
#### Returns
|
|
136
136
|
|
|
137
|
-
`
|
|
137
|
+
`Function`
|
|
138
138
|
|
|
139
139
|
- Uma função que fara a liberação do lock.
|
|
140
140
|
|
|
141
|
+
##### Returns
|
|
142
|
+
|
|
143
|
+
`void`
|
|
144
|
+
|
|
145
|
+
#### Source
|
|
146
|
+
|
|
147
|
+
src/utils/LockManager.ts:142
|
|
148
|
+
|
|
149
|
+
***
|
|
150
|
+
|
|
151
|
+
### resetLocks()
|
|
152
|
+
|
|
153
|
+
> `static` **resetLocks**(`id`, `operation`): `Promise`\<`void`\>
|
|
154
|
+
|
|
155
|
+
Reseta todos os locks existentes para um determinado contexto e operação de forma assíncrona
|
|
156
|
+
|
|
157
|
+
#### Parameters
|
|
158
|
+
|
|
159
|
+
• **id**: `string` \| `HTMLElement`
|
|
160
|
+
|
|
161
|
+
ID do contexto ou elemento HTML contendo contexto
|
|
162
|
+
|
|
163
|
+
• **operation**: [`LockManagerOperation`](../enumerations/LockManagerOperation.md)
|
|
164
|
+
|
|
165
|
+
Operação específica para resetar os locks
|
|
166
|
+
|
|
167
|
+
#### Returns
|
|
168
|
+
|
|
169
|
+
`Promise`\<`void`\>
|
|
170
|
+
|
|
171
|
+
Promise que será resolvida quando todos os locks forem resetados
|
|
172
|
+
|
|
141
173
|
#### Source
|
|
142
174
|
|
|
143
|
-
src/utils/LockManager.ts:
|
|
175
|
+
src/utils/LockManager.ts:116
|
|
144
176
|
|
|
145
177
|
***
|
|
146
178
|
|
|
@@ -160,13 +192,35 @@ src/utils/LockManager.ts:114
|
|
|
160
192
|
|
|
161
193
|
#### Source
|
|
162
194
|
|
|
163
|
-
src/utils/LockManager.ts:
|
|
195
|
+
src/utils/LockManager.ts:69
|
|
196
|
+
|
|
197
|
+
***
|
|
198
|
+
|
|
199
|
+
### whenHasLock()
|
|
200
|
+
|
|
201
|
+
> `static` **whenHasLock**(`id`, `operation`, `timeOut`?): `Promise`\<`void`\>
|
|
202
|
+
|
|
203
|
+
#### Parameters
|
|
204
|
+
|
|
205
|
+
• **id**: `string` \| `HTMLElement`
|
|
206
|
+
|
|
207
|
+
• **operation**: [`LockManagerOperation`](../enumerations/LockManagerOperation.md)
|
|
208
|
+
|
|
209
|
+
• **timeOut?**: `number`
|
|
210
|
+
|
|
211
|
+
#### Returns
|
|
212
|
+
|
|
213
|
+
`Promise`\<`void`\>
|
|
214
|
+
|
|
215
|
+
#### Source
|
|
216
|
+
|
|
217
|
+
src/utils/LockManager.ts:196
|
|
164
218
|
|
|
165
219
|
***
|
|
166
220
|
|
|
167
221
|
### whenResolve()
|
|
168
222
|
|
|
169
|
-
> `static` **whenResolve**(`id`, `operation`): `Promise`\<`void`\>
|
|
223
|
+
> `static` **whenResolve**(`id`, `operation`, `debounce`?, `timeOut`?): `Promise`\<`void`\>
|
|
170
224
|
|
|
171
225
|
Aguarda todos os lockers de um contexto e operação serem resolvidos.
|
|
172
226
|
|
|
@@ -176,10 +230,14 @@ Aguarda todos os lockers de um contexto e operação serem resolvidos.
|
|
|
176
230
|
|
|
177
231
|
Pode ser um ID do contexto de locker, ou, o elemento contendo um contexto de locker.
|
|
178
232
|
|
|
179
|
-
• **operation**: [`
|
|
233
|
+
• **operation**: [`LockManagerOperation`](../enumerations/LockManagerOperation.md)
|
|
180
234
|
|
|
181
235
|
Operação do contexto que devera aguardar.
|
|
182
236
|
|
|
237
|
+
• **debounce?**: `number`
|
|
238
|
+
|
|
239
|
+
• **timeOut?**: `number`
|
|
240
|
+
|
|
183
241
|
#### Returns
|
|
184
242
|
|
|
185
243
|
`Promise`\<`void`\>
|
|
@@ -188,4 +246,4 @@ Operação do contexto que devera aguardar.
|
|
|
188
246
|
|
|
189
247
|
#### Source
|
|
190
248
|
|
|
191
|
-
src/utils/LockManager.ts:
|
|
249
|
+
src/utils/LockManager.ts:169
|
|
@@ -34,7 +34,21 @@ Objeto com o nome e versão do navegador.
|
|
|
34
34
|
|
|
35
35
|
#### Source
|
|
36
36
|
|
|
37
|
-
src/utils/UserAgentUtils/index.ts:
|
|
37
|
+
src/utils/UserAgentUtils/index.ts:27
|
|
38
|
+
|
|
39
|
+
***
|
|
40
|
+
|
|
41
|
+
### isElectron()
|
|
42
|
+
|
|
43
|
+
> `static` **isElectron**(): `boolean`
|
|
44
|
+
|
|
45
|
+
#### Returns
|
|
46
|
+
|
|
47
|
+
`boolean`
|
|
48
|
+
|
|
49
|
+
#### Source
|
|
50
|
+
|
|
51
|
+
src/utils/UserAgentUtils/index.ts:18
|
|
38
52
|
|
|
39
53
|
***
|
|
40
54
|
|
|
@@ -10,6 +10,18 @@ Define os tipos de operação que o locker pode controlar
|
|
|
10
10
|
|
|
11
11
|
## Enumeration Members
|
|
12
12
|
|
|
13
|
+
### APP\_LOADING
|
|
14
|
+
|
|
15
|
+
> **APP\_LOADING**: `"app_loading"`
|
|
16
|
+
|
|
17
|
+
Operação de lock utilizada para controlar carregamento da aplicação.
|
|
18
|
+
|
|
19
|
+
#### Source
|
|
20
|
+
|
|
21
|
+
src/utils/LockManager.ts:13
|
|
22
|
+
|
|
23
|
+
***
|
|
24
|
+
|
|
13
25
|
### TASKBAR\_CLICK
|
|
14
26
|
|
|
15
27
|
> **TASKBAR\_CLICK**: `"taskbar_click"`
|
|
@@ -5,7 +5,11 @@ export declare enum LockManagerOperation {
|
|
|
5
5
|
/**
|
|
6
6
|
Operação de lock utilizada para controlar cliques nos botoes da taskbar.
|
|
7
7
|
*/
|
|
8
|
-
TASKBAR_CLICK = "taskbar_click"
|
|
8
|
+
TASKBAR_CLICK = "taskbar_click",
|
|
9
|
+
/**
|
|
10
|
+
Operação de lock utilizada para controlar carregamento da aplicação.
|
|
11
|
+
*/
|
|
12
|
+
APP_LOADING = "app_loading"
|
|
9
13
|
}
|
|
10
14
|
export declare class LockManager {
|
|
11
15
|
private static _locks;
|
|
@@ -25,6 +29,13 @@ export declare class LockManager {
|
|
|
25
29
|
* @returns - O id do locker, que pode ser usado para iniciar ou aguardar um lock do contexto.
|
|
26
30
|
*/
|
|
27
31
|
static addLockManagerCtxId(startElement: HTMLElement): string;
|
|
32
|
+
/**
|
|
33
|
+
* Reseta todos os locks existentes para um determinado contexto e operação de forma assíncrona
|
|
34
|
+
* @param id - ID do contexto ou elemento HTML contendo contexto
|
|
35
|
+
* @param operation - Operação específica para resetar os locks
|
|
36
|
+
* @returns Promise que será resolvida quando todos os locks forem resetados
|
|
37
|
+
*/
|
|
38
|
+
static resetLocks(id: string | HTMLElement, operation: LockManagerOperation): Promise<void>;
|
|
28
39
|
/**
|
|
29
40
|
* Inicia um locker baseado em um contexto e uma operação.
|
|
30
41
|
*
|
|
@@ -33,7 +44,7 @@ export declare class LockManager {
|
|
|
33
44
|
*
|
|
34
45
|
* @returns - Uma função que fara a liberação do lock.
|
|
35
46
|
*/
|
|
36
|
-
static lock(id: string | HTMLElement, operation: LockManagerOperation):
|
|
47
|
+
static lock(id: string | HTMLElement, operation: LockManagerOperation): () => void;
|
|
37
48
|
/**
|
|
38
49
|
* Aguarda todos os lockers de um contexto e operação serem resolvidos.
|
|
39
50
|
*
|
|
@@ -42,5 +53,6 @@ export declare class LockManager {
|
|
|
42
53
|
*
|
|
43
54
|
* @returns - Promise que será resolvida quando todos lockers forem finalizados.
|
|
44
55
|
*/
|
|
45
|
-
static whenResolve(id: string | HTMLElement, operation: LockManagerOperation): Promise<void>;
|
|
56
|
+
static whenResolve(id: string | HTMLElement, operation: LockManagerOperation, debounce?: number, timeOut?: number): Promise<void>;
|
|
57
|
+
static whenHasLock(id: string | HTMLElement, operation: LockManagerOperation, timeOut?: number): Promise<void>;
|
|
46
58
|
}
|
|
@@ -17,6 +17,10 @@ export var LockManagerOperation;
|
|
|
17
17
|
Operação de lock utilizada para controlar cliques nos botoes da taskbar.
|
|
18
18
|
*/
|
|
19
19
|
LockManagerOperation["TASKBAR_CLICK"] = "taskbar_click";
|
|
20
|
+
/**
|
|
21
|
+
Operação de lock utilizada para controlar carregamento da aplicação.
|
|
22
|
+
*/
|
|
23
|
+
LockManagerOperation["APP_LOADING"] = "app_loading";
|
|
20
24
|
})(LockManagerOperation || (LockManagerOperation = {}));
|
|
21
25
|
export class LockManager {
|
|
22
26
|
static buildContextID() {
|
|
@@ -60,6 +64,29 @@ export class LockManager {
|
|
|
60
64
|
return "";
|
|
61
65
|
}
|
|
62
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Reseta todos os locks existentes para um determinado contexto e operação de forma assíncrona
|
|
69
|
+
* @param id - ID do contexto ou elemento HTML contendo contexto
|
|
70
|
+
* @param operation - Operação específica para resetar os locks
|
|
71
|
+
* @returns Promise que será resolvida quando todos os locks forem resetados
|
|
72
|
+
*/
|
|
73
|
+
static resetLocks(id, operation) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
const lockerId = this.buildLockerID(id, operation);
|
|
76
|
+
if (!lockerId)
|
|
77
|
+
return;
|
|
78
|
+
const currentLocks = this._locks.get(lockerId);
|
|
79
|
+
if (currentLocks === null || currentLocks === void 0 ? void 0 : currentLocks.length) {
|
|
80
|
+
yield Promise.all(currentLocks.map(lock => {
|
|
81
|
+
var _a;
|
|
82
|
+
lock.done = true;
|
|
83
|
+
(_a = lock.resolve) === null || _a === void 0 ? void 0 : _a.call(lock);
|
|
84
|
+
return lock.promise;
|
|
85
|
+
}));
|
|
86
|
+
this._locks.delete(lockerId);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
63
90
|
/**
|
|
64
91
|
* Inicia um locker baseado em um contexto e uma operação.
|
|
65
92
|
*
|
|
@@ -93,21 +120,44 @@ export class LockManager {
|
|
|
93
120
|
*
|
|
94
121
|
* @returns - Promise que será resolvida quando todos lockers forem finalizados.
|
|
95
122
|
*/
|
|
96
|
-
static whenResolve(id, operation) {
|
|
123
|
+
static whenResolve(id, operation, debounce, timeOut) {
|
|
97
124
|
var _a, _b;
|
|
98
125
|
return __awaiter(this, void 0, void 0, function* () {
|
|
99
126
|
const lockerId = LockManager.buildLockerID(id, operation);
|
|
100
127
|
if (!lockerId)
|
|
101
128
|
return;
|
|
129
|
+
if (debounce)
|
|
130
|
+
yield new Promise(resolve => setTimeout(resolve, debounce));
|
|
131
|
+
const startTime = Date.now();
|
|
102
132
|
while ((_a = LockManager._locks.get(lockerId)) === null || _a === void 0 ? void 0 : _a.length) {
|
|
133
|
+
if (timeOut && Date.now() - startTime >= timeOut) {
|
|
134
|
+
yield this.resetLocks(id, operation);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
103
137
|
const locks = (_b = LockManager._locks.get(lockerId)) !== null && _b !== void 0 ? _b : [];
|
|
104
138
|
yield Promise.all(locks.map(lock => lock.promise));
|
|
105
139
|
//Aguarda listeners da tela reagirem as mudancas de estado do dataunit
|
|
106
|
-
yield new Promise(resolve => setTimeout(resolve, 200));
|
|
140
|
+
yield new Promise(resolve => setTimeout(resolve, debounce || 200));
|
|
107
141
|
LockManager._locks.set(lockerId, locks.filter(lock => !lock.done));
|
|
108
142
|
}
|
|
109
143
|
});
|
|
110
144
|
}
|
|
145
|
+
static whenHasLock(id, operation, timeOut) {
|
|
146
|
+
var _a;
|
|
147
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
const lockerId = LockManager.buildLockerID(id, operation);
|
|
149
|
+
if (!lockerId)
|
|
150
|
+
return;
|
|
151
|
+
const startTime = Date.now();
|
|
152
|
+
while (!((_a = LockManager._locks.get(lockerId)) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
153
|
+
if (timeOut && Date.now() - startTime >= timeOut) {
|
|
154
|
+
yield this.resetLocks(id, operation);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
yield new Promise(resolve => setTimeout(resolve, 200));
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
111
161
|
}
|
|
112
162
|
LockManager._locks = new Map();
|
|
113
163
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LockManager.js","sourceRoot":"","sources":["../../src/utils/LockManager.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC3C;;EAEE;AACN,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"LockManager.js","sourceRoot":"","sources":["../../src/utils/LockManager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C,cAAc,CAAC,EAAE;YAC3D,OAAO,cAAc,CAAC,YAAY,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;SAChE;QAED,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CACtE,CAAC,KAAK,YAAY,WAAW,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,cAAc,CAAC,CACtD,CAAC;QAE7B,IAAI,cAAc,EAAE;YAClB,OAAO,cAAc,CAAC,YAAY,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;SAChE;QAED,cAAc,GAAG,cAAc,CAAC,aAAa,CAAC;KAC/C;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAA;AAEc,8BAAkB,GAAG,CAAC,OAAoB,EAAE,KAAa,EAAQ,EAAE;IAC9E,IAAI,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QACzE,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;KAC3D;IACD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QAC3C,IAAI,KAAK,YAAY,WAAW,EAAE;YAC9B,WAAW,CAAC,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;SAChD;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
|
@@ -7,6 +7,7 @@ export declare class UserAgentUtils {
|
|
|
7
7
|
* @returns Verdadeiro se o navegador do usuário for o firefox.
|
|
8
8
|
*/
|
|
9
9
|
static isFirefox(): boolean;
|
|
10
|
+
static isElectron(): boolean;
|
|
10
11
|
/**
|
|
11
12
|
* Obtém nome e versão do navegador que está sendo utilizado.
|
|
12
13
|
* @returns Objeto com o nome e versão do navegador.
|
|
@@ -12,6 +12,10 @@ export class UserAgentUtils {
|
|
|
12
12
|
const browser = this.getBrowserInfo();
|
|
13
13
|
return !!browser.firefox;
|
|
14
14
|
}
|
|
15
|
+
static isElectron() {
|
|
16
|
+
const browser = this.getBrowserInfo();
|
|
17
|
+
return !!browser.electron;
|
|
18
|
+
}
|
|
15
19
|
/**
|
|
16
20
|
* Obtém nome e versão do navegador que está sendo utilizado.
|
|
17
21
|
* @returns Objeto com o nome e versão do navegador.
|
|
@@ -35,6 +39,7 @@ export class UserAgentUtils {
|
|
|
35
39
|
}
|
|
36
40
|
catch (e) {
|
|
37
41
|
//ignored
|
|
42
|
+
console.warn(e);
|
|
38
43
|
}
|
|
39
44
|
browser = Object.assign(Object.assign(Object.assign({}, browser), { name, version: (result === null || result === void 0 ? void 0 : result[1]) || "", simpleVersion }), (Array.isArray(type) ? type.reduce((acc, val) => (Object.assign(Object.assign({}, acc), { [val]: true })), {}) : { [type]: true }));
|
|
40
45
|
return !hasFound;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/UserAgentUtils/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,yBAAyB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,cAAc;IAEvB;;;OAGG;IACI,MAAM,CAAC,SAAS;QACnB,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QACtC,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,cAAc;QACxB,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC;QAC7C,IAAI,OAAO,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAS,CAAC;QAC/C,IAAI,MAA8B,CAAC;QAE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C,iCAAM,GAAG,KAAE,CAAC,GAAG,CAAC,EAAE,IAAI,IAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CACxG,CAAA;oBACD,OAAO,CAAC,QAAQ,CAAC;iBACpB;YACL,CAAC,CAAC,CAAA;YAEF,OAAO,CAAC,QAAQ,CAAC;QACrB,CAAC,CAAC,CAAA;QAEF,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ"}
|
package/package.json
CHANGED
package/reports/test-report.xml
CHANGED
|
@@ -1,175 +1,175 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<unitTest version="1">
|
|
3
|
-
<file path="/builds/dti/design-system/sankhyacore/test/
|
|
4
|
-
<testCase name="
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<testCase name="
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<testCase name="StringUtils it should return
|
|
11
|
-
<testCase name="StringUtils it should return
|
|
12
|
-
<testCase name="StringUtils it should return
|
|
13
|
-
<testCase name="StringUtils it should return a Criteria class with "Expression" and "parameters" concatenaded as needed setted through "AND" method" duration="82"/>
|
|
14
|
-
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "AND" method" duration="1"/>
|
|
15
|
-
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "AND" method" duration="1"/>
|
|
16
|
-
<testCase name="StringUtils it should return a toJSON object with "Criteria class" and "parameters" concatenaded as needed setted through "AND" method" duration="1"/>
|
|
17
|
-
<testCase name="StringUtils it should return a toJSON object with through empty constructor" duration="1"/>
|
|
3
|
+
<file path="/builds/dti/design-system/sankhyacore/test/http/HttpProvider.spec.ts">
|
|
4
|
+
<testCase name="HttpProvider Metodo GET" duration="73"/>
|
|
5
|
+
</file>
|
|
6
|
+
<file path="/builds/dti/design-system/sankhyacore/test/http/SkwHttpProvider.ts.spec.ts">
|
|
7
|
+
<testCase name="HttpProvider Metodo POST" duration="16"/>
|
|
8
|
+
</file>
|
|
9
|
+
<file path="/builds/dti/design-system/sankhyacore/test/util/CriteriaParameter.spec.ts">
|
|
10
|
+
<testCase name="StringUtils it should return the correct values of "value" and "type" through the getters methods initial setted by the constructor" duration="91"/>
|
|
11
|
+
<testCase name="StringUtils it should return the correct values of "value" and "type" through the getters methods initial setted by the setters methods" duration="0"/>
|
|
12
|
+
<testCase name="StringUtils it should return the correct JSON/Object value through the buildParam method" duration="13"/>
|
|
18
13
|
</file>
|
|
19
14
|
<file path="/builds/dti/design-system/sankhyacore/src/utils/test/objectUtils.spec.ts">
|
|
20
|
-
<testCase name="ObjectUtils hasEquivalentValues should return true if both objects have the same property value" duration="
|
|
15
|
+
<testCase name="ObjectUtils hasEquivalentValues should return true if both objects have the same property value" duration="116"/>
|
|
21
16
|
<testCase name="ObjectUtils hasEquivalentValues should return false if both objects have different property values" duration="1"/>
|
|
22
|
-
<testCase name="ObjectUtils hasEquivalentValues should return true if both objects are equivalent with custom property to compare" duration="
|
|
23
|
-
<testCase name="ObjectUtils hasEquivalentValues should return false if both objects are not equivalent with custom property to compare" duration="
|
|
24
|
-
<testCase name="ObjectUtils hasEquivalentValues should return false if one object does not have the property" duration="
|
|
25
|
-
<testCase name="ObjectUtils hasEquivalentValues should return true if comparing primitive values directly" duration="
|
|
17
|
+
<testCase name="ObjectUtils hasEquivalentValues should return true if both objects are equivalent with custom property to compare" duration="1"/>
|
|
18
|
+
<testCase name="ObjectUtils hasEquivalentValues should return false if both objects are not equivalent with custom property to compare" duration="1"/>
|
|
19
|
+
<testCase name="ObjectUtils hasEquivalentValues should return false if one object does not have the property" duration="1"/>
|
|
20
|
+
<testCase name="ObjectUtils hasEquivalentValues should return true if comparing primitive values directly" duration="1"/>
|
|
26
21
|
<testCase name="ObjectUtils hasEquivalentValues should return false if comparing different primitive values" duration="0"/>
|
|
27
22
|
<testCase name="ObjectUtils hasEquivalentValues should return true when comparing object with a null value" duration="1"/>
|
|
28
|
-
<testCase name="ObjectUtils hasEquivalentValues should return false when comparing object with null and non-null value" duration="
|
|
29
|
-
<testCase name="ObjectUtils hasEquivalentValues should return true when comparing non-object values that are equal" duration="
|
|
30
|
-
<testCase name="ObjectUtils should get an object value based on its path" duration="1"/>
|
|
23
|
+
<testCase name="ObjectUtils hasEquivalentValues should return false when comparing object with null and non-null value" duration="0"/>
|
|
24
|
+
<testCase name="ObjectUtils hasEquivalentValues should return true when comparing non-object values that are equal" duration="0"/>
|
|
31
25
|
<testCase name="ObjectUtils should get an object value based on its path" duration="0"/>
|
|
26
|
+
<testCase name="ObjectUtils should get an object value based on its path" duration="1"/>
|
|
32
27
|
<testCase name="ObjectUtils should return undefined if the path doesn't exist in the object" duration="0"/>
|
|
33
28
|
</file>
|
|
34
|
-
<file path="/builds/dti/design-system/sankhyacore/test/util/MaskFormatter.spec.ts">
|
|
35
|
-
<testCase name="Mask Formatter mask:CPF complete valid" duration="60"/>
|
|
36
|
-
<testCase name="Mask Formatter mask:CPF complete valid literals" duration="1"/>
|
|
37
|
-
<testCase name="Mask Formatter mask:CPF incomplete valid" duration="1"/>
|
|
38
|
-
<testCase name="Mask Formatter mask:CPF incomplete valid placeholder" duration="1"/>
|
|
39
|
-
<testCase name="Mask Formatter mask:CPF too long valid" duration="1"/>
|
|
40
|
-
<testCase name="Mask Formatter mask:CPF invalid for string" duration="92"/>
|
|
41
|
-
<testCase name="Mask Formatter mask:CPF invalid for being too long" duration="1"/>
|
|
42
|
-
<testCase name="Mask Formatter mask:Licence plate valid uppercase" duration="1"/>
|
|
43
|
-
<testCase name="Mask Formatter mask:Licence plate valid lowercase" duration="1"/>
|
|
44
|
-
<testCase name="Mask Formatter mask:Licence plate invalid" duration="2"/>
|
|
45
|
-
<testCase name="Mask Formatter mask:Licence plate invalid for being too short" duration="1"/>
|
|
46
|
-
<testCase name="Mask Formatter mask:Licence plate invalid for being too short with placeholder" duration="1"/>
|
|
47
|
-
<testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
|
|
48
|
-
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="1"/>
|
|
49
|
-
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="1"/>
|
|
50
|
-
<testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
|
|
51
|
-
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="0"/>
|
|
52
|
-
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="1"/>
|
|
53
|
-
<testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
|
|
54
|
-
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="1"/>
|
|
55
|
-
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="0"/>
|
|
56
|
-
<testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
|
|
57
|
-
</file>
|
|
58
|
-
<file path="/builds/dti/design-system/sankhyacore/test/http/HttpProvider.spec.ts">
|
|
59
|
-
<testCase name="HttpProvider Metodo GET" duration="1"/>
|
|
60
|
-
</file>
|
|
61
|
-
<file path="/builds/dti/design-system/sankhyacore/test/http/SkwHttpProvider.ts.spec.ts">
|
|
62
|
-
<testCase name="HttpProvider Metodo POST" duration="0"/>
|
|
63
|
-
</file>
|
|
64
29
|
<file path="/builds/dti/design-system/sankhyacore/test/util/StringUtils.spec.ts">
|
|
65
|
-
<testCase name="StringUtils valor vazio" duration="
|
|
66
|
-
<testCase name="StringUtils valor em branco" duration="
|
|
67
|
-
<testCase name="StringUtils valor null" duration="
|
|
30
|
+
<testCase name="StringUtils valor vazio" duration="99"/>
|
|
31
|
+
<testCase name="StringUtils valor em branco" duration="1"/>
|
|
32
|
+
<testCase name="StringUtils valor null" duration="0"/>
|
|
68
33
|
<testCase name="StringUtils valor undefined" duration="1"/>
|
|
69
|
-
<testCase name="StringUtils valor 0" duration="
|
|
34
|
+
<testCase name="StringUtils valor 0" duration="4"/>
|
|
70
35
|
<testCase name="StringUtils com valor" duration="0"/>
|
|
71
|
-
<testCase name="StringUtils substitui vogais com acento por vogais sem acento" duration="
|
|
72
|
-
<testCase name="StringUtils should return the original value when called with an object without a toString method" duration="
|
|
73
|
-
<testCase name="StringUtils should return the original value when called with undefined" duration="
|
|
36
|
+
<testCase name="StringUtils substitui vogais com acento por vogais sem acento" duration="1"/>
|
|
37
|
+
<testCase name="StringUtils should return the original value when called with an object without a toString method" duration="7"/>
|
|
38
|
+
<testCase name="StringUtils should return the original value when called with undefined" duration="1"/>
|
|
74
39
|
</file>
|
|
75
40
|
<file path="/builds/dti/design-system/sankhyacore/test/util/NumberUtils.spec.ts">
|
|
76
|
-
<testCase name="StringUtils stringToNumber" duration="
|
|
77
|
-
<testCase name="StringUtils format" duration="
|
|
78
|
-
<testCase name="StringUtils format without formatnumber parameter" duration="
|
|
41
|
+
<testCase name="StringUtils stringToNumber" duration="203"/>
|
|
42
|
+
<testCase name="StringUtils format" duration="193"/>
|
|
43
|
+
<testCase name="StringUtils format without formatnumber parameter" duration="82"/>
|
|
79
44
|
<testCase name="StringUtils format without formatnumber parameter" duration="1"/>
|
|
80
|
-
<testCase name="StringUtils format round number" duration="
|
|
45
|
+
<testCase name="StringUtils format round number" duration="2"/>
|
|
81
46
|
</file>
|
|
82
|
-
<file path="/builds/dti/design-system/sankhyacore/test/util/
|
|
83
|
-
<testCase name="StringUtils it should return the
|
|
84
|
-
<testCase name="StringUtils it should
|
|
85
|
-
<testCase name="StringUtils it should return
|
|
47
|
+
<file path="/builds/dti/design-system/sankhyacore/test/util/CriteriaModel.spec.ts">
|
|
48
|
+
<testCase name="StringUtils it should return the undefined and [] to Criteria Props through new class with empty constructor" duration="81"/>
|
|
49
|
+
<testCase name="StringUtils it should modify "expressions" and "parameters" properties through Setters methods" duration="1"/>
|
|
50
|
+
<testCase name="StringUtils it should return "expression" and "parameters" setted through constructor method" duration="1"/>
|
|
51
|
+
<testCase name="StringUtils it should return a Criteria class with "expression" and "parameters" as needed setted through "append" method" duration="1"/>
|
|
52
|
+
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "append" method" duration="1"/>
|
|
53
|
+
<testCase name="StringUtils it should return undefined as "expression" and "[]" as parameters as we use an empty criteria as first entry in the constructor" duration="1"/>
|
|
54
|
+
<testCase name="StringUtils it should return a Criteria class with "Expression" and "parameters" concatenaded as needed setted through "OR" method" duration="1"/>
|
|
55
|
+
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "OR" method" duration="0"/>
|
|
56
|
+
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "OR" method" duration="1"/>
|
|
57
|
+
<testCase name="StringUtils it should return a Criteria class with "Expression" and "parameters" concatenaded as needed setted through "AND" method" duration="7"/>
|
|
58
|
+
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "AND" method" duration="1"/>
|
|
59
|
+
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "AND" method" duration="13"/>
|
|
60
|
+
<testCase name="StringUtils it should return a toJSON object with "Criteria class" and "parameters" concatenaded as needed setted through "AND" method" duration="1"/>
|
|
61
|
+
<testCase name="StringUtils it should return a toJSON object with through empty constructor" duration="0"/>
|
|
86
62
|
</file>
|
|
87
63
|
<file path="/builds/dti/design-system/sankhyacore/test/util/OverflowWatcher.spec.ts">
|
|
88
|
-
<testCase name="OverflowWatcher should initialize with provided parameters" duration="
|
|
89
|
-
<testCase name="OverflowWatcher should disconect ResizeObserver when destroy is called" duration="
|
|
90
|
-
<testCase name="OverflowWatcher Should call callback on forceUpdate" duration="
|
|
91
|
-
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan" duration="
|
|
92
|
-
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan when notOverFlow is empty" duration="
|
|
93
|
-
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan considering overflowed elements" duration="
|
|
94
|
-
<testCase name="OverflowWatcher Should call callback on forceUpdate with empty list" duration="
|
|
95
|
-
<testCase name="OverflowWatcher should ignore elements that can not overflow" duration="
|
|
96
|
-
<testCase name="OverflowWatcher Should not call callback on forceUpdate" duration="
|
|
64
|
+
<testCase name="OverflowWatcher should initialize with provided parameters" duration="19"/>
|
|
65
|
+
<testCase name="OverflowWatcher should disconect ResizeObserver when destroy is called" duration="80"/>
|
|
66
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate" duration="515"/>
|
|
67
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan" duration="78"/>
|
|
68
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan when notOverFlow is empty" duration="25"/>
|
|
69
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan considering overflowed elements" duration="95"/>
|
|
70
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate with empty list" duration="12"/>
|
|
71
|
+
<testCase name="OverflowWatcher should ignore elements that can not overflow" duration="81"/>
|
|
72
|
+
<testCase name="OverflowWatcher Should not call callback on forceUpdate" duration="1"/>
|
|
73
|
+
</file>
|
|
74
|
+
<file path="/builds/dti/design-system/sankhyacore/src/dataunit/state/slice/test/RecordsSlice.spec.ts">
|
|
75
|
+
<testCase name="RecordsSlice should return newlines at the end" duration="1"/>
|
|
97
76
|
</file>
|
|
98
77
|
<file path="/builds/dti/design-system/sankhyacore/test/util/TimeFormatter.spec.ts">
|
|
99
|
-
<testCase name="TimeFormatter Case: input string unformated with showSeconds" duration="
|
|
100
|
-
<testCase name="TimeFormatter Case: input string unformated without showSeconds" duration="
|
|
78
|
+
<testCase name="TimeFormatter Case: input string unformated with showSeconds" duration="2"/>
|
|
79
|
+
<testCase name="TimeFormatter Case: input string unformated without showSeconds" duration="68"/>
|
|
101
80
|
<testCase name="TimeFormatter Case: validateTime" duration="1"/>
|
|
102
81
|
</file>
|
|
103
|
-
<file path="/builds/dti/design-system/sankhyacore/
|
|
104
|
-
<testCase name="
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
<testCase name="
|
|
108
|
-
<testCase name="
|
|
109
|
-
<testCase name="
|
|
110
|
-
<testCase name="
|
|
82
|
+
<file path="/builds/dti/design-system/sankhyacore/test/util/MaskFormatter.spec.ts">
|
|
83
|
+
<testCase name="Mask Formatter mask:CPF complete valid" duration="14"/>
|
|
84
|
+
<testCase name="Mask Formatter mask:CPF complete valid literals" duration="1"/>
|
|
85
|
+
<testCase name="Mask Formatter mask:CPF incomplete valid" duration="1"/>
|
|
86
|
+
<testCase name="Mask Formatter mask:CPF incomplete valid placeholder" duration="0"/>
|
|
87
|
+
<testCase name="Mask Formatter mask:CPF too long valid" duration="0"/>
|
|
88
|
+
<testCase name="Mask Formatter mask:CPF invalid for string" duration="391"/>
|
|
89
|
+
<testCase name="Mask Formatter mask:CPF invalid for being too long" duration="1"/>
|
|
90
|
+
<testCase name="Mask Formatter mask:Licence plate valid uppercase" duration="188"/>
|
|
91
|
+
<testCase name="Mask Formatter mask:Licence plate valid lowercase" duration="1"/>
|
|
92
|
+
<testCase name="Mask Formatter mask:Licence plate invalid" duration="80"/>
|
|
93
|
+
<testCase name="Mask Formatter mask:Licence plate invalid for being too short" duration="0"/>
|
|
94
|
+
<testCase name="Mask Formatter mask:Licence plate invalid for being too short with placeholder" duration="1"/>
|
|
95
|
+
<testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
|
|
96
|
+
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="1"/>
|
|
97
|
+
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="0"/>
|
|
98
|
+
<testCase name="Mask Formatter mask:Licence plate invalid" duration="6"/>
|
|
99
|
+
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="0"/>
|
|
100
|
+
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="0"/>
|
|
101
|
+
<testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
|
|
102
|
+
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="1"/>
|
|
103
|
+
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="1"/>
|
|
104
|
+
<testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
|
|
111
105
|
</file>
|
|
112
106
|
<file path="/builds/dti/design-system/sankhyacore/test/util/DataUnitStorage.spec.ts">
|
|
113
|
-
<testCase name="DataUnitStorage put should store a DataUnit instance in the DataUnitStorage" duration="
|
|
107
|
+
<testCase name="DataUnitStorage put should store a DataUnit instance in the DataUnitStorage" duration="6"/>
|
|
114
108
|
<testCase name="DataUnitStorage get should return the stored DataUnit instance from the DataUnitStorage" duration="1"/>
|
|
115
109
|
<testCase name="DataUnitStorage get should return undefined if the DataUnit instance is not found in the DataUnitStorage" duration="1"/>
|
|
116
110
|
<testCase name="DataUnitStorage remove should remove the specified DataUnit instance from the DataUnitStorage" duration="1"/>
|
|
117
111
|
<testCase name="DataUnitStorage remove should remove the DataUnit instance with the specified name from the DataUnitStorage" duration="1"/>
|
|
118
112
|
<testCase name="DataUnitStorage remove should not remove any DataUnit instance if the specified DataUnit instance or name is not found in the DataUnitStorage" duration="1"/>
|
|
119
113
|
</file>
|
|
114
|
+
<file path="/builds/dti/design-system/sankhyacore/src/dataunit/test/DataUnit.spec.ts">
|
|
115
|
+
<testCase name="DataUnit should return false when not waiting to reload" duration="3"/>
|
|
116
|
+
<testCase name="DataUnit should set waitingToReload to true" duration="1"/>
|
|
117
|
+
<testCase name="DataUnit should set waitingToReload to false" duration="0"/>
|
|
118
|
+
<testCase name="DataUnit should dispatch SAVING_CANCELED action with correct fields and recordId" duration="2"/>
|
|
119
|
+
</file>
|
|
120
120
|
<file path="/builds/dti/design-system/sankhyacore/test/util/ElementIDUtils.spec.ts">
|
|
121
|
-
<testCase name="addIDInfo 1 - should add data-element-id with valid id "movFinanceira_snkApplication"" duration="
|
|
122
|
-
<testCase name="addIDInfo 2 - should add data-element-id with valid id "brComSankhyaFinCadMovimentacaofinanceira_snkApplication"" duration="
|
|
123
|
-
<testCase name="addIDInfo 3 - should add data-element-id with valid id "movFinanceira_br.com.sankhya.fin.cad.movimentacaoFinanceira"" duration="
|
|
124
|
-
<testCase name="addIDInfo 4 - should add data-element-id with valid id "meuID2_snkApplication"" duration="
|
|
121
|
+
<testCase name="addIDInfo 1 - should add data-element-id with valid id "movFinanceira_snkApplication"" duration="12"/>
|
|
122
|
+
<testCase name="addIDInfo 2 - should add data-element-id with valid id "brComSankhyaFinCadMovimentacaofinanceira_snkApplication"" duration="1"/>
|
|
123
|
+
<testCase name="addIDInfo 3 - should add data-element-id with valid id "movFinanceira_br.com.sankhya.fin.cad.movimentacaoFinanceira"" duration="70"/>
|
|
124
|
+
<testCase name="addIDInfo 4 - should add data-element-id with valid id "meuID2_snkApplication"" duration="2"/>
|
|
125
125
|
<testCase name="addIDInfo 5 - should add data-element-id with valid id "movFinanceira_snkApplication"" duration="1"/>
|
|
126
126
|
<testCase name="addIDInfo 6 - should add data-element-id with valid id "movFinanceira_snkApplication"" duration="2"/>
|
|
127
127
|
<testCase name="addIDInfo 7 - should add data-element-id with valid id "componenteNameTest_snkApplication"" duration="1"/>
|
|
128
128
|
<testCase name="addIDInfo 8 - should add data-element-id with valid id "componentLabel_snkApplication"" duration="1"/>
|
|
129
|
-
<testCase name="addIDInfo 9 - should add data-element-id with valid id "dataunitFinanceiro_br.com.sankhya.fin.cad.movimentacaoFinanceira"" duration="
|
|
130
|
-
<testCase name="addIDInfo 10 - should add data-element-id with valid id "dataunitFinanceiro_meuIDTeste_br.com.sankhya.fin.cad.movimentacaoFinanceira"" duration="
|
|
129
|
+
<testCase name="addIDInfo 9 - should add data-element-id with valid id "dataunitFinanceiro_br.com.sankhya.fin.cad.movimentacaoFinanceira"" duration="1"/>
|
|
130
|
+
<testCase name="addIDInfo 10 - should add data-element-id with valid id "dataunitFinanceiro_meuIDTeste_br.com.sankhya.fin.cad.movimentacaoFinanceira"" duration="2"/>
|
|
131
131
|
<testCase name="addIDInfo 11 - should add data-element-id with valid id "dataunitFinanceiro_meuIDTeste_movimentacaoFinanceira"" duration="1"/>
|
|
132
|
-
<testCase name="addIDInfo 12 - should add data-element-id with valid id "dataunitFinanceiro_movFinanceira_movimentacaoFinanceira"" duration="
|
|
132
|
+
<testCase name="addIDInfo 12 - should add data-element-id with valid id "dataunitFinanceiro_movFinanceira_movimentacaoFinanceira"" duration="1"/>
|
|
133
133
|
<testCase name="addIDInfo 13 - should add data-element-id with valid id "dataunitFinanceiro_meuIDTeste_movimentacaoFinanceira"" duration="1"/>
|
|
134
|
-
<testCase name="addIDInfo 14 - should add data-element-id with valid id "dataunitFinanceiro_meuIdTeste_movimentacaoFinanceira"" duration="
|
|
135
|
-
<testCase name="addIDInfo 15 - should add data-element-id with valid id "dataunitFinanceiro_meuIdTeste_snkApplication"" duration="
|
|
134
|
+
<testCase name="addIDInfo 14 - should add data-element-id with valid id "dataunitFinanceiro_meuIdTeste_movimentacaoFinanceira"" duration="2"/>
|
|
135
|
+
<testCase name="addIDInfo 15 - should add data-element-id with valid id "dataunitFinanceiro_meuIdTeste_snkApplication"" duration="1"/>
|
|
136
136
|
<testCase name="addIDInfo 16 - should add data-element-id with valid id "dataunitFinanceiro_meuIdTeste_snkApplication"" duration="1"/>
|
|
137
137
|
<testCase name="addIDInfo 17 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="1"/>
|
|
138
|
-
<testCase name="addIDInfo 18 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="
|
|
139
|
-
<testCase name="addIDInfo 19 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="
|
|
138
|
+
<testCase name="addIDInfo 18 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="1"/>
|
|
139
|
+
<testCase name="addIDInfo 19 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="1"/>
|
|
140
140
|
<testCase name="addIDInfo 20 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="1"/>
|
|
141
141
|
<testCase name="addIDInfo 21 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="1"/>
|
|
142
|
-
<testCase name="addIDInfo 22 - should add data-element-id with valid id "bancoObrigatorio_movimentacaoFinanceira"" duration="
|
|
142
|
+
<testCase name="addIDInfo 22 - should add data-element-id with valid id "bancoObrigatorio_movimentacaoFinanceira"" duration="0"/>
|
|
143
143
|
</file>
|
|
144
144
|
<file path="/builds/dti/design-system/sankhyacore/test/util/ElementUtils.spec.ts">
|
|
145
|
-
<testCase name="calcMarginSize should calculate correctly the size of horizontal margin" duration="
|
|
146
|
-
<testCase name="calcMarginSize should calculate correctly the size of vertical margin" duration="
|
|
147
|
-
<testCase name="calcMarginSize should threat values defined as zero" duration="
|
|
145
|
+
<testCase name="calcMarginSize should calculate correctly the size of horizontal margin" duration="72"/>
|
|
146
|
+
<testCase name="calcMarginSize should calculate correctly the size of vertical margin" duration="3"/>
|
|
147
|
+
<testCase name="calcMarginSize should threat values defined as zero" duration="5"/>
|
|
148
148
|
</file>
|
|
149
149
|
<file path="/builds/dti/design-system/sankhyacore/test/dataunit/formatting/PrettyFormatter.spec.ts">
|
|
150
|
-
<testCase name="getFormattedValue should return empty string when value is null" duration="
|
|
150
|
+
<testCase name="getFormattedValue should return empty string when value is null" duration="6"/>
|
|
151
151
|
<testCase name="getFormattedValue should return empty string when value is not an array" duration="0"/>
|
|
152
|
-
<testCase name="getFormattedValue should return empty string when value is an empty array" duration="
|
|
152
|
+
<testCase name="getFormattedValue should return empty string when value is an empty array" duration="0"/>
|
|
153
153
|
<testCase name="getFormattedValue should return file name when value is an array with one file object" duration="0"/>
|
|
154
154
|
<testCase name="getFormattedValue should return file count when value is an array with multiple file objects" duration="1"/>
|
|
155
|
-
<testCase name="getFormattedValue should return empty string for undefined file" duration="
|
|
156
|
-
<testCase name="getFormattedValue should handle OBJECT type with value field" duration="
|
|
157
|
-
<testCase name="getFormattedValue should return empty string when value is undefined" duration="
|
|
158
|
-
<testCase name="getFormattedValue should return value as string when value is not an object" duration="
|
|
155
|
+
<testCase name="getFormattedValue should return empty string for undefined file" duration="0"/>
|
|
156
|
+
<testCase name="getFormattedValue should handle OBJECT type with value field" duration="1"/>
|
|
157
|
+
<testCase name="getFormattedValue should return empty string when value is undefined" duration="0"/>
|
|
158
|
+
<testCase name="getFormattedValue should return value as string when value is not an object" duration="1"/>
|
|
159
159
|
<testCase name="getFormattedValue should return value.toString() when value is an object without value property" duration="0"/>
|
|
160
160
|
<testCase name="getFormattedValue should handle BOOLEAN type" duration="1"/>
|
|
161
|
-
<testCase name="getFormattedValue should format numbers correctly" duration="
|
|
162
|
-
<testCase name="getFormattedValue should format dates correctly" duration="
|
|
161
|
+
<testCase name="getFormattedValue should format numbers correctly" duration="16"/>
|
|
162
|
+
<testCase name="getFormattedValue should format dates correctly" duration="5"/>
|
|
163
163
|
<testCase name="getFormattedValue should format times correctly" duration="1"/>
|
|
164
164
|
<testCase name="getFormattedValue should format datetime correctly" duration="1"/>
|
|
165
165
|
<testCase name="getFormattedValue should call toString with correct parameters" duration="0"/>
|
|
166
166
|
<testCase name="getFormattedValue should handle undefined descriptor gracefully" duration="1"/>
|
|
167
167
|
<testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and matching option" duration="0"/>
|
|
168
|
-
<testCase name="getFormattedValue should return value with OPTIONSELECTOR and no matching option" duration="
|
|
168
|
+
<testCase name="getFormattedValue should return value with OPTIONSELECTOR and no matching option" duration="1"/>
|
|
169
169
|
<testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and value as object" duration="0"/>
|
|
170
170
|
<testCase name="getFormattedValue should return empty string with OPTIONSELECTOR and value as null" duration="0"/>
|
|
171
171
|
<testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and options as JSON string" duration="0"/>
|
|
172
|
-
<testCase name="getFormattedValue should return value with OPTIONSELECTOR and options as empty array" duration="
|
|
172
|
+
<testCase name="getFormattedValue should return value with OPTIONSELECTOR and options as empty array" duration="1"/>
|
|
173
173
|
<testCase name="getFormattedValue should format masked values correctly" duration="1"/>
|
|
174
174
|
</file>
|
|
175
175
|
</unitTest>
|
package/src/utils/LockManager.ts
CHANGED
|
@@ -6,7 +6,11 @@ export enum LockManagerOperation {
|
|
|
6
6
|
/**
|
|
7
7
|
Operação de lock utilizada para controlar cliques nos botoes da taskbar.
|
|
8
8
|
*/
|
|
9
|
-
TASKBAR_CLICK = "taskbar_click"
|
|
9
|
+
TASKBAR_CLICK = "taskbar_click",
|
|
10
|
+
/**
|
|
11
|
+
Operação de lock utilizada para controlar carregamento da aplicação.
|
|
12
|
+
*/
|
|
13
|
+
APP_LOADING = "app_loading"
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
type Lock = {
|
|
@@ -72,7 +76,7 @@ export class LockManager{
|
|
|
72
76
|
}
|
|
73
77
|
});
|
|
74
78
|
};
|
|
75
|
-
|
|
79
|
+
|
|
76
80
|
/**
|
|
77
81
|
* Cria um contexto de locker, caso nao exista, para todos elementos pais iniciados com ez- ou snk-.
|
|
78
82
|
*
|
|
@@ -103,6 +107,30 @@ export class LockManager{
|
|
|
103
107
|
}
|
|
104
108
|
}
|
|
105
109
|
|
|
110
|
+
/**
|
|
111
|
+
* Reseta todos os locks existentes para um determinado contexto e operação de forma assíncrona
|
|
112
|
+
* @param id - ID do contexto ou elemento HTML contendo contexto
|
|
113
|
+
* @param operation - Operação específica para resetar os locks
|
|
114
|
+
* @returns Promise que será resolvida quando todos os locks forem resetados
|
|
115
|
+
*/
|
|
116
|
+
public static async resetLocks(id: string | HTMLElement, operation: LockManagerOperation): Promise<void> {
|
|
117
|
+
const lockerId = this.buildLockerID(id, operation);
|
|
118
|
+
if (!lockerId) return;
|
|
119
|
+
|
|
120
|
+
const currentLocks = this._locks.get(lockerId);
|
|
121
|
+
|
|
122
|
+
if (currentLocks?.length) {
|
|
123
|
+
await Promise.all(currentLocks.map(lock => {
|
|
124
|
+
lock.done = true;
|
|
125
|
+
lock.resolve?.();
|
|
126
|
+
return lock.promise;
|
|
127
|
+
}));
|
|
128
|
+
|
|
129
|
+
this._locks.delete(lockerId);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
106
134
|
/**
|
|
107
135
|
* Inicia um locker baseado em um contexto e uma operação.
|
|
108
136
|
*
|
|
@@ -111,7 +139,7 @@ export class LockManager{
|
|
|
111
139
|
*
|
|
112
140
|
* @returns - Uma função que fara a liberação do lock.
|
|
113
141
|
*/
|
|
114
|
-
public static lock(id:string|HTMLElement, operation:LockManagerOperation):
|
|
142
|
+
public static lock(id:string|HTMLElement, operation:LockManagerOperation): () => void {
|
|
115
143
|
const lockerId = LockManager.buildLockerID(id, operation);
|
|
116
144
|
|
|
117
145
|
if(!lockerId) return () => {};
|
|
@@ -122,7 +150,6 @@ export class LockManager{
|
|
|
122
150
|
|
|
123
151
|
const currentLocks = LockManager._locks.get(lockerId) ?? [];
|
|
124
152
|
currentLocks.push(lock);
|
|
125
|
-
|
|
126
153
|
LockManager._locks.set(lockerId, currentLocks);
|
|
127
154
|
|
|
128
155
|
return () => {
|
|
@@ -139,19 +166,48 @@ export class LockManager{
|
|
|
139
166
|
*
|
|
140
167
|
* @returns - Promise que será resolvida quando todos lockers forem finalizados.
|
|
141
168
|
*/
|
|
142
|
-
public static async whenResolve(id:string|HTMLElement, operation:LockManagerOperation): Promise<void> {
|
|
169
|
+
public static async whenResolve(id:string|HTMLElement, operation:LockManagerOperation, debounce?: number, timeOut?: number): Promise<void> {
|
|
143
170
|
const lockerId = LockManager.buildLockerID(id, operation);
|
|
144
171
|
|
|
145
172
|
if(!lockerId) return;
|
|
146
173
|
|
|
174
|
+
if(debounce) await new Promise(resolve => setTimeout(resolve, debounce));
|
|
175
|
+
|
|
176
|
+
const startTime = Date.now();
|
|
177
|
+
|
|
147
178
|
while (LockManager._locks.get(lockerId)?.length) {
|
|
179
|
+
|
|
180
|
+
if (timeOut && Date.now() - startTime >= timeOut) {
|
|
181
|
+
await this.resetLocks(id, operation);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
|
|
148
185
|
const locks:Array<Lock> = LockManager._locks.get(lockerId) ?? [];
|
|
149
186
|
await Promise.all(locks.map(lock => lock.promise));
|
|
150
187
|
|
|
151
188
|
//Aguarda listeners da tela reagirem as mudancas de estado do dataunit
|
|
152
|
-
await new Promise(resolve => setTimeout(resolve, 200));
|
|
153
|
-
|
|
189
|
+
await new Promise(resolve => setTimeout(resolve, debounce || 200));
|
|
190
|
+
|
|
154
191
|
LockManager._locks.set(lockerId, locks.filter(lock => !lock.done));
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
public static async whenHasLock(id:string|HTMLElement, operation:LockManagerOperation, timeOut?: number): Promise<void> {
|
|
197
|
+
const lockerId = LockManager.buildLockerID(id, operation);
|
|
198
|
+
|
|
199
|
+
if(!lockerId) return;
|
|
200
|
+
|
|
201
|
+
const startTime = Date.now();
|
|
202
|
+
|
|
203
|
+
while (!LockManager._locks.get(lockerId)?.length) {
|
|
204
|
+
|
|
205
|
+
if (timeOut && Date.now() - startTime >= timeOut) {
|
|
206
|
+
await this.resetLocks(id, operation);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
155
211
|
}
|
|
156
212
|
}
|
|
157
213
|
}
|
|
@@ -15,6 +15,11 @@ export class UserAgentUtils {
|
|
|
15
15
|
return !!browser.firefox;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
public static isElectron() {
|
|
19
|
+
const browser = this.getBrowserInfo();
|
|
20
|
+
return !!browser.electron;
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
/**
|
|
19
24
|
* Obtém nome e versão do navegador que está sendo utilizado.
|
|
20
25
|
* @returns Objeto com o nome e versão do navegador.
|
|
@@ -40,6 +45,7 @@ export class UserAgentUtils {
|
|
|
40
45
|
}
|
|
41
46
|
} catch (e) {
|
|
42
47
|
//ignored
|
|
48
|
+
console.warn(e);
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
browser = {
|
|
@@ -49,7 +55,6 @@ export class UserAgentUtils {
|
|
|
49
55
|
simpleVersion,
|
|
50
56
|
...(Array.isArray(type) ? type.reduce((acc, val) => ({ ...acc, [val]: true}), {}) : { [type]: true })
|
|
51
57
|
}
|
|
52
|
-
|
|
53
58
|
return !hasFound;
|
|
54
59
|
}
|
|
55
60
|
})
|