@zeedhi/zd-user-info-common 1.0.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.
@@ -0,0 +1,101 @@
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
@@ -0,0 +1,176 @@
1
+ import { ComponentRender } from '@zeedhi/common';
2
+ import { Messages } from '@zeedhi/core';
3
+
4
+ class UserInfo extends ComponentRender {
5
+ constructor(props) {
6
+ super(props);
7
+ /**
8
+ * Props to be passed to the ZdAvatar component
9
+ */
10
+ this.avatarProps = {};
11
+ /**
12
+ * Components to be rendered on the bottom slot
13
+ */
14
+ this.bottomSlot = [];
15
+ /**
16
+ * Components to be rendered on the center slot
17
+ */
18
+ this.centerSlot = [];
19
+ /**
20
+ * Show the profile change option
21
+ */
22
+ this.showProfileChange = true;
23
+ /**
24
+ * Components to be rendered on the top slot
25
+ */
26
+ this.topSlot = [];
27
+ /**
28
+ * User name
29
+ */
30
+ this.user = '';
31
+ /**
32
+ * User image
33
+ */
34
+ this.userImage = '';
35
+ /**
36
+ * Designates if menu should close on outside-activator click.
37
+ */
38
+ this.closeOnClick = true;
39
+ /**
40
+ * Designates if menu should close when its content is clicked.
41
+ */
42
+ this.closeOnContentClick = true;
43
+ /**
44
+ * Applies position fixed to the dropdown.
45
+ */
46
+ this.fixed = false;
47
+ /**
48
+ * Components to be rendered on the menu header
49
+ */
50
+ this.headerSlot = [];
51
+ /**
52
+ * Props to be passed to the ZdImage component (rendered inside the avatar)
53
+ */
54
+ this.imageProps = {};
55
+ /**
56
+ * Offset the menu on the x-axis.
57
+ */
58
+ this.offsetX = false;
59
+ /**
60
+ * Offset the menu on the x-axis.
61
+ */
62
+ this.offsetY = true;
63
+ /**
64
+ * Designates whether menu should open on activator click.
65
+ */
66
+ this.openOnClick = true;
67
+ /**
68
+ * Designates whether menu should open on activator hover.
69
+ */
70
+ this.openOnHover = false;
71
+ /**
72
+ * Controls whether the component is visible or hidden.
73
+ */
74
+ this.value = false;
75
+ /**
76
+ * Sets the height for the dropdown.
77
+ */
78
+ this.height = 'auto';
79
+ this.showProfileChange = this.getInitValue('showProfileChange', props.showProfileChange, this.showProfileChange);
80
+ this.user = this.getInitValue('user', props.user, this.user);
81
+ this.userImage = this.getInitValue('userImage', props.userImage, this.userImage);
82
+ this.closeOnClick = this.getInitValue('closeOnClick', props.closeOnClick, this.closeOnClick);
83
+ this.closeOnContentClick = this.getInitValue('closeOnContentClick', props.closeOnContentClick, this.closeOnContentClick);
84
+ this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
85
+ this.offsetX = this.getInitValue('offsetX', props.offsetX, this.offsetX);
86
+ this.offsetY = this.getInitValue('offsetY', props.offsetY, this.offsetY);
87
+ this.openOnClick = this.getInitValue('openOnClick', props.openOnClick, this.openOnClick);
88
+ this.openOnHover = this.getInitValue('openOnHover', props.openOnHover, this.openOnHover);
89
+ this.value = this.getInitValue('value', props.value, this.value);
90
+ this.height = this.getInitValue('height', props.height, this.height);
91
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
92
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
93
+ this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
94
+ this.minWidth = this.getInitValue('minWidth', props.minWidth, this.minWidth);
95
+ this.avatarProps = props.avatarProps || this.avatarProps;
96
+ this.imageProps = props.imageProps || this.imageProps;
97
+ this.activator = props.activator || this.getActivator();
98
+ this.bottomSlot = props.bottomSlot || this.bottomSlot;
99
+ this.centerSlot = props.centerSlot || this.getCenterSlot();
100
+ this.topSlot = props.topSlot || this.topSlot;
101
+ this.headerSlot = props.headerSlot || this.headerSlot;
102
+ this.createAccessors();
103
+ }
104
+ getActivator() {
105
+ return {
106
+ name: `${this.name}_activator_tooltip`,
107
+ component: 'ZdTooltip',
108
+ bottom: true,
109
+ label: this.user,
110
+ children: [
111
+ Object.assign({ name: `${this.name}_activator`, component: 'ZdAvatar', avatarSlot: [
112
+ Object.assign({ name: `${this.name}_image`, component: 'ZdImage', src: this.userImage }, this.imageProps),
113
+ ] }, this.avatarProps),
114
+ ],
115
+ };
116
+ }
117
+ getCenterSlot() {
118
+ return [
119
+ {
120
+ name: `${this.name}_center_list`,
121
+ component: 'ZdList',
122
+ dense: true,
123
+ items: [
124
+ {
125
+ name: `${this.name}_change_profile`,
126
+ component: 'ZdListItem',
127
+ title: 'USERINFO_CHANGE_PROFILE',
128
+ prependIcon: 'mdi-account',
129
+ cssClass: 'zd-px-2',
130
+ events: {
131
+ click: ({ event, element }) => this.onProfileChange(event, element),
132
+ },
133
+ },
134
+ {
135
+ name: `${this.name}_logout`,
136
+ component: 'ZdListItem',
137
+ title: 'USERINFO_LOGOUT',
138
+ prependIcon: 'mdi-logout-variant',
139
+ cssClass: 'zd-px-2',
140
+ events: {
141
+ click: ({ event, element }) => this.onLogoutClick(event, element),
142
+ },
143
+ },
144
+ ],
145
+ },
146
+ ];
147
+ }
148
+ onLogoutClick(event, element) {
149
+ this.callEvent('onLogoutClick', { event, element, component: this });
150
+ }
151
+ onProfileChange(event, element) {
152
+ this.callEvent('onProfileChange', { event, element, component: this });
153
+ }
154
+ }
155
+ Messages.add({
156
+ 'pt-BR': {
157
+ translation: {
158
+ USERINFO_CHANGE_PROFILE: 'Alterar perfil',
159
+ USERINFO_LOGOUT: 'Sair',
160
+ },
161
+ },
162
+ 'en-US': {
163
+ translation: {
164
+ USERINFO_CHANGE_PROFILE: 'Change profile',
165
+ USERINFO_LOGOUT: 'Sign out',
166
+ },
167
+ },
168
+ 'es-ES': {
169
+ translation: {
170
+ USERINFO_CHANGE_PROFILE: 'Cambiar el perfil',
171
+ USERINFO_LOGOUT: 'Salir',
172
+ },
173
+ },
174
+ });
175
+
176
+ export { UserInfo };
@@ -0,0 +1,183 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@zeedhi/common'), require('@zeedhi/core')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@zeedhi/common', '@zeedhi/core'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@zeedhi/zd-user-info-common"] = {}, global["@zeedhi/common"], global["@zeedhi/core"]));
5
+ })(this, (function (exports, common, core) { 'use strict';
6
+
7
+ class UserInfo extends common.ComponentRender {
8
+ constructor(props) {
9
+ super(props);
10
+ /**
11
+ * Props to be passed to the ZdAvatar component
12
+ */
13
+ this.avatarProps = {};
14
+ /**
15
+ * Components to be rendered on the bottom slot
16
+ */
17
+ this.bottomSlot = [];
18
+ /**
19
+ * Components to be rendered on the center slot
20
+ */
21
+ this.centerSlot = [];
22
+ /**
23
+ * Show the profile change option
24
+ */
25
+ this.showProfileChange = true;
26
+ /**
27
+ * Components to be rendered on the top slot
28
+ */
29
+ this.topSlot = [];
30
+ /**
31
+ * User name
32
+ */
33
+ this.user = '';
34
+ /**
35
+ * User image
36
+ */
37
+ this.userImage = '';
38
+ /**
39
+ * Designates if menu should close on outside-activator click.
40
+ */
41
+ this.closeOnClick = true;
42
+ /**
43
+ * Designates if menu should close when its content is clicked.
44
+ */
45
+ this.closeOnContentClick = true;
46
+ /**
47
+ * Applies position fixed to the dropdown.
48
+ */
49
+ this.fixed = false;
50
+ /**
51
+ * Components to be rendered on the menu header
52
+ */
53
+ this.headerSlot = [];
54
+ /**
55
+ * Props to be passed to the ZdImage component (rendered inside the avatar)
56
+ */
57
+ this.imageProps = {};
58
+ /**
59
+ * Offset the menu on the x-axis.
60
+ */
61
+ this.offsetX = false;
62
+ /**
63
+ * Offset the menu on the x-axis.
64
+ */
65
+ this.offsetY = true;
66
+ /**
67
+ * Designates whether menu should open on activator click.
68
+ */
69
+ this.openOnClick = true;
70
+ /**
71
+ * Designates whether menu should open on activator hover.
72
+ */
73
+ this.openOnHover = false;
74
+ /**
75
+ * Controls whether the component is visible or hidden.
76
+ */
77
+ this.value = false;
78
+ /**
79
+ * Sets the height for the dropdown.
80
+ */
81
+ this.height = 'auto';
82
+ this.showProfileChange = this.getInitValue('showProfileChange', props.showProfileChange, this.showProfileChange);
83
+ this.user = this.getInitValue('user', props.user, this.user);
84
+ this.userImage = this.getInitValue('userImage', props.userImage, this.userImage);
85
+ this.closeOnClick = this.getInitValue('closeOnClick', props.closeOnClick, this.closeOnClick);
86
+ this.closeOnContentClick = this.getInitValue('closeOnContentClick', props.closeOnContentClick, this.closeOnContentClick);
87
+ this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
88
+ this.offsetX = this.getInitValue('offsetX', props.offsetX, this.offsetX);
89
+ this.offsetY = this.getInitValue('offsetY', props.offsetY, this.offsetY);
90
+ this.openOnClick = this.getInitValue('openOnClick', props.openOnClick, this.openOnClick);
91
+ this.openOnHover = this.getInitValue('openOnHover', props.openOnHover, this.openOnHover);
92
+ this.value = this.getInitValue('value', props.value, this.value);
93
+ this.height = this.getInitValue('height', props.height, this.height);
94
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
95
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
96
+ this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
97
+ this.minWidth = this.getInitValue('minWidth', props.minWidth, this.minWidth);
98
+ this.avatarProps = props.avatarProps || this.avatarProps;
99
+ this.imageProps = props.imageProps || this.imageProps;
100
+ this.activator = props.activator || this.getActivator();
101
+ this.bottomSlot = props.bottomSlot || this.bottomSlot;
102
+ this.centerSlot = props.centerSlot || this.getCenterSlot();
103
+ this.topSlot = props.topSlot || this.topSlot;
104
+ this.headerSlot = props.headerSlot || this.headerSlot;
105
+ this.createAccessors();
106
+ }
107
+ getActivator() {
108
+ return {
109
+ name: `${this.name}_activator_tooltip`,
110
+ component: 'ZdTooltip',
111
+ bottom: true,
112
+ label: this.user,
113
+ children: [
114
+ Object.assign({ name: `${this.name}_activator`, component: 'ZdAvatar', avatarSlot: [
115
+ Object.assign({ name: `${this.name}_image`, component: 'ZdImage', src: this.userImage }, this.imageProps),
116
+ ] }, this.avatarProps),
117
+ ],
118
+ };
119
+ }
120
+ getCenterSlot() {
121
+ return [
122
+ {
123
+ name: `${this.name}_center_list`,
124
+ component: 'ZdList',
125
+ dense: true,
126
+ items: [
127
+ {
128
+ name: `${this.name}_change_profile`,
129
+ component: 'ZdListItem',
130
+ title: 'USERINFO_CHANGE_PROFILE',
131
+ prependIcon: 'mdi-account',
132
+ cssClass: 'zd-px-2',
133
+ events: {
134
+ click: ({ event, element }) => this.onProfileChange(event, element),
135
+ },
136
+ },
137
+ {
138
+ name: `${this.name}_logout`,
139
+ component: 'ZdListItem',
140
+ title: 'USERINFO_LOGOUT',
141
+ prependIcon: 'mdi-logout-variant',
142
+ cssClass: 'zd-px-2',
143
+ events: {
144
+ click: ({ event, element }) => this.onLogoutClick(event, element),
145
+ },
146
+ },
147
+ ],
148
+ },
149
+ ];
150
+ }
151
+ onLogoutClick(event, element) {
152
+ this.callEvent('onLogoutClick', { event, element, component: this });
153
+ }
154
+ onProfileChange(event, element) {
155
+ this.callEvent('onProfileChange', { event, element, component: this });
156
+ }
157
+ }
158
+ core.Messages.add({
159
+ 'pt-BR': {
160
+ translation: {
161
+ USERINFO_CHANGE_PROFILE: 'Alterar perfil',
162
+ USERINFO_LOGOUT: 'Sair',
163
+ },
164
+ },
165
+ 'en-US': {
166
+ translation: {
167
+ USERINFO_CHANGE_PROFILE: 'Change profile',
168
+ USERINFO_LOGOUT: 'Sign out',
169
+ },
170
+ },
171
+ 'es-ES': {
172
+ translation: {
173
+ USERINFO_CHANGE_PROFILE: 'Cambiar el perfil',
174
+ USERINFO_LOGOUT: 'Salir',
175
+ },
176
+ },
177
+ });
178
+
179
+ exports.UserInfo = UserInfo;
180
+
181
+ Object.defineProperty(exports, '__esModule', { value: true });
182
+
183
+ }));
package/jest.config.js ADDED
@@ -0,0 +1,10 @@
1
+ module.exports = {
2
+ preset: 'ts-jest',
3
+ testEnvironment: 'jsdom',
4
+ verbose: true,
5
+ collectCoverage: true,
6
+ moduleNameMapper: {
7
+ "\.(css|less)$": "<rootDir>/../../styleMock.js",
8
+ }
9
+ };
10
+
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@zeedhi/zd-user-info-common",
3
+ "version": "1.0.0",
4
+ "description": "Implementation of UserInfo componente using Zeedhi Next",
5
+ "main": "dist/user-info-common.umd.js",
6
+ "module": "dist/user-info-common.esm.js",
7
+ "typings": "types/src/index.d.ts",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "scripts": {
12
+ "build": "rollup -c",
13
+ "lint": "eslint . --fix --ext .ts",
14
+ "test": "jest",
15
+ "watch": "npm run build -- -w"
16
+ },
17
+ "devDependencies": {
18
+ "@types/jest": "^26.0.19",
19
+ "jest": "^26.6.3",
20
+ "ts-jest": "^26.4.4"
21
+ },
22
+ "peerDependencies": {
23
+ "@zeedhi/common": "*",
24
+ "@zeedhi/core": "*"
25
+ },
26
+ "gitHead": "27e18bb3b09807d56dd5823a827f18b50b74da3c"
27
+ }
@@ -0,0 +1,145 @@
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
+ });
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "include": [
4
+ "./src/**/*.ts",
5
+ "./tests/**/*.ts"
6
+ ],
7
+ "exclude": [
8
+ "node_modules"
9
+ ]
10
+ }
@@ -0,0 +1 @@
1
+ export {};