@indico-data/design-system 2.2.0 → 2.3.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.
- package/.yarn/sdks/eslint/bin/eslint.js +8 -1
- package/.yarn/sdks/eslint/package.json +1 -1
- package/.yarn/sdks/prettier/bin/prettier.cjs +8 -1
- package/.yarn/sdks/prettier/index.cjs +8 -1
- package/.yarn/sdks/typescript/bin/tsc +8 -1
- package/.yarn/sdks/typescript/bin/tsserver +8 -1
- package/.yarn/sdks/typescript/package.json +1 -1
- package/.yarnrc.yml +1 -0
- package/lib/index.css +105 -101
- package/lib/index.d.ts +1 -10
- package/lib/index.esm.css +105 -101
- package/lib/index.esm.js +1138 -3041
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +1135 -3039
- package/lib/index.js.map +1 -1
- package/lib/src/components/button/types.d.ts +0 -1
- package/lib/src/components/index.d.ts +1 -0
- package/lib/src/components/tables/table/LoadingComponent.d.ts +1 -0
- package/lib/src/components/tables/table/Table.d.ts +78 -0
- package/lib/src/components/tables/table/Table.stories.d.ts +6 -0
- package/lib/src/components/tables/table/index.d.ts +1 -0
- package/lib/src/components/tables/table/sampleData.d.ts +8 -0
- package/lib/src/index.d.ts +1 -1
- package/lib/src/legacy/components/Accordion/Accordion.stories.d.ts +9 -9
- package/lib/src/legacy/components/Accordion/Accordion.styles.d.ts +1 -2
- package/lib/src/legacy/components/ListTable/Header/Header.styles.d.ts +1 -2
- package/lib/src/legacy/components/ListTable/ListTable.stories.d.ts +7 -7
- package/lib/src/legacy/components/ListTable/ListTable.styles.d.ts +1 -2
- package/lib/src/legacy/components/LoadingAwareContainer/LoadingAwareContainer.stories.d.ts +2 -2
- package/lib/src/legacy/components/LoadingAwareContainer/LoadingAwareContainer.styles.d.ts +2 -3
- package/lib/src/legacy/components/Pagination/Pagination.styles.d.ts +1 -2
- package/lib/src/legacy/components/Toggle/Toggle.stories.d.ts +4 -4
- package/lib/src/legacy/components/Toggle/Toggle.styles.d.ts +1 -2
- package/lib/src/legacy/components/Tooltip/Tooltip.styles.d.ts +1 -2
- package/lib/src/legacy/components/basic-section/Section/Section.stories.d.ts +1 -2
- package/lib/src/legacy/components/basic-section/Section/Section.styles.d.ts +1 -2
- package/lib/src/legacy/components/basic-section/SectionBlock/SectionBlock.styles.d.ts +1 -2
- package/lib/src/legacy/components/basic-section/SectionBody/SectionBody.styles.d.ts +1 -2
- package/lib/src/legacy/components/basic-section/SectionHeader/SectionHeader.stories.d.ts +1 -1
- package/lib/src/legacy/components/basic-section/SectionHeader/SectionHeader.styles.d.ts +1 -2
- package/lib/src/legacy/components/basic-section/SectionTable/SectionTable.styles.d.ts +1 -2
- package/lib/src/legacy/components/buttons/Button/Button.stories.d.ts +1 -1
- package/lib/src/legacy/components/buttons/Button/Button.styles.d.ts +1 -2
- package/lib/src/legacy/components/buttons/IconButton/IconButton.stories.d.ts +3 -3
- package/lib/src/legacy/components/buttons/IconButton/IconButton.styles.d.ts +4 -3
- package/lib/src/legacy/components/dropdowns/BorderSelect/BorderSelect.stories.d.ts +8 -9
- package/lib/src/legacy/components/dropdowns/BorderSelect/BorderSelect.styles.d.ts +2 -3
- package/lib/src/legacy/components/dropdowns/MultiCombobox/MultiCombobox.d.ts +5 -5
- package/lib/src/legacy/components/dropdowns/MultiCombobox/MultiCombobox.stories.d.ts +7 -7
- package/lib/src/legacy/components/dropdowns/MultiCombobox/MultiCombobox.styles.d.ts +3 -2
- package/lib/src/legacy/components/dropdowns/Select/Select.stories.d.ts +6 -7
- package/lib/src/legacy/components/dropdowns/Select/Select.styles.d.ts +1 -2
- package/lib/src/legacy/components/dropdowns/SingleCombobox/SingleCombobox.d.ts +5 -5
- package/lib/src/legacy/components/dropdowns/SingleCombobox/SingleCombobox.stories.d.ts +5 -6
- package/lib/src/legacy/components/dropdowns/SingleCombobox/SingleCombobox.styles.d.ts +3 -2
- package/lib/src/legacy/components/index.d.ts +0 -1
- package/lib/src/legacy/components/inputs/DatePicker/DatePicker.styles.d.ts +1 -2
- package/lib/src/legacy/components/inputs/EditableInput/EditableInput.styles.d.ts +1 -2
- package/lib/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.styles.d.ts +1 -2
- package/lib/src/legacy/components/inputs/NumberInput/NumberInput.stories.d.ts +2 -2
- package/lib/src/legacy/components/inputs/NumberInput/NumberInput.styles.d.ts +1 -2
- package/lib/src/legacy/components/inputs/RadioButtons/RadioButtons.styles.d.ts +5 -6
- package/lib/src/legacy/components/inputs/RadioGroup/RadioGroup.styles.d.ts +1 -2
- package/lib/src/legacy/components/inputs/SearchInput/SearchInput.stories.d.ts +8 -9
- package/lib/src/legacy/components/inputs/SearchInput/SearchInput.styles.d.ts +1 -2
- package/lib/src/legacy/components/inputs/TextInput/TextInput.stories.d.ts +9 -9
- package/lib/src/legacy/components/inputs/TextInput/TextInput.styles.d.ts +2 -3
- package/lib/src/legacy/components/loading-indicators/BarSpinner/BarSpinner.styles.d.ts +1 -2
- package/lib/src/legacy/components/loading-indicators/CirclePulse/CirclePulse.styles.d.ts +4 -5
- package/lib/src/legacy/components/loading-indicators/LoadingIndicator/LoadingIndicator.styles.d.ts +4 -5
- package/lib/src/legacy/components/loading-indicators/LoadingList/LoadingList.styles.d.ts +1 -2
- package/lib/src/legacy/components/loading-indicators/PercentageRing/PercentageRing.styles.d.ts +1 -2
- package/lib/src/legacy/components/modals/ConfirmModal/ConfirmModal.stories.d.ts +5 -5
- package/lib/src/legacy/components/modals/ConfirmModal/ConfirmModal.styles.d.ts +1 -2
- package/lib/src/legacy/components/modals/ModalBase/ModalBase.styles.d.ts +1 -1
- package/lib/src/legacy/components/text-truncate/TextTruncate.styles.d.ts +1 -2
- package/lib/src/legacy/components/user-feedback/Shrug/Shrug.stories.d.ts +11 -11
- package/lib/src/legacy/components/user-feedback/Shrug/Shrug.styles.d.ts +1 -2
- package/lib/src/legacy/styles/globals/buttons.d.ts +0 -1
- package/lib/src/legacy/styles/globals/forms.d.ts +0 -1
- package/lib/src/legacy/styles/globals/layout.d.ts +0 -1
- package/lib/src/legacy/styles/globals/lists.d.ts +0 -1
- package/lib/src/legacy/styles/globals/margin-padding.d.ts +0 -1
- package/lib/src/legacy/styles/globals/media.d.ts +0 -1
- package/lib/src/legacy/styles/globals/tables.d.ts +0 -1
- package/lib/src/legacy/styles/globals/typography.d.ts +0 -1
- package/lib/src/legacy/styles/globals/utility-classes.d.ts +0 -1
- package/lib/src/types.d.ts +0 -2
- package/package.json +4 -2
- package/src/components/index.ts +1 -0
- package/src/components/tables/table/LoadingComponent.tsx +5 -0
- package/src/components/tables/table/Table.mdx +15 -0
- package/src/components/tables/table/Table.scss +79 -0
- package/src/components/tables/table/Table.stories.tsx +547 -0
- package/src/components/tables/table/Table.tsx +112 -0
- package/src/components/tables/table/_variables.scss +19 -0
- package/src/components/tables/table/index.ts +1 -0
- package/src/components/tables/table/sampleData.ts +162 -0
- package/src/index.ts +0 -1
- package/src/legacy/components/index.ts +0 -1
- package/src/styles/index.scss +1 -2
- package/src/types.ts +0 -5
- package/lib/src/legacy/components/Navigation/Drawer/Drawer.d.ts +0 -16
- package/lib/src/legacy/components/Navigation/Drawer/Drawer.stories.d.ts +0 -6
- package/lib/src/legacy/components/Navigation/Drawer/DrawerLinkList.d.ts +0 -9
- package/lib/src/legacy/components/Navigation/Drawer/DrawerLinkList.styles.d.ts +0 -2
- package/lib/src/legacy/components/Navigation/Drawer/__mocks__/mocks.d.ts +0 -3
- package/lib/src/legacy/components/Navigation/Drawer/__tests__/DrawerLinkList.test.d.ts +0 -1
- package/lib/src/legacy/components/Navigation/Drawer/index.d.ts +0 -1
- package/lib/src/legacy/components/Navigation/Drawer/types.d.ts +0 -7
- package/lib/src/legacy/components/Navigation/index.d.ts +0 -1
- package/src/legacy/components/Navigation/Drawer/Drawer.scss +0 -61
- package/src/legacy/components/Navigation/Drawer/Drawer.stories.tsx +0 -43
- package/src/legacy/components/Navigation/Drawer/Drawer.tsx +0 -107
- package/src/legacy/components/Navigation/Drawer/DrawerLinkList.styles.ts +0 -65
- package/src/legacy/components/Navigation/Drawer/DrawerLinkList.tsx +0 -64
- package/src/legacy/components/Navigation/Drawer/__mocks__/mocks.ts +0 -49
- package/src/legacy/components/Navigation/Drawer/__tests__/Drawer.test.tsx +0 -180
- package/src/legacy/components/Navigation/Drawer/__tests__/DrawerLinkList.test.tsx +0 -66
- package/src/legacy/components/Navigation/Drawer/index.ts +0 -1
- package/src/legacy/components/Navigation/Drawer/types.ts +0 -8
- package/src/legacy/components/Navigation/index.ts +0 -1
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import { PermafrostComponent } from '@/types';
|
|
4
|
-
import { StyledDrawerLinkList } from './DrawerLinkList.styles';
|
|
5
|
-
import { Icon } from '@/components/icons';
|
|
6
|
-
import { ListItem } from './types';
|
|
7
|
-
import { NavLink } from 'react-router-dom';
|
|
8
|
-
|
|
9
|
-
type Props = PermafrostComponent & {
|
|
10
|
-
style?: object;
|
|
11
|
-
listItems?: ListItem[];
|
|
12
|
-
isOpen: boolean;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const DrawerLinkList = (props: Props) => {
|
|
16
|
-
const { className, style = {}, id, listItems, isOpen, ...restOfProps } = props;
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<StyledDrawerLinkList
|
|
20
|
-
id={id}
|
|
21
|
-
data-cy={props['data-cy']}
|
|
22
|
-
data-testid={props['data-testid']}
|
|
23
|
-
style={style}
|
|
24
|
-
{...restOfProps}
|
|
25
|
-
className={classNames('drawer__content__list', className)}
|
|
26
|
-
>
|
|
27
|
-
{listItems && (
|
|
28
|
-
<ul className="drawer__list">
|
|
29
|
-
{listItems.map((item) => (
|
|
30
|
-
<NavLink
|
|
31
|
-
key={item.id}
|
|
32
|
-
to={item.path}
|
|
33
|
-
className={({ isActive, isPending }) => {
|
|
34
|
-
return classNames(
|
|
35
|
-
'drawer__list__item',
|
|
36
|
-
{ 'drawer__list__item--active': isActive },
|
|
37
|
-
{ 'drawer__list__item--pending': isPending },
|
|
38
|
-
);
|
|
39
|
-
}}
|
|
40
|
-
role="link"
|
|
41
|
-
aria-label={item.label}
|
|
42
|
-
data-testid={`link-list-item-${item.label}`}
|
|
43
|
-
>
|
|
44
|
-
<li className="drawer__list__item__link">
|
|
45
|
-
<span className={`drawer__list__item__icon`}>
|
|
46
|
-
<Icon size="lg" name={item.icon} ariaLabel={`${item.label} icon`} />
|
|
47
|
-
</span>
|
|
48
|
-
<span
|
|
49
|
-
className={`drawer__list__item__label ${
|
|
50
|
-
!isOpen ? 'drawer__list__item__label--hidden' : ''
|
|
51
|
-
}`}
|
|
52
|
-
aria-hidden={!isOpen}
|
|
53
|
-
data-testid="list-item-label"
|
|
54
|
-
>
|
|
55
|
-
{item.label}
|
|
56
|
-
</span>
|
|
57
|
-
</li>
|
|
58
|
-
</NavLink>
|
|
59
|
-
))}
|
|
60
|
-
</ul>
|
|
61
|
-
)}
|
|
62
|
-
</StyledDrawerLinkList>
|
|
63
|
-
);
|
|
64
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { ListItem } from '../types';
|
|
2
|
-
|
|
3
|
-
export const navigationItems: ListItem[] = [
|
|
4
|
-
{
|
|
5
|
-
id: '1',
|
|
6
|
-
icon: 'search-thin',
|
|
7
|
-
label: 'Search',
|
|
8
|
-
path: '/iframe.html',
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
id: '4',
|
|
12
|
-
icon: 'libraries',
|
|
13
|
-
label: 'Libraries',
|
|
14
|
-
path: '/',
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
id: '2',
|
|
18
|
-
icon: 'collection',
|
|
19
|
-
label: 'Collections',
|
|
20
|
-
path: '/profile',
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: '3',
|
|
24
|
-
icon: 'compare',
|
|
25
|
-
label: 'Compare',
|
|
26
|
-
path: '/settings',
|
|
27
|
-
},
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
export const footerItems: ListItem[] = [
|
|
31
|
-
{
|
|
32
|
-
id: 'foter-1',
|
|
33
|
-
icon: 'circle-help',
|
|
34
|
-
label: 'Help',
|
|
35
|
-
path: '/search',
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
id: '4f',
|
|
39
|
-
icon: 'cog',
|
|
40
|
-
label: 'Settings',
|
|
41
|
-
path: '/',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
id: '42',
|
|
45
|
-
icon: 'logout',
|
|
46
|
-
label: 'Sign Out',
|
|
47
|
-
path: '/profile',
|
|
48
|
-
},
|
|
49
|
-
];
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
it('should render correctly', () => {
|
|
2
|
-
// Pending
|
|
3
|
-
expect(true).toBe(true);
|
|
4
|
-
});
|
|
5
|
-
|
|
6
|
-
// import React from 'react';
|
|
7
|
-
// import { render, screen } from '@testing-library/react';
|
|
8
|
-
// import userEvent from '@testing-library/user-event';
|
|
9
|
-
// import { Drawer } from '../Drawer';
|
|
10
|
-
// import { navigationItems, footerItems } from '../__mocks__/mocks';
|
|
11
|
-
// import { MemoryRouter } from 'react-router-dom';
|
|
12
|
-
|
|
13
|
-
// let navDrawer: HTMLElement;
|
|
14
|
-
|
|
15
|
-
// describe('Drawer', () => {
|
|
16
|
-
// describe('expanded interactions', () => {
|
|
17
|
-
// beforeEach(() => {
|
|
18
|
-
// render(
|
|
19
|
-
// <MemoryRouter>
|
|
20
|
-
// <Drawer
|
|
21
|
-
// logoIcon={'indico-o'}
|
|
22
|
-
// logoText={'INDICO INSIGHTS'}
|
|
23
|
-
// navigationItems={navigationItems}
|
|
24
|
-
// footerItems={footerItems}
|
|
25
|
-
// $expandedWidth="300"
|
|
26
|
-
// $collapsedWidth="45"
|
|
27
|
-
// data-testid="navigation__drawer"
|
|
28
|
-
// />
|
|
29
|
-
// ,
|
|
30
|
-
// </MemoryRouter>,
|
|
31
|
-
// );
|
|
32
|
-
// navDrawer = screen.getByTestId('navigation__drawer');
|
|
33
|
-
// });
|
|
34
|
-
|
|
35
|
-
// it('opens the drawer when the mouse is over the drawer', async () => {
|
|
36
|
-
// expect(navDrawer).toHaveAttribute('aria-expanded', 'false');
|
|
37
|
-
|
|
38
|
-
// await userEvent.hover(navDrawer);
|
|
39
|
-
// expect(navDrawer).toHaveAttribute('aria-expanded', 'true');
|
|
40
|
-
// });
|
|
41
|
-
|
|
42
|
-
// it('closes the drawer when the mouse is over the drawer and then leaves the drawer', async () => {
|
|
43
|
-
// expect(navDrawer).toHaveAttribute('aria-expanded', 'false');
|
|
44
|
-
// await userEvent.hover(navDrawer);
|
|
45
|
-
|
|
46
|
-
// expect(navDrawer).toHaveAttribute('aria-expanded', 'true');
|
|
47
|
-
// await userEvent.unhover(navDrawer);
|
|
48
|
-
// expect(navDrawer).toHaveAttribute('aria-expanded', 'false');
|
|
49
|
-
// });
|
|
50
|
-
// });
|
|
51
|
-
|
|
52
|
-
// describe('styling', () => {
|
|
53
|
-
// beforeEach(() => {
|
|
54
|
-
// render(
|
|
55
|
-
// <MemoryRouter>
|
|
56
|
-
// <Drawer
|
|
57
|
-
// logoIcon={'indico-o'}
|
|
58
|
-
// logoText={'INDICO INSIGHTS'}
|
|
59
|
-
// navigationItems={navigationItems}
|
|
60
|
-
// footerItems={footerItems}
|
|
61
|
-
// $expandedWidth="400"
|
|
62
|
-
// $collapsedWidth="45"
|
|
63
|
-
// data-testid="navigation__drawer"
|
|
64
|
-
// />
|
|
65
|
-
// ,
|
|
66
|
-
// </MemoryRouter>,
|
|
67
|
-
// );
|
|
68
|
-
// navDrawer = screen.getByTestId('navigation__drawer');
|
|
69
|
-
// });
|
|
70
|
-
|
|
71
|
-
// it('applies the drawer--open class to the component when the drawer is open', async () => {
|
|
72
|
-
// expect(navDrawer).toHaveClass('drawer--closed');
|
|
73
|
-
// await userEvent.hover(navDrawer);
|
|
74
|
-
|
|
75
|
-
// expect(navDrawer).toHaveAttribute('aria-expanded', 'true');
|
|
76
|
-
// expect(navDrawer).toHaveClass('drawer--open');
|
|
77
|
-
// });
|
|
78
|
-
|
|
79
|
-
// it('applies the drawer--closed class to the component when the drawer is closed', async () => {
|
|
80
|
-
// expect(navDrawer).toHaveClass('drawer--closed');
|
|
81
|
-
// await userEvent.hover(navDrawer);
|
|
82
|
-
|
|
83
|
-
// expect(navDrawer).toHaveClass('drawer--open');
|
|
84
|
-
// await userEvent.unhover(navDrawer);
|
|
85
|
-
// expect(navDrawer).toHaveClass('drawer--closed');
|
|
86
|
-
// });
|
|
87
|
-
|
|
88
|
-
// it('sets the drawer width to the min width value passed in as a prop when drawer is closed', () => {
|
|
89
|
-
// expect(navDrawer).toHaveClass('drawer--closed');
|
|
90
|
-
// expect(navDrawer).toHaveStyle({ width: '45px' });
|
|
91
|
-
// });
|
|
92
|
-
|
|
93
|
-
// it('sets the drawer width to the max width value passed in as a prop when drawer is open', async () => {
|
|
94
|
-
// await userEvent.hover(navDrawer);
|
|
95
|
-
|
|
96
|
-
// expect(navDrawer).toHaveClass('drawer--open');
|
|
97
|
-
// expect(navDrawer).toHaveStyle({ width: '400px' });
|
|
98
|
-
// });
|
|
99
|
-
// });
|
|
100
|
-
|
|
101
|
-
// describe('Logo and Header Display', () => {
|
|
102
|
-
// it('displays the header component when one is provided', () => {
|
|
103
|
-
// render(
|
|
104
|
-
// <MemoryRouter>
|
|
105
|
-
// <Drawer
|
|
106
|
-
// navigationItems={navigationItems}
|
|
107
|
-
// footerItems={footerItems}
|
|
108
|
-
// data-testid="navigation__drawer"
|
|
109
|
-
// $expandedWidth="400"
|
|
110
|
-
// $collapsedWidth="45"
|
|
111
|
-
// headerComponent={<div>Header Component</div>}
|
|
112
|
-
// />
|
|
113
|
-
// ,
|
|
114
|
-
// </MemoryRouter>,
|
|
115
|
-
// );
|
|
116
|
-
|
|
117
|
-
// navDrawer = screen.getByTestId('navigation__drawer');
|
|
118
|
-
|
|
119
|
-
// expect(screen.getByText('Header Component')).toBeInTheDocument();
|
|
120
|
-
// });
|
|
121
|
-
// it('displays the logo icon and text when no header component is provided', async () => {
|
|
122
|
-
// render(
|
|
123
|
-
// <MemoryRouter>
|
|
124
|
-
// <Drawer
|
|
125
|
-
// logoIcon={'indico-o'}
|
|
126
|
-
// logoText={'INDICO INSIGHTS'}
|
|
127
|
-
// navigationItems={navigationItems}
|
|
128
|
-
// footerItems={footerItems}
|
|
129
|
-
// data-testid="navigation__drawer"
|
|
130
|
-
// />
|
|
131
|
-
// ,
|
|
132
|
-
// </MemoryRouter>,
|
|
133
|
-
// );
|
|
134
|
-
// navDrawer = screen.getByTestId('navigation__drawer');
|
|
135
|
-
|
|
136
|
-
// await userEvent.hover(navDrawer);
|
|
137
|
-
// const logoIcon = screen.getByTestId('logo-icon');
|
|
138
|
-
// const logoText = screen.getByText('INDICO INSIGHTS');
|
|
139
|
-
|
|
140
|
-
// expect(logoIcon).toBeInTheDocument();
|
|
141
|
-
// expect(logoText).toBeInTheDocument();
|
|
142
|
-
// expect(logoText).toHaveAttribute('aria-hidden', 'false');
|
|
143
|
-
// expect(logoText).toBeVisible();
|
|
144
|
-
// expect(logoIcon).toBeVisible();
|
|
145
|
-
// });
|
|
146
|
-
// });
|
|
147
|
-
// describe('Conditional Rendering Of Lists', () => {
|
|
148
|
-
// it('does not display nav or footer lists if props are empty', () => {
|
|
149
|
-
// render(
|
|
150
|
-
// <MemoryRouter>
|
|
151
|
-
// <Drawer navigationItems={[]} footerItems={[]} data-testid="navigation__drawer" />,
|
|
152
|
-
// </MemoryRouter>,
|
|
153
|
-
// );
|
|
154
|
-
|
|
155
|
-
// const nav = screen.queryByTestId('drawer-navigation');
|
|
156
|
-
// const footer = screen.queryByTestId('drawer-footer');
|
|
157
|
-
|
|
158
|
-
// expect(nav).not.toBeInTheDocument();
|
|
159
|
-
// expect(footer).not.toBeInTheDocument();
|
|
160
|
-
// });
|
|
161
|
-
// it('displays nav and footer lists if props are not empty', () => {
|
|
162
|
-
// render(
|
|
163
|
-
// <MemoryRouter>
|
|
164
|
-
// <Drawer
|
|
165
|
-
// navigationItems={navigationItems}
|
|
166
|
-
// footerItems={footerItems}
|
|
167
|
-
// data-testid="navigation__drawer"
|
|
168
|
-
// />
|
|
169
|
-
// ,
|
|
170
|
-
// </MemoryRouter>,
|
|
171
|
-
// );
|
|
172
|
-
|
|
173
|
-
// const nav = screen.getByTestId('drawer-navigation');
|
|
174
|
-
// const footer = screen.getByTestId('drawer-footer');
|
|
175
|
-
|
|
176
|
-
// expect(nav).toBeInTheDocument();
|
|
177
|
-
// expect(footer).toBeInTheDocument();
|
|
178
|
-
// });
|
|
179
|
-
// });
|
|
180
|
-
// });
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import { DrawerLinkList } from '../DrawerLinkList';
|
|
4
|
-
import { navigationItems } from '../__mocks__/mocks';
|
|
5
|
-
import { MemoryRouter } from 'react-router-dom';
|
|
6
|
-
|
|
7
|
-
describe('DrawerLinkList', () => {
|
|
8
|
-
describe('expanded interactions', () => {
|
|
9
|
-
it('it renders the correct number of items in the list', () => {
|
|
10
|
-
render(
|
|
11
|
-
<MemoryRouter>
|
|
12
|
-
<DrawerLinkList isOpen={true} listItems={navigationItems} />
|
|
13
|
-
</MemoryRouter>,
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
const list = screen.getAllByRole('listitem');
|
|
17
|
-
expect(list).toHaveLength(navigationItems.length);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
// NOTE, the default path for the purpose of this test is `/` which matches the prop value.
|
|
21
|
-
it('hides the label when isOpen is false', () => {
|
|
22
|
-
render(
|
|
23
|
-
<MemoryRouter>
|
|
24
|
-
<DrawerLinkList isOpen={false} listItems={navigationItems} />
|
|
25
|
-
</MemoryRouter>,
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
const items = screen.queryAllByTestId('list-item-label');
|
|
29
|
-
items.map((item) => {
|
|
30
|
-
expect(item).not.toBeVisible();
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
it('shows the label when isOpen is true', () => {
|
|
34
|
-
render(
|
|
35
|
-
<MemoryRouter>
|
|
36
|
-
<DrawerLinkList isOpen={true} listItems={navigationItems} />
|
|
37
|
-
</MemoryRouter>,
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
const items = screen.queryAllByTestId('list-item-label');
|
|
41
|
-
items.map((item) => {
|
|
42
|
-
expect(item).toBeVisible();
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
it('sets active class on handleActiveLink match', () => {
|
|
46
|
-
render(
|
|
47
|
-
<MemoryRouter>
|
|
48
|
-
<DrawerLinkList isOpen={true} listItems={navigationItems} />
|
|
49
|
-
</MemoryRouter>,
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
const lineItem = screen.getByTestId('link-list-item-Libraries');
|
|
53
|
-
expect(lineItem).toHaveClass('drawer__list__item--active');
|
|
54
|
-
});
|
|
55
|
-
it('does not render a list when no items are passed to the component', () => {
|
|
56
|
-
render(
|
|
57
|
-
<MemoryRouter>
|
|
58
|
-
<DrawerLinkList isOpen={true} listItems={[]} />
|
|
59
|
-
</MemoryRouter>,
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
const list = screen.queryAllByRole('listitem');
|
|
63
|
-
expect(list).toHaveLength(0);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Drawer } from './Drawer';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Drawer } from './Drawer';
|