@laerdal/life-react-components 3.6.0-dev.1.full → 3.6.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/dist/Accordion/__tests__/AccordionMenu.test.tsx +42 -0
- package/dist/Accordion/__tests__/ContentAccordion.test.tsx +150 -0
- package/dist/AuthPage/__tests__/AuthPage.test.tsx +27 -0
- package/dist/Banners/__tests__/Banner.test.tsx +47 -0
- package/dist/Banners/__tests__/OverviewBanner.test.tsx +20 -0
- package/dist/Breadcrumb/__tests__/Breadcrumb.test.tsx +78 -0
- package/dist/Button/TextButton.cjs +648 -0
- package/dist/Button/TextButton.cjs.map +1 -0
- package/dist/Button/TextButton.d.ts +77 -0
- package/dist/Button/TextButton.js +640 -0
- package/dist/Button/TextButton.js.map +1 -0
- package/dist/Button/__tests__/BackButton.test.tsx +32 -0
- package/dist/Button/__tests__/Button.test.tsx +45 -0
- package/dist/Button/__tests__/DualButton.test.tsx +119 -0
- package/dist/Button/__tests__/TextButton.test.tsx +45 -0
- package/dist/Card/HorizontalCard/__tests__/HorizontalCard.test.tsx +71 -0
- package/dist/Card/HorizontalCard/__tests__/VerticalCard.test.tsx +124 -0
- package/dist/Card/VerticalCard/VerticalCard.cjs +187 -0
- package/dist/Card/VerticalCard/VerticalCard.cjs.map +1 -0
- package/dist/Card/VerticalCard/VerticalCard.d.ts +25 -0
- package/dist/Card/VerticalCard/VerticalCard.js +178 -0
- package/dist/Card/VerticalCard/VerticalCard.js.map +1 -0
- package/dist/Card/VerticalCard/VerticalCardBottomSection.cjs +261 -0
- package/dist/Card/VerticalCard/VerticalCardBottomSection.cjs.map +1 -0
- package/dist/Card/VerticalCard/VerticalCardBottomSection.d.ts +53 -0
- package/dist/Card/VerticalCard/VerticalCardBottomSection.js +252 -0
- package/dist/Card/VerticalCard/VerticalCardBottomSection.js.map +1 -0
- package/dist/Card/VerticalCard/VerticalCardMiddleSection.cjs +145 -0
- package/dist/Card/VerticalCard/VerticalCardMiddleSection.cjs.map +1 -0
- package/dist/Card/VerticalCard/VerticalCardMiddleSection.d.ts +42 -0
- package/dist/Card/VerticalCard/VerticalCardMiddleSection.js +136 -0
- package/dist/Card/VerticalCard/VerticalCardMiddleSection.js.map +1 -0
- package/dist/Card/VerticalCard/VerticalCardTopSection.cjs +165 -0
- package/dist/Card/VerticalCard/VerticalCardTopSection.cjs.map +1 -0
- package/dist/Card/VerticalCard/VerticalCardTopSection.d.ts +45 -0
- package/dist/Card/VerticalCard/VerticalCardTopSection.js +156 -0
- package/dist/Card/VerticalCard/VerticalCardTopSection.js.map +1 -0
- package/dist/Card/VerticalCard/__tests__/VerticalCard.test.tsx +124 -0
- package/dist/Card/__tests__/Card.test.tsx +146 -0
- package/dist/Chips/ChoiceChips.cjs +0 -1
- package/dist/Chips/ChoiceChips.cjs.map +1 -1
- package/dist/Chips/ChoiceChips.js +0 -1
- package/dist/Chips/ChoiceChips.js.map +1 -1
- package/dist/Chips/__tests__/ActionChip.test.tsx +94 -0
- package/dist/Chips/__tests__/ChoiceChips.test.tsx +79 -0
- package/dist/Chips/__tests__/FilterChip.test.tsx +95 -0
- package/dist/Chips/__tests__/InputChip.test.tsx +155 -0
- package/dist/ChipsInput/ChipDropdownInput.cjs +1 -1
- package/dist/ChipsInput/ChipDropdownInput.cjs.map +1 -1
- package/dist/ChipsInput/ChipDropdownInput.js +1 -1
- package/dist/ChipsInput/ChipDropdownInput.js.map +1 -1
- package/dist/ChipsInput/__tests__/ChipDropdownInput.test.tsx +100 -0
- package/dist/ChipsInput/__tests__/ChipInputFields.test.tsx +155 -0
- package/dist/Dropdown/BasicDropdown.cjs +0 -2
- package/dist/Dropdown/BasicDropdown.cjs.map +1 -1
- package/dist/Dropdown/BasicDropdown.js +0 -2
- package/dist/Dropdown/BasicDropdown.js.map +1 -1
- package/dist/Dropdown/DropdownButton.cjs +0 -4
- package/dist/Dropdown/DropdownButton.cjs.map +1 -1
- package/dist/Dropdown/DropdownButton.js +0 -4
- package/dist/Dropdown/DropdownButton.js.map +1 -1
- package/dist/Dropdown/DropdownContent.cjs +1 -1
- package/dist/Dropdown/DropdownContent.cjs.map +1 -1
- package/dist/Dropdown/DropdownContent.js +1 -1
- package/dist/Dropdown/DropdownContent.js.map +1 -1
- package/dist/Dropdown/DropdownFilter.cjs +0 -2
- package/dist/Dropdown/DropdownFilter.cjs.map +1 -1
- package/dist/Dropdown/DropdownFilter.js +0 -2
- package/dist/Dropdown/DropdownFilter.js.map +1 -1
- package/dist/Dropdown/__tests__/DropdownFilter.test.tsx +39 -0
- package/dist/Footer/__tests__/Footer.test.tsx +182 -0
- package/dist/GlobalNavigationBar/__tests__/Logo.test.tsx +31 -0
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.cjs +1 -0
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.js +1 -0
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/SubMenu.cjs +1 -0
- package/dist/GlobalNavigationBar/desktop/SubMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/SubMenu.js +1 -0
- package/dist/GlobalNavigationBar/desktop/SubMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/__tests__/DesktopActions.test.tsx +108 -0
- package/dist/GlobalNavigationBar/desktop/__tests__/ExtendedMainMenu.test.tsx +28 -0
- package/dist/GlobalNavigationBar/desktop/__tests__/MainMenu.test.tsx +55 -0
- package/dist/GlobalNavigationBar/desktop/__tests__/RightSideNav.test.tsx +45 -0
- package/dist/GlobalNavigationBar/desktop/__tests__/UserMenu.test.tsx +125 -0
- package/dist/GlobalNavigationBar/mobile/__tests__/MobileMenu.test.tsx +317 -0
- package/dist/GlobalNavigationBar/mobile/__tests__/MobileMenuContent.test.tsx +294 -0
- package/dist/GlobalNavigationBar/mobile/__tests__/MobileMenuHeader.test.tsx +195 -0
- package/dist/InputFields/QuickSearch.cjs +1 -1
- package/dist/InputFields/QuickSearch.cjs.map +1 -1
- package/dist/InputFields/QuickSearch.js +1 -1
- package/dist/InputFields/QuickSearch.js.map +1 -1
- package/dist/InputFields/__tests__/NumberField.test.tsx +67 -0
- package/dist/InputFields/__tests__/NumberInput.test.tsx +68 -0
- package/dist/InputFields/__tests__/QuickSearch.test.tsx +42 -0
- package/dist/LinearProgress/__tests__/LinearProgress.test.tsx +25 -0
- package/dist/List/__tests__/ListRow.test.tsx +18 -0
- package/dist/LoadingPage/__tests__/GlobalLoadingPage.test.tsx +23 -0
- package/dist/Modals/__tests__/Modal.test.tsx +169 -0
- package/dist/Modals/__tests__/ModalContainer.test.tsx +77 -0
- package/dist/Modals/__tests__/ModalContent.test.tsx +126 -0
- package/dist/NavItem/__tests__/NavItem.test.ts +6 -0
- package/dist/Navigation/NavigationProvider.cjs +43 -0
- package/dist/Navigation/NavigationProvider.cjs.map +1 -0
- package/dist/Navigation/NavigationProvider.d.ts +15 -0
- package/dist/Navigation/NavigationProvider.js +32 -0
- package/dist/Navigation/NavigationProvider.js.map +1 -0
- package/dist/Navigation/index.cjs +19 -0
- package/dist/Navigation/index.cjs.map +1 -0
- package/dist/Navigation/index.d.ts +2 -0
- package/dist/Navigation/index.js +2 -0
- package/dist/Navigation/index.js.map +1 -0
- package/dist/NotificationDot/__tests__/NotificationDot.test.tsx +33 -0
- package/dist/Paginator/__tests__/Paginator.test.tsx +33 -0
- package/dist/Popover/__tests__/Popover.test.tsx +64 -0
- package/dist/ProfileButton/__tests__/ProfileButton.test.tsx +31 -0
- package/dist/QuizButton/__tests__/QuizButton.test.tsx +53 -0
- package/dist/SegmentControl/__tests__/SegmentControl.test.tsx +145 -0
- package/dist/SideMenu/__tests__/SideMenu.test.tsx +99 -0
- package/dist/Switcher/__tests__/SwitcherMenuItem.tsx +14 -0
- package/dist/Table/Table.cjs +3 -1
- package/dist/Table/Table.cjs.map +1 -1
- package/dist/Table/Table.js +3 -1
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableBody.cjs +1 -1
- package/dist/Table/TableBody.cjs.map +1 -1
- package/dist/Table/TableBody.js +1 -1
- package/dist/Table/TableBody.js.map +1 -1
- package/dist/Table/TableFooter.cjs +0 -2
- package/dist/Table/TableFooter.cjs.map +1 -1
- package/dist/Table/TableFooter.js +0 -2
- package/dist/Table/TableFooter.js.map +1 -1
- package/dist/Table/__tests__/Table.test.tsx +499 -0
- package/dist/Tabs/__tests__/HorizontalTabs.test.tsx +95 -0
- package/dist/Tabs/__tests__/TabLink.test.tsx +40 -0
- package/dist/Tabs/__tests__/Tablist.test.tsx +37 -0
- package/dist/Tag/__tests__/Tag.test.tsx +86 -0
- package/dist/Toasters/__tests__/Toast.test.tsx +74 -0
- package/dist/Toggles/__tests__/ToggleButton.test.tsx +53 -0
- package/dist/Toggles/__tests__/ToggleSwitch.test.tsx +87 -0
- package/dist/Tooltips/__tests__/TooltipWrapper.test.tsx +16 -0
- package/dist/icons/systemicons/CreditCard.cjs +43 -0
- package/dist/icons/systemicons/CreditCard.cjs.map +1 -0
- package/dist/icons/systemicons/CreditCard.d.ts +3 -0
- package/dist/icons/systemicons/CreditCard.js +33 -0
- package/dist/icons/systemicons/CreditCard.js.map +1 -0
- package/dist/icons/systemicons/Discount.cjs +43 -0
- package/dist/icons/systemicons/Discount.cjs.map +1 -0
- package/dist/icons/systemicons/Discount.d.ts +3 -0
- package/dist/icons/systemicons/Discount.js +33 -0
- package/dist/icons/systemicons/Discount.js.map +1 -0
- package/dist/icons/systemicons/DocumentComplete.cjs +43 -0
- package/dist/icons/systemicons/DocumentComplete.cjs.map +1 -0
- package/dist/icons/systemicons/DocumentComplete.d.ts +3 -0
- package/dist/icons/systemicons/DocumentComplete.js +33 -0
- package/dist/icons/systemicons/DocumentComplete.js.map +1 -0
- package/dist/icons/systemicons/Folder.cjs +43 -0
- package/dist/icons/systemicons/Folder.cjs.map +1 -0
- package/dist/icons/systemicons/Folder.d.ts +3 -0
- package/dist/icons/systemicons/Folder.js +33 -0
- package/dist/icons/systemicons/Folder.js.map +1 -0
- package/dist/icons/systemicons/FolderNew.cjs +43 -0
- package/dist/icons/systemicons/FolderNew.cjs.map +1 -0
- package/dist/icons/systemicons/FolderNew.d.ts +3 -0
- package/dist/icons/systemicons/FolderNew.js +33 -0
- package/dist/icons/systemicons/FolderNew.js.map +1 -0
- package/dist/icons/systemicons/MoodHappy.cjs +43 -0
- package/dist/icons/systemicons/MoodHappy.cjs.map +1 -0
- package/dist/icons/systemicons/MoodHappy.d.ts +3 -0
- package/dist/icons/systemicons/MoodHappy.js +33 -0
- package/dist/icons/systemicons/MoodHappy.js.map +1 -0
- package/dist/icons/systemicons/MoodIndifferent.cjs +43 -0
- package/dist/icons/systemicons/MoodIndifferent.cjs.map +1 -0
- package/dist/icons/systemicons/MoodIndifferent.d.ts +3 -0
- package/dist/icons/systemicons/MoodIndifferent.js +33 -0
- package/dist/icons/systemicons/MoodIndifferent.js.map +1 -0
- package/dist/icons/systemicons/MoodSad.cjs +43 -0
- package/dist/icons/systemicons/MoodSad.cjs.map +1 -0
- package/dist/icons/systemicons/MoodSad.d.ts +3 -0
- package/dist/icons/systemicons/MoodSad.js +33 -0
- package/dist/icons/systemicons/MoodSad.js.map +1 -0
- package/dist/icons/systemicons/MoodVeryHappy.cjs +43 -0
- package/dist/icons/systemicons/MoodVeryHappy.cjs.map +1 -0
- package/dist/icons/systemicons/MoodVeryHappy.d.ts +3 -0
- package/dist/icons/systemicons/MoodVeryHappy.js +33 -0
- package/dist/icons/systemicons/MoodVeryHappy.js.map +1 -0
- package/dist/icons/systemicons/MoodVerySad.cjs +43 -0
- package/dist/icons/systemicons/MoodVerySad.cjs.map +1 -0
- package/dist/icons/systemicons/MoodVerySad.d.ts +3 -0
- package/dist/icons/systemicons/MoodVerySad.js +33 -0
- package/dist/icons/systemicons/MoodVerySad.js.map +1 -0
- package/dist/icons/systemicons/Orders.cjs +43 -0
- package/dist/icons/systemicons/Orders.cjs.map +1 -0
- package/dist/icons/systemicons/Orders.d.ts +3 -0
- package/dist/icons/systemicons/Orders.js +33 -0
- package/dist/icons/systemicons/Orders.js.map +1 -0
- package/dist/icons/systemicons/Palette.cjs +43 -0
- package/dist/icons/systemicons/Palette.cjs.map +1 -0
- package/dist/icons/systemicons/Palette.d.ts +3 -0
- package/dist/icons/systemicons/Palette.js +33 -0
- package/dist/icons/systemicons/Palette.js.map +1 -0
- package/dist/icons/systemicons/Stack.cjs +43 -0
- package/dist/icons/systemicons/Stack.cjs.map +1 -0
- package/dist/icons/systemicons/Stack.d.ts +3 -0
- package/dist/icons/systemicons/Stack.js +33 -0
- package/dist/icons/systemicons/Stack.js.map +1 -0
- package/dist/styles/design-tokens/dark/tokens.css +481 -0
- package/dist/styles/design-tokens/light/tokens.css +481 -0
- package/dist/styles/design-tokens/rqi_dark/tokens.css +481 -0
- package/dist/styles/design-tokens/rqi_light/tokens.css +481 -0
- package/dist/styles/react-datepicker.css +766 -0
- package/dist/styles/typography.cjs +35 -59
- package/dist/styles/typography.cjs.map +1 -1
- package/dist/styles/typography.d.ts +1 -1
- package/dist/styles/typography.js +35 -59
- package/dist/styles/typography.js.map +1 -1
- package/dist/test-utils.cjs +16 -10
- package/dist/test-utils.cjs.map +1 -1
- package/dist/test-utils.d.ts +5 -5
- package/dist/test-utils.js +14 -8
- package/dist/test-utils.js.map +1 -1
- package/dist/utils/color-tokens.cjs +91 -0
- package/dist/utils/color-tokens.cjs.map +1 -0
- package/dist/utils/color-tokens.d.ts +19 -0
- package/dist/utils/color-tokens.js +82 -0
- package/dist/utils/color-tokens.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '../../test-utils';
|
|
3
|
+
import 'jest-styled-components';
|
|
4
|
+
import { COLORS } from '../../styles';
|
|
5
|
+
import AccordionMenu from '../AccordionMenu';
|
|
6
|
+
|
|
7
|
+
const accordionItems = [
|
|
8
|
+
{
|
|
9
|
+
id: 'test1_id',
|
|
10
|
+
title: 'Item label with text 1',
|
|
11
|
+
children: <div>content test1</div>,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: 'test2_id',
|
|
15
|
+
title: 'Item label with text 2',
|
|
16
|
+
children: <div>content test2</div>,
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
describe('<AccordionMenu />', () => {
|
|
21
|
+
it('Check correct text placed on labels', async () => {
|
|
22
|
+
const { queryByText } = render(<AccordionMenu items={accordionItems} onSelect={() => {}}></AccordionMenu>);
|
|
23
|
+
expect(queryByText('Item label with text 1')).toBeDefined();
|
|
24
|
+
expect(queryByText('Item label with text 2')).toBeDefined();
|
|
25
|
+
expect(queryByText('content test1')).toBeNull();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('Check item label element color and label', async () => {
|
|
29
|
+
const { container } = render(<AccordionMenu items={accordionItems} onSelect={() => {}}></AccordionMenu>);
|
|
30
|
+
const headerItem = container.querySelector('#test2_id');
|
|
31
|
+
expect(headerItem).toBeDefined();
|
|
32
|
+
expect(headerItem?.textContent).toContain('Item label with text 2');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('Check expanded item text', async () => {
|
|
36
|
+
const { container } = render(<AccordionMenu items={accordionItems} onSelect={() => {}} selectedItems={['test1_id']}></AccordionMenu>);
|
|
37
|
+
const headerItem = container.querySelector('#test1_id');
|
|
38
|
+
//check item expanded
|
|
39
|
+
expect(headerItem?.children[1]).toBeDefined();
|
|
40
|
+
expect(headerItem?.children[1]?.textContent).toContain('content test1');
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ContentAccordion, {
|
|
3
|
+
ContentAccordionItem,
|
|
4
|
+
ContentAccordionItemContentBody, ContentAccordionItemContentFooter,
|
|
5
|
+
ContentAccordionItemContentHeader, ContentAccordionItemHeader, ContentAccordionWrapper
|
|
6
|
+
} from '../ContentAccordion';
|
|
7
|
+
import {fireEvent, render} from '../../test-utils';
|
|
8
|
+
import {Size} from '../../types';
|
|
9
|
+
|
|
10
|
+
describe('ContentAccordion', () => {
|
|
11
|
+
const contentAccordionItemsWithBody = [
|
|
12
|
+
{
|
|
13
|
+
id: '1',
|
|
14
|
+
title: 'Item 1',
|
|
15
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: '2',
|
|
19
|
+
title: 'Item 2',
|
|
20
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
|
21
|
+
active: true
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: '3',
|
|
25
|
+
title: 'Item 3',
|
|
26
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
|
27
|
+
disabled: true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: '4',
|
|
31
|
+
title: 'Item 4',
|
|
32
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
|
|
33
|
+
}
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
const contentAccordionItemsWithBodyAndHeaderAndFooter = [
|
|
37
|
+
{
|
|
38
|
+
id: '1',
|
|
39
|
+
title: 'Item 1',
|
|
40
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
|
41
|
+
header: 'Header 1',
|
|
42
|
+
footer: <span/>,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: '2',
|
|
46
|
+
title: 'Item 2',
|
|
47
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
|
48
|
+
header: 'Header 2',
|
|
49
|
+
footer: <span/>,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: '3',
|
|
53
|
+
title: 'Item 3',
|
|
54
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
|
55
|
+
header: 'Header 3',
|
|
56
|
+
footer: <span/>,
|
|
57
|
+
disabled: true
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: '4',
|
|
61
|
+
title: 'Item 4',
|
|
62
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
|
63
|
+
header: 'Header 4',
|
|
64
|
+
footer: <span/>,
|
|
65
|
+
}
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
it('should render items in correct state', () => {
|
|
69
|
+
const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBody}/>);
|
|
70
|
+
|
|
71
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItem}`).length).toBe(4);
|
|
72
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItem}.disabled`).length).toBe(1);
|
|
73
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItem}.disabled`)[0].id).toBe('item_3');
|
|
74
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItem}.active`).length).toBe(1);
|
|
75
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItem}.active`)[0].id).toBe('item_2');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('should not render header if not provided', () => {
|
|
79
|
+
const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBody}/>);
|
|
80
|
+
|
|
81
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItemContentBody}`).length).toBe(4);
|
|
82
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItemContentHeader}`).length).toBe(0);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('should not render footer if not provided', () => {
|
|
86
|
+
const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBody}/>);
|
|
87
|
+
|
|
88
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItemContentBody}`).length).toBe(4);
|
|
89
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItemContentFooter}`).length).toBe(0);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('should render body, header, and footer if all are provided', () => {
|
|
93
|
+
const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBodyAndHeaderAndFooter}/>);
|
|
94
|
+
|
|
95
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItem}`).length).toBe(4);
|
|
96
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItemContentBody}`).length).toBe(4);
|
|
97
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItemContentHeader}`).length).toBe(4);
|
|
98
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItemContentFooter}`).length).toBe(4);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('should set correct size class name for small accordion', () => {
|
|
102
|
+
const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBodyAndHeaderAndFooter}
|
|
103
|
+
size={Size.Small}/>);
|
|
104
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionWrapper}.small`).length).toBe(1);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('should set correct size class name for medium accordion', () => {
|
|
108
|
+
const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBodyAndHeaderAndFooter}
|
|
109
|
+
size={Size.Medium}/>);
|
|
110
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionWrapper}.medium`).length).toBe(1);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it('should set correct size class name for large accordion', () => {
|
|
114
|
+
const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBodyAndHeaderAndFooter}
|
|
115
|
+
size={Size.Large}/>);
|
|
116
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionWrapper}.large`).length).toBe(1);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('should change active state when item header is clicked', () => {
|
|
120
|
+
const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBody} multi={false}/>);
|
|
121
|
+
const itemHeader = wrapper.container.querySelectorAll(`${ContentAccordionItemHeader}`)[3];
|
|
122
|
+
|
|
123
|
+
fireEvent.click(itemHeader);
|
|
124
|
+
|
|
125
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItem}.active`).length).toBe(1);
|
|
126
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItem}.active`)[0].id).toBe('item_4');
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('should not change active state when disabled item header is clicked', () => {
|
|
130
|
+
const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBody} multi={false}/>);
|
|
131
|
+
const itemHeader = wrapper.container.querySelectorAll(`${ContentAccordionItemHeader}`)[2];
|
|
132
|
+
|
|
133
|
+
fireEvent.click(itemHeader);
|
|
134
|
+
|
|
135
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItem}.active`).length).toBe(1);
|
|
136
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItem}.active`)[0].id).toBe('item_2');
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it('should append active items if multi property is true', () => {
|
|
140
|
+
const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBody} multi={true}/>);
|
|
141
|
+
const itemHeader = wrapper.container.querySelectorAll(`${ContentAccordionItemHeader}`)[3];
|
|
142
|
+
|
|
143
|
+
fireEvent.click(itemHeader);
|
|
144
|
+
|
|
145
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItem}.active`).length).toBe(2);
|
|
146
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItem}.active`)[0].id).toBe('item_2');
|
|
147
|
+
expect(wrapper.container.querySelectorAll(`${ContentAccordionItem}.active`)[1].id).toBe('item_4');
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '../../test-utils';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
|
+
import { AuthPage, Size, SystemIcons } from '../..';
|
|
5
|
+
import 'jest-styled-components';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
describe('<AuthPage />', () => {
|
|
11
|
+
it('Renders AuthPage component', async () => {
|
|
12
|
+
const { getByText, container, getByTestId } = render(
|
|
13
|
+
<AuthPage
|
|
14
|
+
screenSetsContainerId="gigya_test"
|
|
15
|
+
panel={{
|
|
16
|
+
title: 'Sign in header',
|
|
17
|
+
content: 'Sign in information',
|
|
18
|
+
}}
|
|
19
|
+
/>,
|
|
20
|
+
);
|
|
21
|
+
//expect gygia container displayed
|
|
22
|
+
expect(container.querySelector('[id="gigya_test"]')).toBeTruthy();
|
|
23
|
+
//expect sign in header and info text displayed
|
|
24
|
+
expect(getByText('Sign in header')).toBeTruthy();
|
|
25
|
+
expect(getByText('Sign in information')).toBeTruthy();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '../../test-utils';
|
|
3
|
+
import { Banner } from '../index';
|
|
4
|
+
import 'jest-styled-components';
|
|
5
|
+
import { COLORS } from '../../styles';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
describe('<Banner />', () => {
|
|
11
|
+
it('Renders warning banner', async () => {
|
|
12
|
+
const { queryByText, getByTestId } = render(
|
|
13
|
+
<Banner type="warning" testId="TestBanner">
|
|
14
|
+
<h2>TestBanner</h2>
|
|
15
|
+
</Banner>,
|
|
16
|
+
);
|
|
17
|
+
expect(queryByText('TestHeader')).toBeDefined();
|
|
18
|
+
expect(getByTestId('TestBanner')).toHaveStyleRule('background', COLORS.bg_surface_warning);
|
|
19
|
+
});
|
|
20
|
+
it('Renders critial banner', async () => {
|
|
21
|
+
const { queryByText, getByTestId } = render(
|
|
22
|
+
<Banner type="critical" testId="TestBanner">
|
|
23
|
+
<h2>TestBanner</h2>
|
|
24
|
+
</Banner>,
|
|
25
|
+
);
|
|
26
|
+
expect(queryByText('TestHeader')).toBeDefined();
|
|
27
|
+
expect(getByTestId('TestBanner')).toHaveStyleRule('background', COLORS.bg_surface_critical);
|
|
28
|
+
});
|
|
29
|
+
it('Renders positive banner', async () => {
|
|
30
|
+
const { queryByText, getByTestId } = render(
|
|
31
|
+
<Banner type="positive" testId="TestBanner">
|
|
32
|
+
<h2>TestBanner</h2>
|
|
33
|
+
</Banner>,
|
|
34
|
+
);
|
|
35
|
+
expect(queryByText('TestHeader')).toBeDefined();
|
|
36
|
+
expect(getByTestId('TestBanner')).toHaveStyleRule('background', COLORS.bg_surface_positive);
|
|
37
|
+
});
|
|
38
|
+
it('Renders default banner', async () => {
|
|
39
|
+
const { queryByText, getByTestId } = render(
|
|
40
|
+
<Banner testId="TestBanner">
|
|
41
|
+
<h2>TestBanner</h2>
|
|
42
|
+
</Banner>,
|
|
43
|
+
);
|
|
44
|
+
expect(queryByText('TestHeader')).toBeDefined();
|
|
45
|
+
expect(getByTestId('TestBanner')).toHaveStyleRule('background', COLORS.bg_surface_primary);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '../../test-utils';
|
|
3
|
+
import { OverviewBanner } from '../index';
|
|
4
|
+
import 'jest-styled-components';
|
|
5
|
+
import { COLORS } from '../../styles';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
describe('<OverviewBanner />', () => {
|
|
11
|
+
it('Renders', async () => {
|
|
12
|
+
const { queryByText, getByTestId } = render(
|
|
13
|
+
<OverviewBanner testId="TestBanner">
|
|
14
|
+
<h2>TestHeader</h2>
|
|
15
|
+
</OverviewBanner>,
|
|
16
|
+
);
|
|
17
|
+
expect(queryByText('TestHeader')).toBeDefined();
|
|
18
|
+
expect(getByTestId('TestBanner')).toHaveStyleRule('background-color', COLORS.primary_20);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '../../test-utils';
|
|
3
|
+
import { Breadcrumb } from '../index';
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
|
+
import { Size } from '../../types';
|
|
6
|
+
|
|
7
|
+
const items = [
|
|
8
|
+
{ label: 'test1', url: 'http://laerdal_test.com', callback: (id?: string) => {} },
|
|
9
|
+
{ label: 'test2', url: 'http://laerdal_test1.com', callback: (id?: string) => {} },
|
|
10
|
+
{ label: 'test3', url: 'http://laerdal_test2.com', callback: (id?: string) => {} },
|
|
11
|
+
{ label: 'test4', url: 'http://laerdal_test3.com', callback: (id?: string) => {} },
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
describe('<Breadcrumb />', () => {
|
|
17
|
+
it('Renders with no values', async () => {
|
|
18
|
+
const { getByTestId, container } = render(<Breadcrumb items={[]} />);
|
|
19
|
+
//main container is displayed
|
|
20
|
+
expect(getByTestId('breacrumbContainer')).toBeDefined();
|
|
21
|
+
//home link is displayed
|
|
22
|
+
expect(container.querySelector('[id="homelink"]')).toBeDefined();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('Renders with home icon and no values', async () => {
|
|
26
|
+
const { getByTestId, container } = render(<Breadcrumb items={[]} homeIcon={true} />);
|
|
27
|
+
expect(getByTestId('breacrumbContainer')).toBeDefined();
|
|
28
|
+
//home icon is displayed
|
|
29
|
+
expect(container.querySelector('[id="homeIcon"]')).toBeDefined();
|
|
30
|
+
|
|
31
|
+
//because a size was not provided, small icons width will be set (20px)
|
|
32
|
+
const svg = container.querySelector('svg');
|
|
33
|
+
expect(svg).toHaveAttribute('width', '20px');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('Render breadcrumb with two values ', async () => {
|
|
37
|
+
const options = items.slice(0, 2);
|
|
38
|
+
const { getByTestId, container } = render(<Breadcrumb lastItemAsLabel={true} items={options} size={Size.Medium} />);
|
|
39
|
+
expect(getByTestId('breacrumbContainer')).toBeDefined();
|
|
40
|
+
//check breadcrumbs displayed correctly - only one link defined for this scenario
|
|
41
|
+
const linkItem = container.querySelector('a[id*="link-item"]');
|
|
42
|
+
expect(linkItem).toBeDefined();
|
|
43
|
+
expect(linkItem).toHaveTextContent(options[0].label);
|
|
44
|
+
|
|
45
|
+
//query breadcrumb chrevron separators
|
|
46
|
+
const breadcrumbSeparators = container.querySelectorAll('.chevronicon');
|
|
47
|
+
expect(breadcrumbSeparators).toBeDefined();
|
|
48
|
+
expect(breadcrumbSeparators).toHaveLength(2);
|
|
49
|
+
|
|
50
|
+
//medium size provided
|
|
51
|
+
const svg = container.querySelector('svg');
|
|
52
|
+
expect(svg).toHaveAttribute('width', '24px');
|
|
53
|
+
|
|
54
|
+
const lastItem = container.querySelector('label');
|
|
55
|
+
expect(lastItem).toBeDefined();
|
|
56
|
+
expect(lastItem).toHaveTextContent(options[options.length - 1].label);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('Render more than 3 items', async () => {
|
|
60
|
+
const { container, getByText } = render(<Breadcrumb lastItemAsLabel={true} items={items} size={Size.XSmall} />);
|
|
61
|
+
|
|
62
|
+
//having more than 2 item show more dropdown selector should be displayed
|
|
63
|
+
//because home page button is not provided, only one button should be rendered
|
|
64
|
+
const showMoreBtn = container.querySelector('button');
|
|
65
|
+
expect(showMoreBtn).toBeDefined();
|
|
66
|
+
//in this scenario, first option label is not displayed, so only one link item available
|
|
67
|
+
const linkItem = container.querySelectorAll('a[id*="link-item"]');
|
|
68
|
+
expect(linkItem).toHaveLength(1);
|
|
69
|
+
|
|
70
|
+
//links not displayed for first two items, but these are defined as dropdown options
|
|
71
|
+
expect(getByText(items[0].label)).toBeDefined();
|
|
72
|
+
expect(getByText(items[1].label)).toBeDefined();
|
|
73
|
+
|
|
74
|
+
//xs size provided
|
|
75
|
+
const svg = container.querySelector('svg');
|
|
76
|
+
expect(svg).toHaveAttribute('width', '16px');
|
|
77
|
+
});
|
|
78
|
+
});
|