@laerdal/life-react-components 6.0.0-dev.10.full → 6.0.0-dev.12.full

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.
Files changed (58) hide show
  1. package/dist/Accordion/__tests__/AccordionMenu.test.tsx +42 -0
  2. package/dist/Accordion/__tests__/ContentAccordion.test.tsx +150 -0
  3. package/dist/AuthPage/__tests__/AuthPage.test.tsx +27 -0
  4. package/dist/Banners/__tests__/Banner.test.tsx +47 -0
  5. package/dist/Banners/__tests__/OverviewBanner.test.tsx +20 -0
  6. package/dist/Breadcrumb/__tests__/Breadcrumb.test.tsx +78 -0
  7. package/dist/Button/__tests__/BackButton.test.tsx +32 -0
  8. package/dist/Button/__tests__/Button.test.tsx +45 -0
  9. package/dist/Button/__tests__/DualButton.test.tsx +119 -0
  10. package/dist/Card/HorizontalCard/__tests__/HorizontalCard.test.tsx +71 -0
  11. package/dist/Card/HorizontalCard/__tests__/VerticalCard.test.tsx +124 -0
  12. package/dist/Card/__tests__/Card.test.tsx +146 -0
  13. package/dist/Chips/__tests__/ActionChip.test.tsx +94 -0
  14. package/dist/Chips/__tests__/ChoiceChips.test.tsx +79 -0
  15. package/dist/Chips/__tests__/FilterChip.test.tsx +95 -0
  16. package/dist/Chips/__tests__/InputChip.test.tsx +155 -0
  17. package/dist/ChipsInput/__tests__/ChipDropdownInput.test.tsx +100 -0
  18. package/dist/ChipsInput/__tests__/ChipInputFields.test.tsx +155 -0
  19. package/dist/Dropdown/__tests__/DropdownFilter.test.tsx +39 -0
  20. package/dist/Footer/__tests__/Footer.test.tsx +182 -0
  21. package/dist/GlobalNavigationBar/__tests__/Logo.test.tsx +39 -0
  22. package/dist/GlobalNavigationBar/desktop/__tests__/DesktopActions.test.tsx +108 -0
  23. package/dist/GlobalNavigationBar/desktop/__tests__/ExtendedMainMenu.test.tsx +28 -0
  24. package/dist/GlobalNavigationBar/desktop/__tests__/MainMenu.test.tsx +55 -0
  25. package/dist/GlobalNavigationBar/desktop/__tests__/RightSideNav.test.tsx +45 -0
  26. package/dist/GlobalNavigationBar/desktop/__tests__/UserMenu.test.tsx +125 -0
  27. package/dist/GlobalNavigationBar/mobile/__tests__/MobileMenu.test.tsx +317 -0
  28. package/dist/GlobalNavigationBar/mobile/__tests__/MobileMenuContent.test.tsx +294 -0
  29. package/dist/GlobalNavigationBar/mobile/__tests__/MobileMenuHeader.test.tsx +195 -0
  30. package/dist/InputFields/__tests__/NumberField.test.tsx +67 -0
  31. package/dist/InputFields/__tests__/NumberInput.test.tsx +68 -0
  32. package/dist/InputFields/__tests__/QuickSearch.test.tsx +42 -0
  33. package/dist/LinearProgress/__tests__/LinearProgress.test.tsx +25 -0
  34. package/dist/List/__tests__/ListRow.test.tsx +18 -0
  35. package/dist/LoadingPage/__tests__/GlobalLoadingPage.test.tsx +23 -0
  36. package/dist/Modals/__tests__/Modal.test.tsx +169 -0
  37. package/dist/Modals/__tests__/ModalContainer.test.tsx +77 -0
  38. package/dist/Modals/__tests__/ModalContent.test.tsx +126 -0
  39. package/dist/NavItem/__tests__/NavItem.test.ts +6 -0
  40. package/dist/NotificationDot/__tests__/NotificationDot.test.tsx +33 -0
  41. package/dist/Paginator/__tests__/Paginator.test.tsx +39 -0
  42. package/dist/Popover/__tests__/Popover.test.tsx +64 -0
  43. package/dist/ProfileButton/__tests__/ProfileButton.test.tsx +31 -0
  44. package/dist/QuizButton/__tests__/QuizButton.test.tsx +53 -0
  45. package/dist/SegmentControl/__tests__/SegmentControl.test.tsx +145 -0
  46. package/dist/SideMenu/__tests__/SideMenu.test.tsx +99 -0
  47. package/dist/Switcher/__tests__/SwitcherMenuItem.tsx +14 -0
  48. package/dist/Table/__tests__/Table.test.tsx +499 -0
  49. package/dist/Tabs/__tests__/HorizontalTabs.test.tsx +95 -0
  50. package/dist/Tabs/__tests__/TabLink.test.tsx +40 -0
  51. package/dist/Tabs/__tests__/Tablist.test.tsx +37 -0
  52. package/dist/Tag/__tests__/Tag.test.tsx +86 -0
  53. package/dist/Toasters/__tests__/Toast.test.tsx +74 -0
  54. package/dist/Toggles/__tests__/ToggleButton.test.tsx +53 -0
  55. package/dist/Toggles/__tests__/ToggleSwitch.test.tsx +87 -0
  56. package/dist/Tooltips/__tests__/TooltipWrapper.test.tsx +16 -0
  57. package/dist/styles/react-datepicker.css +766 -0
  58. package/package.json +4 -3
@@ -0,0 +1,108 @@
1
+ import * as React from 'react';
2
+ import DesktopActions, {DesktopActionsRef} from '../DesktopActions';
3
+ import {act, render} from '../../../test-utils';
4
+ import {DesktopMenuButtonTypes} from '../../types';
5
+ import {SystemIcons} from '../../../icons';
6
+ import {IconButtonStyled} from '../../../Button/Iconbutton';
7
+ import {ProfileButtonContainer} from '../../../ProfileButton/ProfileButton';
8
+
9
+ describe('DesktopActions', () => {
10
+ const profileSpy = jest.fn();
11
+ const actionSpy = jest.fn();
12
+ const switcherSpy = jest.fn();
13
+ const showSubMenuSpy = jest.fn();
14
+
15
+ const profile: DesktopMenuButtonTypes = {
16
+ type: 'profile',
17
+ action: profileSpy,
18
+ };
19
+
20
+ const action: DesktopMenuButtonTypes = {
21
+ type: 'action',
22
+ action: actionSpy,
23
+ icon: <SystemIcons.Search/>,
24
+ };
25
+
26
+ const switcher: DesktopMenuButtonTypes = {
27
+ type: 'switcher',
28
+ action: switcherSpy,
29
+ };
30
+
31
+
32
+ it('should render profile button', () => {
33
+ const wrapper = render(<DesktopActions buttons={[profile]} onShowUserMenu={showSubMenuSpy}/>)
34
+
35
+ expect(wrapper.container.querySelectorAll(`${ProfileButtonContainer}`)).toHaveLength(1);
36
+ });
37
+
38
+ it('should render action button', () => {
39
+ const wrapper = render(<DesktopActions buttons={[action]} onShowUserMenu={showSubMenuSpy}/>)
40
+
41
+ expect(wrapper.container.querySelectorAll(`${IconButtonStyled}`)).toHaveLength(1);
42
+ });
43
+
44
+ it('should render switcher button', () => {
45
+ const wrapper = render(<DesktopActions buttons={[switcher]} onShowUserMenu={showSubMenuSpy}/>)
46
+
47
+ expect(wrapper.container.querySelectorAll(`#globalNavAppsButton`)).toHaveLength(1);
48
+ });
49
+
50
+ it('should call profile action on profile button click', () => {
51
+ const wrapper = render(<DesktopActions buttons={[profile]} onShowUserMenu={showSubMenuSpy}/>)
52
+
53
+ act(() => {
54
+ wrapper.container.querySelector('button')!.click();
55
+ });
56
+
57
+ expect(profileSpy).toHaveBeenCalled();
58
+ });
59
+
60
+ it('should call on sub menu open when action is not specified on profile button click', () => {
61
+ const wrapper = render(<DesktopActions buttons={[{...profile, action: undefined}]}
62
+ onShowUserMenu={showSubMenuSpy}/>)
63
+
64
+ act(() => {
65
+ wrapper.container.querySelector('button')!.click();
66
+ });
67
+
68
+ expect(showSubMenuSpy).toHaveBeenCalled();
69
+ });
70
+
71
+ it('should call action on action button click', () => {
72
+ const wrapper = render(<DesktopActions buttons={[action]} onShowUserMenu={showSubMenuSpy}/>)
73
+
74
+ act(() => {
75
+ wrapper.container.querySelector('button')!.click();
76
+ });
77
+
78
+ expect(actionSpy).toHaveBeenCalled();
79
+ });
80
+
81
+ it('should call switcher action on switcher button click', () => {
82
+ const wrapper = render(<DesktopActions buttons={[switcher]} onShowUserMenu={showSubMenuSpy}/>)
83
+
84
+ act(() => {
85
+ wrapper.container.querySelector('button')!.click();
86
+ });
87
+
88
+ expect(switcherSpy).toHaveBeenCalled();
89
+ });
90
+
91
+
92
+ it('should not throw exceptions when buttons are removed', async () => {
93
+ const actionsRef = React.createRef<DesktopActionsRef>();
94
+
95
+ const wrapper = render(<DesktopActions ref={actionsRef}
96
+ buttons={[switcher, profile, action]}
97
+ onShowUserMenu={showSubMenuSpy}/>)
98
+
99
+ wrapper.rerender(<DesktopActions ref={actionsRef}
100
+ buttons={[]}
101
+ onShowUserMenu={showSubMenuSpy}/>)
102
+
103
+ expect(wrapper.container.querySelectorAll(`#globalNavAppsButton`)).toHaveLength(0);
104
+ expect(wrapper.container.querySelectorAll(`${ProfileButtonContainer}`)).toHaveLength(0);
105
+ expect(wrapper.container.querySelectorAll(`${IconButtonStyled}`)).toHaveLength(0);
106
+ });
107
+
108
+ });
@@ -0,0 +1,28 @@
1
+ import * as React from 'react';
2
+ import {MenuNavigationItemTypeItem} from '../../types';
3
+ import {render} from '../../../test-utils';
4
+ import ExtendedMainMenu from '../ExtendedMainMenu';
5
+ import { NavigationProvider } from '../../../Navigation';
6
+
7
+ describe('ExtendedMainMenu', () => {
8
+ const menuClickSpy = jest.fn();
9
+ const items = [{
10
+ label: 'item1',
11
+ to: '#1'
12
+ },
13
+ {
14
+ label: 'item2',
15
+ to: '#2'
16
+ }] as MenuNavigationItemTypeItem[];
17
+
18
+ it('should render items', () => {
19
+
20
+ const wrapper = render(
21
+ <NavigationProvider currentPath='' isActiveRoute={() => false} navigate={(path: string, isExternal: boolean) => {}}>
22
+ <ExtendedMainMenu clickMenuAction={menuClickSpy} navigationOptions={items}/>
23
+ </NavigationProvider>);
24
+
25
+ expect(wrapper.getByText('item1')).toBeDefined();
26
+ expect(wrapper.getByText('item2')).toBeDefined();
27
+ });
28
+ });
@@ -0,0 +1,55 @@
1
+ import * as React from 'react';
2
+ import {MenuNavigationItemTypeItem} from '../../types';
3
+ import {fireEvent, render} from '../../../test-utils';
4
+ import {IconButtonStyled} from '../../../Button/Iconbutton';
5
+ import MainMenu from '../MainMenu';
6
+ import { act } from "react";
7
+ import { NavigationProvider } from '../../../Navigation';
8
+
9
+
10
+ describe('MainMenu', () => {
11
+ const menuClickSpy = jest.fn();
12
+ const navProps = {
13
+ currentPath: '',
14
+ isActiveRoute: () => false,
15
+ navigate: (path: string, isExternal: boolean) => {}
16
+ };
17
+
18
+ const items = [{
19
+ label: 'item1',
20
+ to: '#1'
21
+ },
22
+ {
23
+ label: 'item2',
24
+ to: '#2'
25
+ }] as MenuNavigationItemTypeItem[];
26
+
27
+ it('should render items', () => {
28
+ const wrapper = render(<NavigationProvider {...navProps}><MainMenu rightSideRef={{current: {offsetLeft: 10000}} as any} items={items}/></NavigationProvider>);
29
+
30
+ expect(wrapper.getByText('item1')).toBeDefined();
31
+ expect(wrapper.getByText('item2')).toBeDefined();
32
+ });
33
+
34
+ it('should not show extended menu if width is enough', () => {
35
+ const wrapper = render(
36
+ <NavigationProvider {...navProps}>
37
+ <MainMenu items={items} rightSideRef={{current: {offsetLeft: 10000}} as any}/>
38
+ </NavigationProvider>
39
+ );
40
+
41
+ act(() => {
42
+ global.dispatchEvent(new Event('resize'));
43
+ })
44
+
45
+ expect(wrapper.container.querySelectorAll(`${IconButtonStyled}`)).toHaveLength(0);
46
+ });
47
+
48
+ it('should show extended menu if width is not enough', () => {
49
+ const wrapper = render(<NavigationProvider {...navProps}><MainMenu rightSideRef={{current: {offsetLeft: 0}} as any}
50
+ items={items}/></NavigationProvider>);
51
+
52
+ expect(wrapper.container.querySelectorAll(`${IconButtonStyled}`)).toHaveLength(1);
53
+ });
54
+
55
+ });
@@ -0,0 +1,45 @@
1
+ import * as React from 'react';
2
+ import {MenuNavigationItemTypeItem} from '../../types';
3
+ import {render} from '../../../test-utils';
4
+ import ExtendedMainMenu from '../ExtendedMainMenu';
5
+ import {IconButtonStyled} from '../../../Button/Iconbutton';
6
+ import MainMenu from '../MainMenu';
7
+ import RightSideNav from '../RightSideNav';
8
+ import { NavigationProvider } from '../../../Navigation';
9
+
10
+ describe('RightSideNav', () => {
11
+
12
+ const navProps = {
13
+ currentPath: '',
14
+ isActiveRoute: () => false,
15
+ navigate: (path: string, isExternal: boolean) => {}
16
+ };
17
+
18
+
19
+ const items = [{
20
+ label: 'item1',
21
+ to: '#1'
22
+ },
23
+ {
24
+ label: 'item2',
25
+ to: '#2'
26
+ }] as MenuNavigationItemTypeItem[];
27
+
28
+ it('should render items', () => {
29
+ const wrapper = render(<NavigationProvider {...navProps}><RightSideNav items={items}/></NavigationProvider>);
30
+
31
+ expect(wrapper.getByText('item1')).toBeDefined();
32
+ expect(wrapper.getByText('item2')).toBeDefined();
33
+ });
34
+
35
+ it('should render action', () => {
36
+ const wrapper = render(
37
+ <NavigationProvider {...navProps}>
38
+ <RightSideNav items={[]}
39
+ action={{label: 'label', action: jest.fn()}}/>
40
+ </NavigationProvider>);
41
+
42
+ expect(wrapper.getByText('label')).toBeDefined();
43
+ });
44
+
45
+ });
@@ -0,0 +1,125 @@
1
+ import * as React from 'react';
2
+ import UserMenu from '../UserMenu';
3
+ import {act, fireEvent, render} from '../../../test-utils';
4
+ import {ProfileMenu} from '../../types';
5
+ import {ProfileButtonContainer} from '../../../ProfileButton/ProfileButton';
6
+ import { NavigationProvider } from '../../../Navigation/NavigationProvider';
7
+
8
+
9
+
10
+ describe('UserMenu', () => {
11
+
12
+ const navProps = {
13
+ currentPath: '',
14
+ isActiveRoute: () => false,
15
+ navigate: (path: string, isExternal: boolean) => {}
16
+ };
17
+
18
+ it('should render profile icon', function () {
19
+ const props: ProfileMenu = {
20
+ user: {
21
+ firstName: 'John',
22
+ lastName: 'Doe',
23
+ email: 'email'
24
+ },
25
+ sections: []
26
+ }
27
+ const wrapper = render(<NavigationProvider {...navProps}><UserMenu {...props} onHideUserMenu={jest.fn()}/></NavigationProvider>);
28
+
29
+ expect(wrapper.container.querySelectorAll(`${ProfileButtonContainer}`)).toHaveLength(1);
30
+
31
+ wrapper.unmount();
32
+ });
33
+
34
+ it('should render label', function () {
35
+ const props: ProfileMenu = {
36
+ user: {
37
+ firstName: 'John',
38
+ lastName: 'Doe',
39
+ email: 'email'
40
+ },
41
+ sections: [],
42
+ label: 'label'
43
+ }
44
+ const wrapper = render(<NavigationProvider {...navProps}><UserMenu {...props} onHideUserMenu={jest.fn()}/></NavigationProvider>);
45
+
46
+ expect(wrapper.findByText('label')).toBeDefined();
47
+
48
+ wrapper.unmount();
49
+ });
50
+
51
+ it('should render sign out button', function () {
52
+ const props: ProfileMenu = {
53
+ user: {
54
+ firstName: 'John',
55
+ lastName: 'Doe',
56
+ email: 'email'
57
+ },
58
+ sections: [],
59
+ signOut: {
60
+ action: jest.fn(),
61
+ label: 'sign out'
62
+ }
63
+ }
64
+ const wrapper = render(<NavigationProvider {...navProps}><UserMenu {...props} onHideUserMenu={jest.fn()}/></NavigationProvider>);
65
+
66
+ expect(wrapper.findByText('sign out')).toBeDefined();
67
+
68
+ wrapper.unmount();
69
+ });
70
+
71
+ it('should render sections', function () {
72
+ const props: ProfileMenu = {
73
+ user: {
74
+ firstName: 'John',
75
+ lastName: 'Doe',
76
+ email: 'email'
77
+ },
78
+ sections: [{
79
+ label: 'label',
80
+ items: [{
81
+ label: 'item1',
82
+ to: '#'
83
+ }]
84
+ }],
85
+ }
86
+ const wrapper = render(<NavigationProvider {...navProps}>
87
+ <UserMenu {...props} onHideUserMenu={jest.fn()}/>
88
+ </NavigationProvider>);
89
+
90
+ expect(wrapper.getByText('item1')).toBeDefined();
91
+ expect(wrapper.getByText('label')).toBeDefined();
92
+
93
+ wrapper.unmount();
94
+ });
95
+
96
+ it('should close when item is clicked', async function () {
97
+ const props: ProfileMenu = {
98
+ user: {
99
+ firstName: 'John',
100
+ lastName: 'Doe',
101
+ email: 'email'
102
+ },
103
+ sections: [{
104
+ label: 'label',
105
+ items: [{
106
+ label: 'item1',
107
+ to: 'http://localhost',
108
+ external: true
109
+ }]
110
+ }],
111
+ };
112
+
113
+ const onClose = jest.fn();
114
+ const wrapper = render(<NavigationProvider {...navProps}> <UserMenu {...props} onHideUserMenu={onClose}/> </NavigationProvider>);
115
+
116
+ act(() => {
117
+ fireEvent.click(wrapper.getByText('item1'));
118
+ })
119
+
120
+ expect(onClose).toHaveBeenCalled();
121
+
122
+ wrapper.unmount();
123
+ });
124
+
125
+ });
@@ -0,0 +1,317 @@
1
+ import * as React from 'react';
2
+ import {act, render, waitFor} from '../../../test-utils';
3
+ import {
4
+ DesktopMenuButtonTypes,
5
+ MenuNavigationItemTypeGroup,
6
+ MenuNavigationItemTypeItem,
7
+ MobileMenuButtonTypes
8
+ } from '../../types';
9
+ import {SystemIcons} from '../../../icons';
10
+ import MobileMenu from '../MobileMenu';
11
+ import { NavigationProvider } from '../../../Navigation';
12
+
13
+ const navigateSpy = jest.fn();
14
+ const isActiveRouteSpy = jest.fn();
15
+
16
+ jest.mock('rooks', () => ({
17
+ useDimensionsRef: () => [],
18
+ useMediaMatch: () => true
19
+
20
+ }));
21
+
22
+
23
+
24
+ describe('MobileMenu', () => {
25
+
26
+
27
+ const navProps = {
28
+ currentPath: '',
29
+ isActiveRoute: () => false,
30
+ navigate: (path: string, isExternal: boolean) => {}
31
+ };
32
+
33
+
34
+ const mainNavigationOptions = [
35
+ {
36
+ label: 'Overview',
37
+ to: '/',
38
+ exact: true,
39
+ onClick: () => {
40
+ console.log('Clicked on overview page');
41
+ },
42
+ },
43
+ {
44
+ label: 'Services',
45
+ to: '/services',
46
+ },
47
+ {
48
+ label: 'Products',
49
+ to: '/products',
50
+ },
51
+ ];
52
+
53
+ const secondaryNavigationOptions = [
54
+ {
55
+ label: 'Pinned Tab',
56
+ to: 'pinned',
57
+ pinned: true
58
+ },
59
+ ];
60
+
61
+ const headerActions: DesktopMenuButtonTypes[] = [
62
+ {
63
+ type: 'action',
64
+ action: (e) => {
65
+ console.log('search');
66
+ },
67
+ icon: <SystemIcons.Search/>,
68
+ },
69
+ {
70
+ type: 'action',
71
+ action: (e) => {
72
+ console.log('notifications');
73
+ },
74
+ icon: <SystemIcons.Notification/>,
75
+ },
76
+ {
77
+ type: 'action',
78
+ action: (e) => {
79
+ console.log('language');
80
+ },
81
+ icon: <SystemIcons.Language/>,
82
+ },
83
+ {
84
+ type: 'action',
85
+ action: (e) => {
86
+ console.log('settings');
87
+ },
88
+ icon: <SystemIcons.GearSettings/>,
89
+ },
90
+ {
91
+ type: 'profile',
92
+ },
93
+ {
94
+ type: 'action',
95
+ action: (e) => {
96
+ console.log('shop');
97
+ },
98
+ icon: <SystemIcons.ShoppingCart/>,
99
+ },
100
+ {
101
+ type: 'switcher',
102
+ action: (e) => {
103
+ // @ts-ignore
104
+ window.portalNav.toggle();
105
+ console.log('switcher')
106
+ },
107
+ }
108
+ ];
109
+
110
+ const notifications: MenuNavigationItemTypeItem[] = [
111
+ {
112
+ label: 'First',
113
+ note: 'This is a note',
114
+ to: '/n7',
115
+ },
116
+ {
117
+ label: 'Second',
118
+ note: 'This is a note',
119
+ to: '/n6',
120
+ },
121
+ {
122
+ label: 'Third',
123
+ note: 'This is a note',
124
+ to: '/n5',
125
+ },
126
+ {
127
+ label: 'Fourth',
128
+ note: 'This is a note',
129
+ to: '/n4',
130
+ },
131
+ {
132
+ label: 'Fifth',
133
+ note: 'This is a note',
134
+ to: '/n3',
135
+ },
136
+ {
137
+ label: 'Sixth',
138
+ note: 'This is a note',
139
+ to: '/n2',
140
+ },
141
+ {
142
+ label: 'Seventh',
143
+ note: 'This is a note',
144
+ to: '/n1',
145
+ },
146
+ ];
147
+
148
+ const mobileActions: MobileMenuButtonTypes[] = [
149
+ {
150
+ type: 'submenu',
151
+ menu: {
152
+ type: 'custom',
153
+ label: 'Search',
154
+ custom: () => 'custom'
155
+ },
156
+ icon: <SystemIcons.Search/>,
157
+ },
158
+ {
159
+ type: 'submenu',
160
+ menu: {
161
+ type: 'group',
162
+ label: 'Notifications',
163
+ items: notifications
164
+ },
165
+ icon: <SystemIcons.Notification/>,
166
+ },
167
+ {
168
+ type: 'action',
169
+ action: (e) => {
170
+ console.log('language');
171
+ return true;
172
+ },
173
+ icon: <SystemIcons.Language/>,
174
+ },
175
+ {
176
+ type: 'profile',
177
+ placement: 'left'
178
+ },
179
+ {
180
+ type: 'switcher',
181
+ action: (e) => {
182
+ // @ts-ignore
183
+ window.portalNav.toggle();
184
+ console.log('switcher')
185
+ },
186
+ }
187
+ ];
188
+
189
+ const mobileStickyNav = [
190
+ {
191
+ label: 'Help',
192
+ to: '/help',
193
+ pinned: true,
194
+ icon: <SystemIcons.Help/>,
195
+ },
196
+ {
197
+ label: 'Support',
198
+ to: '/support',
199
+ pinned: true,
200
+ icon: <SystemIcons.Support/>,
201
+ },
202
+ ];
203
+
204
+ const accountSection = [
205
+ {label: 'My Account', to: '/account/myaccount', icon: <SystemIcons.User/>, external: false},
206
+ {label: 'Language & Region', to: '/account/language', icon: <SystemIcons.Language/>, external: false},
207
+ {label: 'Settings', to: '/account/settings', icon: <SystemIcons.GearSettings/>, external: false},
208
+ ];
209
+
210
+ const organizationSection = [
211
+ {
212
+ label: 'Organization details',
213
+ to: '/organization/myorganization',
214
+ icon: <SystemIcons.Institute/>,
215
+ external: false
216
+ },
217
+ {label: 'People', to: '/organization/user-management', icon: <SystemIcons.Team/>, external: false},
218
+ ];
219
+
220
+ const supportSection = [
221
+ {
222
+ label: 'Help',
223
+ to: 'https://laerdal.force.com/HelpCenter',
224
+ icon: <SystemIcons.Help/>,
225
+ external: true,
226
+ pinned: true
227
+ },
228
+ {
229
+ label: 'Support',
230
+ to: 'https://www.laerdal.com/support/',
231
+ icon: <SystemIcons.Support/>,
232
+ external: true,
233
+ pinned: true
234
+ },
235
+ ];
236
+
237
+ const mobileNavigationSubGroup = {
238
+ type: 'group',
239
+ items: [...organizationSection, ...supportSection],
240
+ note: 'This is a note',
241
+ header: {
242
+ header: 'Title',
243
+ note: 'Note Text'
244
+ },
245
+ footer: {
246
+ header: 'Title',
247
+ note: 'Note text',
248
+ link: {
249
+ label: 'Link text',
250
+ href: '#',
251
+ external: false
252
+ }
253
+ },
254
+ action: {
255
+ label: 'Sign out',
256
+ action: () => {
257
+ console.log('Sign out');
258
+ },
259
+ icon: <SystemIcons.Logout/>
260
+ },
261
+ label: 'Organization',
262
+ icon: <SystemIcons.Institute/>,
263
+ } as MenuNavigationItemTypeGroup;
264
+
265
+ it('should render label', () => {
266
+ const wrapper = render(<NavigationProvider {...navProps}><MobileMenu show={true} label={'label'} onClose={jest.fn()}/></NavigationProvider>)
267
+
268
+ expect(wrapper.findByText('label')).toBeDefined();
269
+ });
270
+
271
+ it('should render header', () => {
272
+ const wrapper = render(<NavigationProvider {...navProps}><MobileMenu show={true} header={{header: 'header', note: 'note'}} onClose={jest.fn()}/></NavigationProvider>)
273
+
274
+ expect(wrapper.findByText('header')).toBeDefined();
275
+ expect(wrapper.findByText('note')).toBeDefined();
276
+ });
277
+
278
+ it('should render footer', () => {
279
+ const wrapper = render(<NavigationProvider {...navProps}><MobileMenu
280
+ onClose={jest.fn()}
281
+ show={true}
282
+ footer={{header: 'header', note: 'note', link: {label: 'link', href: '#'}}}/></NavigationProvider>)
283
+
284
+ expect(wrapper.findByText('header')).toBeDefined();
285
+ expect(wrapper.findByText('note')).toBeDefined();
286
+ expect(wrapper.findByText('link')).toBeDefined();
287
+ });
288
+
289
+ it('should render action', () => {
290
+ const wrapper = render(<NavigationProvider {...navProps}><MobileMenu
291
+ onClose={jest.fn()}
292
+ show={true}
293
+ action={{action: jest.fn(), label: 'action'}}/></NavigationProvider>)
294
+
295
+ expect(wrapper.findByText('action')).toBeDefined();
296
+ });
297
+
298
+ it('should render items', () => {
299
+ const items = [mobileNavigationSubGroup, ...mainNavigationOptions, ...mobileStickyNav]
300
+ const wrapper = render(<NavigationProvider {...navProps}><MobileMenu show={true} onClose={jest.fn()} items={items}/></NavigationProvider>)
301
+
302
+ items.forEach(item => {
303
+ expect(wrapper.findByText(item.label)).toBeDefined();
304
+ });
305
+ });
306
+
307
+ it('should call on close when close button is clicked', () => {
308
+ const close = jest.fn();
309
+ const wrapper = render(<NavigationProvider {...navProps}><MobileMenu show={true} label={'label'} onClose={close}/></NavigationProvider>)
310
+
311
+ act(() => {
312
+ wrapper.container.querySelector('button')!.click();
313
+ });
314
+ expect(close).toHaveBeenCalled();
315
+ });
316
+
317
+ });