@laerdal/life-react-components 6.0.0-dev.20.full → 6.0.0-dev.5.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.
- package/dist/Button/Button.cjs +5 -0
- package/dist/Button/Button.cjs.map +1 -1
- package/dist/Button/Button.js +5 -0
- package/dist/Button/Button.js.map +1 -1
- package/dist/GlobalNavigationBar/Logo.cjs +1 -2
- package/dist/GlobalNavigationBar/Logo.cjs.map +1 -1
- package/dist/GlobalNavigationBar/Logo.js +1 -2
- package/dist/GlobalNavigationBar/Logo.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/MainMenu.cjs +1 -10
- package/dist/GlobalNavigationBar/desktop/MainMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/MainMenu.js +1 -10
- package/dist/GlobalNavigationBar/desktop/MainMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/RightSideNav.cjs +2 -3
- package/dist/GlobalNavigationBar/desktop/RightSideNav.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/RightSideNav.js +2 -3
- package/dist/GlobalNavigationBar/desktop/RightSideNav.js.map +1 -1
- package/dist/GlobalNavigationBar/mobile/CommonStyles.cjs.map +1 -1
- package/dist/GlobalNavigationBar/mobile/CommonStyles.js.map +1 -1
- package/dist/HyperLink/HyperLink.cjs +2 -18
- package/dist/HyperLink/HyperLink.cjs.map +1 -1
- package/dist/HyperLink/HyperLink.d.ts +0 -2
- package/dist/HyperLink/HyperLink.js +2 -18
- package/dist/HyperLink/HyperLink.js.map +1 -1
- package/dist/InputFields/DatepickerField.cjs +1 -1
- package/dist/InputFields/DatepickerField.cjs.map +1 -1
- package/dist/InputFields/DatepickerField.d.ts +1 -1
- package/dist/InputFields/DatepickerField.js +1 -1
- package/dist/InputFields/DatepickerField.js.map +1 -1
- package/dist/InputFields/TextField.cjs +1 -1
- package/dist/InputFields/TextField.cjs.map +1 -1
- package/dist/InputFields/TextField.js +1 -1
- package/dist/InputFields/TextField.js.map +1 -1
- package/dist/MiniProductCard/MiniProductCard.cjs +1 -15
- package/dist/MiniProductCard/MiniProductCard.cjs.map +1 -1
- package/dist/MiniProductCard/MiniProductCard.d.ts +0 -1
- package/dist/MiniProductCard/MiniProductCard.js +1 -15
- package/dist/MiniProductCard/MiniProductCard.js.map +1 -1
- package/dist/NavItem/NavItem.cjs +1 -7
- package/dist/NavItem/NavItem.cjs.map +1 -1
- package/dist/NavItem/NavItem.js +1 -7
- package/dist/NavItem/NavItem.js.map +1 -1
- package/dist/Tabs/VerticalTabs.cjs +0 -1
- package/dist/Tabs/VerticalTabs.cjs.map +1 -1
- package/dist/Tabs/VerticalTabs.js +0 -1
- package/dist/Tabs/VerticalTabs.js.map +1 -1
- package/dist/styles/colors.cjs +1 -0
- package/dist/styles/colors.cjs.map +1 -1
- package/dist/styles/colors.js +1 -0
- package/dist/styles/colors.js.map +1 -1
- package/dist/styles/index.cjs +5 -5
- package/dist/styles/index.cjs.map +1 -1
- package/dist/styles/index.d.ts +2 -2
- package/dist/styles/index.js +2 -2
- package/dist/styles/index.js.map +1 -1
- package/package.json +4 -5
- package/dist/Accordion/__tests__/AccordionMenu.test.tsx +0 -42
- package/dist/Accordion/__tests__/ContentAccordion.test.tsx +0 -150
- package/dist/AuthPage/__tests__/AuthPage.test.tsx +0 -27
- package/dist/Banners/__tests__/Banner.test.tsx +0 -47
- package/dist/Banners/__tests__/OverviewBanner.test.tsx +0 -20
- package/dist/Breadcrumb/__tests__/Breadcrumb.test.tsx +0 -78
- package/dist/Button/__tests__/BackButton.test.tsx +0 -32
- package/dist/Button/__tests__/Button.test.tsx +0 -45
- package/dist/Button/__tests__/DualButton.test.tsx +0 -119
- package/dist/Card/HorizontalCard/__tests__/HorizontalCard.test.tsx +0 -71
- package/dist/Card/HorizontalCard/__tests__/VerticalCard.test.tsx +0 -124
- package/dist/Card/__tests__/Card.test.tsx +0 -146
- package/dist/Chips/__tests__/ActionChip.test.tsx +0 -94
- package/dist/Chips/__tests__/ChoiceChips.test.tsx +0 -79
- package/dist/Chips/__tests__/FilterChip.test.tsx +0 -95
- package/dist/Chips/__tests__/InputChip.test.tsx +0 -155
- package/dist/ChipsInput/__tests__/ChipDropdownInput.test.tsx +0 -100
- package/dist/ChipsInput/__tests__/ChipInputFields.test.tsx +0 -155
- package/dist/Dropdown/__tests__/DropdownFilter.test.tsx +0 -39
- package/dist/Footer/__tests__/Footer.test.tsx +0 -182
- package/dist/GlobalNavigationBar/__tests__/Logo.test.tsx +0 -39
- package/dist/GlobalNavigationBar/desktop/__tests__/DesktopActions.test.tsx +0 -108
- package/dist/GlobalNavigationBar/desktop/__tests__/ExtendedMainMenu.test.tsx +0 -28
- package/dist/GlobalNavigationBar/desktop/__tests__/MainMenu.test.tsx +0 -55
- package/dist/GlobalNavigationBar/desktop/__tests__/RightSideNav.test.tsx +0 -45
- package/dist/GlobalNavigationBar/desktop/__tests__/UserMenu.test.tsx +0 -125
- package/dist/GlobalNavigationBar/mobile/__tests__/MobileMenu.test.tsx +0 -317
- package/dist/GlobalNavigationBar/mobile/__tests__/MobileMenuContent.test.tsx +0 -294
- package/dist/GlobalNavigationBar/mobile/__tests__/MobileMenuHeader.test.tsx +0 -195
- package/dist/InputFields/__tests__/NumberField.test.tsx +0 -67
- package/dist/InputFields/__tests__/NumberInput.test.tsx +0 -68
- package/dist/InputFields/__tests__/QuickSearch.test.tsx +0 -42
- package/dist/LinearProgress/__tests__/LinearProgress.test.tsx +0 -25
- package/dist/List/__tests__/ListRow.test.tsx +0 -18
- package/dist/LoadingPage/__tests__/GlobalLoadingPage.test.tsx +0 -23
- package/dist/Modals/__tests__/Modal.test.tsx +0 -169
- package/dist/Modals/__tests__/ModalContainer.test.tsx +0 -77
- package/dist/Modals/__tests__/ModalContent.test.tsx +0 -126
- package/dist/NavItem/__tests__/NavItem.test.ts +0 -6
- package/dist/NotificationDot/__tests__/NotificationDot.test.tsx +0 -33
- package/dist/Paginator/__tests__/Paginator.test.tsx +0 -39
- package/dist/Popover/__tests__/Popover.test.tsx +0 -64
- package/dist/ProfileButton/__tests__/ProfileButton.test.tsx +0 -31
- package/dist/QuizButton/__tests__/QuizButton.test.tsx +0 -53
- package/dist/SegmentControl/__tests__/SegmentControl.test.tsx +0 -145
- package/dist/SideMenu/__tests__/SideMenu.test.tsx +0 -99
- package/dist/Switcher/__tests__/SwitcherMenuItem.tsx +0 -14
- package/dist/Table/__tests__/Table.test.tsx +0 -499
- package/dist/Tabs/__tests__/HorizontalTabs.test.tsx +0 -95
- package/dist/Tabs/__tests__/TabLink.test.tsx +0 -40
- package/dist/Tabs/__tests__/Tablist.test.tsx +0 -37
- package/dist/Tag/__tests__/Tag.test.tsx +0 -86
- package/dist/Toasters/__tests__/Toast.test.tsx +0 -74
- package/dist/Toggles/__tests__/ToggleButton.test.tsx +0 -53
- package/dist/Toggles/__tests__/ToggleSwitch.test.tsx +0 -87
- package/dist/Tooltips/__tests__/TooltipWrapper.test.tsx +0 -16
- package/dist/styles/react-datepicker.css +0 -766
|
@@ -1,125 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,317 +0,0 @@
|
|
|
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
|
-
});
|