@zeedhi/teknisa-components-common 1.48.0 → 1.53.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/coverage/clover.xml +437 -308
- package/coverage/coverage-final.json +38 -31
- package/coverage/lcov-report/index.html +39 -9
- package/coverage/lcov-report/tests/__helpers__/component-event-helper.ts.html +100 -0
- package/coverage/lcov-report/tests/__helpers__/get-child-helper.ts.html +166 -0
- package/coverage/lcov-report/tests/__helpers__/index.html +161 -0
- package/coverage/lcov-report/tests/__helpers__/index.ts.html +94 -0
- package/coverage/lcov-report/tests/__helpers__/mock-created-helper.ts.html +121 -0
- package/coverage/lcov.info +688 -406
- package/dist/tek-components-common.esm.js +1 -0
- package/dist/tek-components-common.umd.js +1 -0
- package/package.json +2 -2
- package/tests/__helpers__/component-event-helper.ts +5 -0
- package/tests/__helpers__/get-child-helper.ts +27 -0
- package/tests/__helpers__/index.ts +3 -0
- package/tests/__helpers__/mock-created-helper.ts +5 -3
- package/tests/unit/components/tek-grid/grid.spec.ts +514 -531
- package/tests/unit/components/tek-user-info/tek-user-info-list.spec.ts +2 -1
- package/tests/unit/components/tek-user-info/tek-user-info.spec.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/teknisa-components-common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.53.0",
|
|
4
4
|
"description": "Teknisa Components Common",
|
|
5
5
|
"author": "Zeedhi <zeedhi@teknisa.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@zeedhi/core": "*"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "302c68b7d95c3b2592a24c199320ae520f44b38b"
|
|
33
33
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IComponent } from '@zeedhi/common';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Search for a component inside an array of children
|
|
5
|
+
*
|
|
6
|
+
* The children array can be either an array of IComponent or an array of Component
|
|
7
|
+
*/
|
|
8
|
+
const getChild = <T extends IComponent>(children: any[], name: string): T => {
|
|
9
|
+
let found: any;
|
|
10
|
+
|
|
11
|
+
children.forEach((child) => {
|
|
12
|
+
if (child.name === name) {
|
|
13
|
+
found = child;
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (child.children && child.children.length > 0) {
|
|
18
|
+
const result = getChild<T>(child.children, name) as T;
|
|
19
|
+
|
|
20
|
+
if (result) found = result;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return found;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { getChild };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ComponentRender } from '@zeedhi/common';
|
|
2
|
-
import { UserInfo } from '@zeedhi/zd-user-info-common';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Function used to spy on a class' onCreated and always assign the componentId as 1
|
|
5
|
+
*/
|
|
6
|
+
const mockCreated = <T extends ComponentRender>(component: T, prototype: any) => {
|
|
7
|
+
jest.spyOn(prototype, 'onCreated').mockImplementation(() => {
|
|
6
8
|
component.componentId = 1;
|
|
7
9
|
});
|
|
8
10
|
};
|