@zeedhi/zd-user-info-common 1.0.0 → 1.0.1
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 +3 -3
- package/types/index.d.ts +2 -0
- package/types/interfaces.d.ts +27 -0
- package/types/user-info.d.ts +134 -0
- package/coverage/clover.xml +0 -67
- package/coverage/coverage-final.json +0 -3
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -131
- package/coverage/lcov-report/index.ts.html +0 -91
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/user-info.ts.html +0 -793
- package/coverage/lcov.info +0 -101
- package/jest.config.js +0 -10
- package/tests/unit/user-info.spec.ts +0 -145
- package/tsconfig.eslint.json +0 -10
- package/types/tests/unit/user-info.spec.d.ts +0 -1
package/coverage/lcov.info
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
TN:
|
|
2
|
-
SF:src/index.ts
|
|
3
|
-
FNF:0
|
|
4
|
-
FNH:0
|
|
5
|
-
DA:1,1
|
|
6
|
-
DA:2,1
|
|
7
|
-
LF:2
|
|
8
|
-
LH:2
|
|
9
|
-
BRF:0
|
|
10
|
-
BRH:0
|
|
11
|
-
end_of_record
|
|
12
|
-
TN:
|
|
13
|
-
SF:src/user-info.ts
|
|
14
|
-
FN:121,(anonymous_0)
|
|
15
|
-
FN:152,(anonymous_1)
|
|
16
|
-
FN:176,(anonymous_2)
|
|
17
|
-
FN:190,(anonymous_3)
|
|
18
|
-
FN:200,(anonymous_4)
|
|
19
|
-
FN:208,(anonymous_5)
|
|
20
|
-
FN:212,(anonymous_6)
|
|
21
|
-
FNF:7
|
|
22
|
-
FNH:7
|
|
23
|
-
FNDA:4,(anonymous_0)
|
|
24
|
-
FNDA:3,(anonymous_1)
|
|
25
|
-
FNDA:3,(anonymous_2)
|
|
26
|
-
FNDA:1,(anonymous_3)
|
|
27
|
-
FNDA:1,(anonymous_4)
|
|
28
|
-
FNDA:1,(anonymous_5)
|
|
29
|
-
FNDA:1,(anonymous_6)
|
|
30
|
-
DA:1,1
|
|
31
|
-
DA:2,1
|
|
32
|
-
DA:5,1
|
|
33
|
-
DA:14,4
|
|
34
|
-
DA:19,4
|
|
35
|
-
DA:24,4
|
|
36
|
-
DA:29,4
|
|
37
|
-
DA:34,4
|
|
38
|
-
DA:39,4
|
|
39
|
-
DA:44,4
|
|
40
|
-
DA:49,4
|
|
41
|
-
DA:54,4
|
|
42
|
-
DA:59,4
|
|
43
|
-
DA:64,4
|
|
44
|
-
DA:69,4
|
|
45
|
-
DA:74,4
|
|
46
|
-
DA:79,4
|
|
47
|
-
DA:84,4
|
|
48
|
-
DA:89,4
|
|
49
|
-
DA:94,4
|
|
50
|
-
DA:99,4
|
|
51
|
-
DA:122,4
|
|
52
|
-
DA:123,4
|
|
53
|
-
DA:124,4
|
|
54
|
-
DA:125,4
|
|
55
|
-
DA:127,4
|
|
56
|
-
DA:128,4
|
|
57
|
-
DA:129,4
|
|
58
|
-
DA:130,4
|
|
59
|
-
DA:131,4
|
|
60
|
-
DA:132,4
|
|
61
|
-
DA:133,4
|
|
62
|
-
DA:134,4
|
|
63
|
-
DA:135,4
|
|
64
|
-
DA:136,4
|
|
65
|
-
DA:137,4
|
|
66
|
-
DA:138,4
|
|
67
|
-
DA:139,4
|
|
68
|
-
DA:141,4
|
|
69
|
-
DA:142,4
|
|
70
|
-
DA:143,4
|
|
71
|
-
DA:144,4
|
|
72
|
-
DA:145,4
|
|
73
|
-
DA:146,4
|
|
74
|
-
DA:147,4
|
|
75
|
-
DA:149,4
|
|
76
|
-
DA:153,3
|
|
77
|
-
DA:177,3
|
|
78
|
-
DA:190,1
|
|
79
|
-
DA:200,1
|
|
80
|
-
DA:209,1
|
|
81
|
-
DA:213,1
|
|
82
|
-
DA:217,1
|
|
83
|
-
LF:53
|
|
84
|
-
LH:53
|
|
85
|
-
BRDA:141,0,0,4
|
|
86
|
-
BRDA:141,0,1,3
|
|
87
|
-
BRDA:142,1,0,4
|
|
88
|
-
BRDA:142,1,1,3
|
|
89
|
-
BRDA:143,2,0,4
|
|
90
|
-
BRDA:143,2,1,3
|
|
91
|
-
BRDA:144,3,0,4
|
|
92
|
-
BRDA:144,3,1,3
|
|
93
|
-
BRDA:145,4,0,4
|
|
94
|
-
BRDA:145,4,1,3
|
|
95
|
-
BRDA:146,5,0,4
|
|
96
|
-
BRDA:146,5,1,3
|
|
97
|
-
BRDA:147,6,0,4
|
|
98
|
-
BRDA:147,6,1,4
|
|
99
|
-
BRF:14
|
|
100
|
-
BRH:14
|
|
101
|
-
end_of_record
|
package/jest.config.js
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { ListItem } from '@zeedhi/common';
|
|
2
|
-
import { UserInfo } from '../../src';
|
|
3
|
-
|
|
4
|
-
describe('UserInfo', () => {
|
|
5
|
-
describe('constructor()', () => {
|
|
6
|
-
it('when called, should assign the default values', () => {
|
|
7
|
-
const instance = new UserInfo({
|
|
8
|
-
name: 'UserInfo',
|
|
9
|
-
component: 'UserInfo',
|
|
10
|
-
});
|
|
11
|
-
expect(instance.activator).toEqual({
|
|
12
|
-
name: 'UserInfo_activator_tooltip',
|
|
13
|
-
component: 'ZdTooltip',
|
|
14
|
-
bottom: true,
|
|
15
|
-
label: '',
|
|
16
|
-
children: [
|
|
17
|
-
{
|
|
18
|
-
name: 'UserInfo_activator',
|
|
19
|
-
component: 'ZdAvatar',
|
|
20
|
-
avatarSlot: [
|
|
21
|
-
{
|
|
22
|
-
name: 'UserInfo_image',
|
|
23
|
-
component: 'ZdImage',
|
|
24
|
-
src: '',
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
});
|
|
30
|
-
expect(instance.bottomSlot).toEqual([]);
|
|
31
|
-
expect(instance.headerSlot).toEqual([]);
|
|
32
|
-
expect(instance.avatarProps).toEqual({});
|
|
33
|
-
expect(instance.imageProps).toEqual({});
|
|
34
|
-
expect(instance.centerSlot).toMatchObject([{
|
|
35
|
-
component: 'ZdList',
|
|
36
|
-
items: [{ component: 'ZdListItem' }, { component: 'ZdListItem' }],
|
|
37
|
-
},
|
|
38
|
-
]);
|
|
39
|
-
expect(instance.showProfileChange).toBeTruthy();
|
|
40
|
-
expect(instance.topSlot).toEqual([]);
|
|
41
|
-
expect(instance.user).toBe('');
|
|
42
|
-
expect(instance.userImage).toBe('');
|
|
43
|
-
expect(instance.closeOnClick).toBeTruthy();
|
|
44
|
-
expect(instance.closeOnContentClick).toBeTruthy();
|
|
45
|
-
expect(instance.fixed).toBeFalsy();
|
|
46
|
-
expect(instance.offsetX).toBeFalsy();
|
|
47
|
-
expect(instance.offsetY).toBeTruthy();
|
|
48
|
-
expect(instance.openOnClick).toBeTruthy();
|
|
49
|
-
expect(instance.openOnHover).toBeFalsy();
|
|
50
|
-
expect(instance.value).toBeFalsy();
|
|
51
|
-
expect(instance.height).toBe('auto');
|
|
52
|
-
expect(instance.maxHeight).toBeUndefined();
|
|
53
|
-
expect(instance.minHeight).toBeUndefined();
|
|
54
|
-
expect(instance.maxWidth).toBeUndefined();
|
|
55
|
-
expect(instance.minWidth).toBeUndefined();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('when called with props, should assign the new values', () => {
|
|
59
|
-
const instance = new UserInfo({
|
|
60
|
-
name: 'UserInfo',
|
|
61
|
-
component: 'UserInfo',
|
|
62
|
-
activator: { name: 'activator', component: 'ZdText' },
|
|
63
|
-
avatarProps: { size: 62 },
|
|
64
|
-
imageProps: { height: '100px' },
|
|
65
|
-
bottomSlot: [{ name: 'bottom', component: 'ZdText' }],
|
|
66
|
-
centerSlot: [{ name: 'center', component: 'ZdText' }],
|
|
67
|
-
showProfileChange: false,
|
|
68
|
-
topSlot: [{ name: 'top', component: 'ZdText' }],
|
|
69
|
-
user: 'zeedhi',
|
|
70
|
-
userImage: 'image',
|
|
71
|
-
closeOnClick: false,
|
|
72
|
-
closeOnContentClick: false,
|
|
73
|
-
fixed: true,
|
|
74
|
-
offsetX: true,
|
|
75
|
-
offsetY: false,
|
|
76
|
-
openOnClick: false,
|
|
77
|
-
openOnHover: true,
|
|
78
|
-
value: true,
|
|
79
|
-
height: '300px',
|
|
80
|
-
maxHeight: '300px',
|
|
81
|
-
minHeight: '300px',
|
|
82
|
-
maxWidth: '300px',
|
|
83
|
-
minWidth: '300px',
|
|
84
|
-
});
|
|
85
|
-
expect(instance.activator).toEqual({ name: 'activator', component: 'ZdText' });
|
|
86
|
-
expect(instance.bottomSlot).toEqual([{ name: 'bottom', component: 'ZdText' }]);
|
|
87
|
-
expect(instance.centerSlot).toEqual([{ name: 'center', component: 'ZdText' }]);
|
|
88
|
-
expect(instance.showProfileChange).toBeFalsy();
|
|
89
|
-
expect(instance.topSlot).toEqual([{ name: 'top', component: 'ZdText' }]);
|
|
90
|
-
expect(instance.user).toBe('zeedhi');
|
|
91
|
-
expect(instance.userImage).toBe('image');
|
|
92
|
-
expect(instance.closeOnClick).toBeFalsy();
|
|
93
|
-
expect(instance.closeOnContentClick).toBeFalsy();
|
|
94
|
-
expect(instance.fixed).toBeTruthy();
|
|
95
|
-
expect(instance.offsetX).toBeTruthy();
|
|
96
|
-
expect(instance.offsetY).toBeFalsy();
|
|
97
|
-
expect(instance.openOnClick).toBeFalsy();
|
|
98
|
-
expect(instance.openOnHover).toBeTruthy();
|
|
99
|
-
expect(instance.value).toBeTruthy();
|
|
100
|
-
expect(instance.avatarProps).toEqual({ size: 62 });
|
|
101
|
-
expect(instance.imageProps).toEqual({ height: '100px' });
|
|
102
|
-
expect(instance.height).toBe('300px');
|
|
103
|
-
expect(instance.maxHeight).toBe('300px');
|
|
104
|
-
expect(instance.minHeight).toBe('300px');
|
|
105
|
-
expect(instance.maxWidth).toBe('300px');
|
|
106
|
-
expect(instance.minWidth).toBe('300px');
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
describe('events', () => {
|
|
111
|
-
it('when change profile button is clicked, should call onProfileChange', () => {
|
|
112
|
-
const fn = jest.fn();
|
|
113
|
-
const instance = new UserInfo({
|
|
114
|
-
name: 'UserInfo',
|
|
115
|
-
component: 'UserInfo',
|
|
116
|
-
events: {
|
|
117
|
-
onProfileChange: fn,
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
const item = new ListItem({ ...instance.centerSlot[0].items[0] });
|
|
121
|
-
const event = new MouseEvent('click');
|
|
122
|
-
const element = {} as HTMLElement;
|
|
123
|
-
item.click(event, element);
|
|
124
|
-
|
|
125
|
-
expect(fn).toHaveBeenCalledWith({ event, element, component: instance });
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it('when logout button is clicked, should call onLogoutClick', () => {
|
|
129
|
-
const fn = jest.fn();
|
|
130
|
-
const instance = new UserInfo({
|
|
131
|
-
name: 'UserInfo',
|
|
132
|
-
component: 'UserInfo',
|
|
133
|
-
events: {
|
|
134
|
-
onLogoutClick: fn,
|
|
135
|
-
},
|
|
136
|
-
});
|
|
137
|
-
const item = new ListItem({ ...instance.centerSlot[0].items[1] });
|
|
138
|
-
const event = new MouseEvent('click');
|
|
139
|
-
const element = {} as HTMLElement;
|
|
140
|
-
item.click(event, element);
|
|
141
|
-
|
|
142
|
-
expect(fn).toHaveBeenCalledWith({ event, element, component: instance });
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
});
|
package/tsconfig.eslint.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|