@amsterdam/design-system-react 2.1.0 → 2.2.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/dist/Avatar/Avatar.d.ts +2 -2
- package/dist/Card/Card.d.ts +1 -1
- package/dist/Card/CardHeading.d.ts +1 -1
- package/dist/Checkbox/Checkbox.d.ts +1 -1
- package/dist/DateInput/DateInput.d.ts +1 -1
- package/dist/FieldSet/FieldSet.d.ts +11 -0
- package/dist/FieldSet/FieldSet.js +3 -3
- package/dist/Hint/Hint.d.ts +1 -0
- package/dist/Hint/Hint.js +2 -2
- package/dist/Image/Image.js +1 -1
- package/dist/Label/Label.d.ts +11 -0
- package/dist/Label/Label.js +2 -2
- package/dist/LinkList/LinkList.d.ts +1 -1
- package/dist/Menu/MenuLink.d.ts +2 -2
- package/dist/Page/Page.d.ts +6 -2
- package/dist/Page/Page.js +1 -1
- package/dist/PageHeader/PageHeader.d.ts +1 -0
- package/dist/PageHeader/PageHeaderMenuIcon.js +1 -1
- package/dist/PageHeader/PageHeaderMenuLink.d.ts +7 -0
- package/dist/PageHeader/PageHeaderMenuLink.js +3 -2
- package/dist/PasswordInput/PasswordInput.d.ts +1 -1
- package/dist/Radio/Radio.d.ts +1 -1
- package/dist/SearchField/SearchField.d.ts +1 -1
- package/dist/TimeInput/TimeInput.d.ts +1 -1
- package/dist/index.cjs.js +29 -28
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1935 -61
- package/dist/index.esm.js +29 -28
- package/dist/index.esm.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/dist/Accordion/Accordion.test.d.ts +0 -5
- package/dist/Accordion/Accordion.test.js +0 -44
- package/dist/Accordion/AccordionSection.test.d.ts +0 -5
- package/dist/Accordion/AccordionSection.test.js +0 -100
- package/dist/ActionGroup/ActionGroup.test.d.ts +0 -5
- package/dist/ActionGroup/ActionGroup.test.js +0 -33
- package/dist/Alert/Alert.test.d.ts +0 -5
- package/dist/Alert/Alert.test.js +0 -74
- package/dist/App/App.d.ts +0 -12
- package/dist/App/App.js +0 -8
- package/dist/App/App.test.d.ts +0 -5
- package/dist/App/App.test.js +0 -33
- package/dist/App/index.d.ts +0 -6
- package/dist/App/index.js +0 -5
- package/dist/AppNavigation/AppNavigation.d.ts +0 -45
- package/dist/AppNavigation/AppNavigation.js +0 -18
- package/dist/AppNavigation/AppNavigation.test.d.ts +0 -5
- package/dist/AppNavigation/AppNavigation.test.js +0 -33
- package/dist/AppNavigation/AppNavigationButton.d.ts +0 -18
- package/dist/AppNavigation/AppNavigationButton.js +0 -17
- package/dist/AppNavigation/AppNavigationLink.d.ts +0 -19
- package/dist/AppNavigation/AppNavigationLink.js +0 -19
- package/dist/AppNavigation/AppNavigationMenu.d.ts +0 -9
- package/dist/AppNavigation/AppNavigationMenu.js +0 -5
- package/dist/AppNavigation/index.d.ts +0 -6
- package/dist/AppNavigation/index.js +0 -5
- package/dist/Avatar/Avatar.test.d.ts +0 -5
- package/dist/Avatar/Avatar.test.js +0 -63
- package/dist/Badge/Badge.test.d.ts +0 -5
- package/dist/Badge/Badge.test.js +0 -43
- package/dist/Blockquote/Blockquote.test.d.ts +0 -5
- package/dist/Blockquote/Blockquote.test.js +0 -46
- package/dist/Breadcrumb/Breadcrumb.test.d.ts +0 -5
- package/dist/Breadcrumb/Breadcrumb.test.js +0 -45
- package/dist/Breadcrumb/BreadcrumbLink.test.d.ts +0 -5
- package/dist/Breadcrumb/BreadcrumbLink.test.js +0 -40
- package/dist/Breakout/Breakout.test.d.ts +0 -5
- package/dist/Breakout/Breakout.test.js +0 -62
- package/dist/Breakout/BreakoutCell.test.d.ts +0 -5
- package/dist/Breakout/BreakoutCell.test.js +0 -128
- package/dist/Button/Button.test.d.ts +0 -5
- package/dist/Button/Button.test.js +0 -114
- package/dist/CallToActionLink/CallToActionLink.test.d.ts +0 -5
- package/dist/CallToActionLink/CallToActionLink.test.js +0 -33
- package/dist/Card/Card.test.d.ts +0 -5
- package/dist/Card/Card.test.js +0 -33
- package/dist/Card/CardHeading.test.d.ts +0 -5
- package/dist/Card/CardHeading.test.js +0 -38
- package/dist/Card/CardHeadingGroup.test.d.ts +0 -5
- package/dist/Card/CardHeadingGroup.test.js +0 -38
- package/dist/Card/CardImage.test.d.ts +0 -5
- package/dist/Card/CardImage.test.js +0 -33
- package/dist/Card/CardLink.test.d.ts +0 -5
- package/dist/Card/CardLink.test.js +0 -33
- package/dist/CharacterCount/CharacterCount.test.d.ts +0 -5
- package/dist/CharacterCount/CharacterCount.test.js +0 -38
- package/dist/Checkbox/Checkbox.test.d.ts +0 -5
- package/dist/Checkbox/Checkbox.test.js +0 -142
- package/dist/Column/Column.test.d.ts +0 -5
- package/dist/Column/Column.test.js +0 -59
- package/dist/DateInput/DateInput.test.d.ts +0 -5
- package/dist/DateInput/DateInput.test.js +0 -58
- package/dist/DescriptionList/DescriptionList.test.d.ts +0 -5
- package/dist/DescriptionList/DescriptionList.test.js +0 -43
- package/dist/DescriptionList/DescriptionListDescription.test.d.ts +0 -5
- package/dist/DescriptionList/DescriptionListDescription.test.js +0 -33
- package/dist/DescriptionList/DescriptionListSection.test.d.ts +0 -5
- package/dist/DescriptionList/DescriptionListSection.test.js +0 -33
- package/dist/DescriptionList/DescriptionListTerm.test.d.ts +0 -5
- package/dist/DescriptionList/DescriptionListTerm.test.js +0 -33
- package/dist/Dialog/Dialog.test.d.ts +0 -5
- package/dist/Dialog/Dialog.test.js +0 -82
- package/dist/ErrorMessage/ErrorMessage.test.d.ts +0 -5
- package/dist/ErrorMessage/ErrorMessage.test.js +0 -53
- package/dist/Field/Field.test.d.ts +0 -5
- package/dist/Field/Field.test.js +0 -38
- package/dist/FieldSet/FieldSet.test.d.ts +0 -5
- package/dist/FieldSet/FieldSet.test.js +0 -70
- package/dist/Figure/Figure.test.d.ts +0 -5
- package/dist/Figure/Figure.test.js +0 -33
- package/dist/Figure/FigureCaption.test.d.ts +0 -5
- package/dist/Figure/FigureCaption.test.js +0 -38
- package/dist/FileInput/FileInput.test.d.ts +0 -5
- package/dist/FileInput/FileInput.test.js +0 -33
- package/dist/FileList/FileList.test.d.ts +0 -5
- package/dist/FileList/FileList.test.js +0 -33
- package/dist/FileList/FileListItem.test.d.ts +0 -5
- package/dist/FileList/FileListItem.test.js +0 -44
- package/dist/Grid/Grid.test.d.ts +0 -5
- package/dist/Grid/Grid.test.js +0 -69
- package/dist/Grid/GridCell.test.d.ts +0 -5
- package/dist/Grid/GridCell.test.js +0 -84
- package/dist/Heading/Heading.test.d.ts +0 -5
- package/dist/Heading/Heading.test.js +0 -70
- package/dist/Hint/Hint.test.d.ts +0 -5
- package/dist/Hint/Hint.test.js +0 -53
- package/dist/Icon/Icon.test.d.ts +0 -5
- package/dist/Icon/Icon.test.js +0 -60
- package/dist/IconButton/IconButton.test.d.ts +0 -5
- package/dist/IconButton/IconButton.test.js +0 -48
- package/dist/Image/Image.test.d.ts +0 -5
- package/dist/Image/Image.test.js +0 -43
- package/dist/ImageSlider/ImageSlider.test.d.ts +0 -5
- package/dist/ImageSlider/ImageSlider.test.js +0 -70
- package/dist/ImageSlider/ImageSliderControls.test.d.ts +0 -5
- package/dist/ImageSlider/ImageSliderControls.test.js +0 -25
- package/dist/ImageSlider/ImageSliderItem.test.d.ts +0 -5
- package/dist/ImageSlider/ImageSliderItem.test.js +0 -37
- package/dist/ImageSlider/ImageSliderScroller.test.d.ts +0 -5
- package/dist/ImageSlider/ImageSliderScroller.test.js +0 -37
- package/dist/ImageSlider/ImageSliderThumbnails.test.d.ts +0 -5
- package/dist/ImageSlider/ImageSliderThumbnails.test.js +0 -52
- package/dist/InvalidFormAlert/InvalidFormAlert.test.d.ts +0 -5
- package/dist/InvalidFormAlert/InvalidFormAlert.test.js +0 -108
- package/dist/Label/Label.test.d.ts +0 -5
- package/dist/Label/Label.test.js +0 -82
- package/dist/Link/Link.test.d.ts +0 -5
- package/dist/Link/Link.test.js +0 -43
- package/dist/LinkList/LinkList.test.d.ts +0 -5
- package/dist/LinkList/LinkList.test.js +0 -33
- package/dist/LinkList/LinkListLink.test.d.ts +0 -5
- package/dist/LinkList/LinkListLink.test.js +0 -54
- package/dist/Logo/Logo.test.d.ts +0 -5
- package/dist/Logo/Logo.test.js +0 -33
- package/dist/Mark/Mark.test.d.ts +0 -5
- package/dist/Mark/Mark.test.js +0 -33
- package/dist/Menu/Menu.test.d.ts +0 -5
- package/dist/Menu/Menu.test.js +0 -55
- package/dist/Menu/MenuLink.test.d.ts +0 -5
- package/dist/Menu/MenuLink.test.js +0 -56
- package/dist/OrderedList/OrderedList.test.d.ts +0 -5
- package/dist/OrderedList/OrderedList.test.js +0 -55
- package/dist/OrderedList/OrderedListItem.test.d.ts +0 -5
- package/dist/OrderedList/OrderedListItem.test.js +0 -32
- package/dist/Overlap/Overlap.test.d.ts +0 -5
- package/dist/Overlap/Overlap.test.js +0 -38
- package/dist/Page/Page.test.d.ts +0 -5
- package/dist/Page/Page.test.js +0 -33
- package/dist/PageFooter/PageFooter.test.d.ts +0 -5
- package/dist/PageFooter/PageFooter.test.js +0 -33
- package/dist/PageFooter/PageFooterMenu.test.d.ts +0 -5
- package/dist/PageFooter/PageFooterMenu.test.js +0 -35
- package/dist/PageFooter/PageFooterMenuLink.test.d.ts +0 -5
- package/dist/PageFooter/PageFooterMenuLink.test.js +0 -33
- package/dist/PageFooter/PageFooterSpotlight.test.d.ts +0 -5
- package/dist/PageFooter/PageFooterSpotlight.test.js +0 -33
- package/dist/PageHeader/PageHeader.test.d.ts +0 -6
- package/dist/PageHeader/PageHeader.test.js +0 -131
- package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.test.d.ts +0 -5
- package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.test.js +0 -38
- package/dist/PageHeader/PageHeaderMenuLink.test.d.ts +0 -5
- package/dist/PageHeader/PageHeaderMenuLink.test.js +0 -45
- package/dist/PageHeading/PageHeading.test.d.ts +0 -5
- package/dist/PageHeading/PageHeading.test.js +0 -40
- package/dist/Pagination/Pagination.test.d.ts +0 -5
- package/dist/Pagination/Pagination.test.js +0 -137
- package/dist/Paragraph/Paragraph.test.d.ts +0 -5
- package/dist/Paragraph/Paragraph.test.js +0 -62
- package/dist/PasswordInput/PasswordInput.test.d.ts +0 -5
- package/dist/PasswordInput/PasswordInput.test.js +0 -89
- package/dist/Radio/Radio.test.d.ts +0 -5
- package/dist/Radio/Radio.test.js +0 -134
- package/dist/Row/Row.test.d.ts +0 -5
- package/dist/Row/Row.test.js +0 -64
- package/dist/SearchField/SearchField.test.d.ts +0 -5
- package/dist/SearchField/SearchField.test.js +0 -33
- package/dist/SearchField/SearchFieldButton.test.d.ts +0 -5
- package/dist/SearchField/SearchFieldButton.test.js +0 -47
- package/dist/SearchField/SearchFieldInput.test.d.ts +0 -5
- package/dist/SearchField/SearchFieldInput.test.js +0 -65
- package/dist/Select/Select.test.d.ts +0 -5
- package/dist/Select/Select.test.js +0 -74
- package/dist/Select/SelectOption.test.d.ts +0 -5
- package/dist/Select/SelectOption.test.js +0 -45
- package/dist/Select/SelectOptionGroup.test.d.ts +0 -5
- package/dist/Select/SelectOptionGroup.test.js +0 -45
- package/dist/SkipLink/SkipLink.test.d.ts +0 -5
- package/dist/SkipLink/SkipLink.test.js +0 -33
- package/dist/Spotlight/Spotlight.test.d.ts +0 -5
- package/dist/Spotlight/Spotlight.test.js +0 -46
- package/dist/StandaloneLink/StandaloneLink.test.d.ts +0 -5
- package/dist/StandaloneLink/StandaloneLink.test.js +0 -46
- package/dist/Switch/Switch.test.d.ts +0 -5
- package/dist/Switch/Switch.test.js +0 -69
- package/dist/Table/Table.test.d.ts +0 -5
- package/dist/Table/Table.test.js +0 -33
- package/dist/Table/TableBody.test.d.ts +0 -5
- package/dist/Table/TableBody.test.js +0 -34
- package/dist/Table/TableCaption.test.d.ts +0 -5
- package/dist/Table/TableCaption.test.js +0 -45
- package/dist/Table/TableCell.test.d.ts +0 -5
- package/dist/Table/TableCell.test.js +0 -36
- package/dist/Table/TableFooter.test.d.ts +0 -5
- package/dist/Table/TableFooter.test.js +0 -34
- package/dist/Table/TableHeader.test.d.ts +0 -5
- package/dist/Table/TableHeader.test.js +0 -34
- package/dist/Table/TableHeaderCell.test.d.ts +0 -5
- package/dist/Table/TableHeaderCell.test.js +0 -42
- package/dist/Table/TableRow.test.d.ts +0 -5
- package/dist/Table/TableRow.test.js +0 -35
- package/dist/TableOfContents/TableOfContents.test.d.ts +0 -5
- package/dist/TableOfContents/TableOfContents.test.js +0 -44
- package/dist/TableOfContents/TableOfContentsLink.test.d.ts +0 -5
- package/dist/TableOfContents/TableOfContentsLink.test.js +0 -34
- package/dist/TableOfContents/TableOfContentsList.test.d.ts +0 -5
- package/dist/TableOfContents/TableOfContentsList.test.js +0 -40
- package/dist/Tabs/Tabs.test.d.ts +0 -5
- package/dist/Tabs/Tabs.test.js +0 -104
- package/dist/Tabs/TabsButton.test.d.ts +0 -5
- package/dist/Tabs/TabsButton.test.js +0 -57
- package/dist/Tabs/TabsList.test.d.ts +0 -5
- package/dist/Tabs/TabsList.test.js +0 -32
- package/dist/Tabs/TabsPanel.test.d.ts +0 -5
- package/dist/Tabs/TabsPanel.test.js +0 -42
- package/dist/TextArea/TextArea.test.d.ts +0 -5
- package/dist/TextArea/TextArea.test.js +0 -105
- package/dist/TextInput/TextInput.test.d.ts +0 -5
- package/dist/TextInput/TextInput.test.js +0 -92
- package/dist/TimeInput/TimeInput.test.d.ts +0 -5
- package/dist/TimeInput/TimeInput.test.js +0 -51
- package/dist/UnorderedList/UnorderedList.test.d.ts +0 -5
- package/dist/UnorderedList/UnorderedList.test.js +0 -55
- package/dist/UnorderedList/UnorderedListItem.test.d.ts +0 -5
- package/dist/UnorderedList/UnorderedListItem.test.js +0 -32
- package/dist/common/formatFileSize.test.d.ts +0 -5
- package/dist/common/formatFileSize.test.js +0 -22
- package/dist/common/formatFileType.test.d.ts +0 -5
- package/dist/common/formatFileType.test.js +0 -27
- package/dist/common/useKeyboardFocus.test.d.ts +0 -5
- package/dist/common/useKeyboardFocus.test.js +0 -79
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import { render, screen } from '@testing-library/react';
|
|
7
|
-
import { createRef } from 'react';
|
|
8
|
-
import { Table } from './Table';
|
|
9
|
-
import { TableFooter } from './TableFooter';
|
|
10
|
-
import '@testing-library/jest-dom';
|
|
11
|
-
describe('Table footer', () => {
|
|
12
|
-
it('renders', () => {
|
|
13
|
-
render(_jsx(Table, { children: _jsx(TableFooter, {}) }));
|
|
14
|
-
const component = screen.getByRole('rowgroup');
|
|
15
|
-
expect(component).toBeInTheDocument();
|
|
16
|
-
expect(component).toBeVisible();
|
|
17
|
-
});
|
|
18
|
-
it('renders a design system BEM class name', () => {
|
|
19
|
-
render(_jsx(Table, { children: _jsx(TableFooter, {}) }));
|
|
20
|
-
const component = screen.getByRole('rowgroup');
|
|
21
|
-
expect(component).toHaveClass('ams-table__footer');
|
|
22
|
-
});
|
|
23
|
-
it('renders an extra class name', () => {
|
|
24
|
-
render(_jsx(Table, { children: _jsx(TableFooter, { className: "extra" }) }));
|
|
25
|
-
const component = screen.getByRole('rowgroup');
|
|
26
|
-
expect(component).toHaveClass('ams-table__footer extra');
|
|
27
|
-
});
|
|
28
|
-
it('supports ForwardRef in React', () => {
|
|
29
|
-
const ref = createRef();
|
|
30
|
-
render(_jsx(Table, { children: _jsx(TableFooter, { ref: ref }) }));
|
|
31
|
-
const component = screen.getByRole('rowgroup');
|
|
32
|
-
expect(ref.current).toBe(component);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import { render, screen } from '@testing-library/react';
|
|
7
|
-
import { createRef } from 'react';
|
|
8
|
-
import { Table } from './Table';
|
|
9
|
-
import { TableHeader } from './TableHeader';
|
|
10
|
-
import '@testing-library/jest-dom';
|
|
11
|
-
describe('Table header', () => {
|
|
12
|
-
it('renders', () => {
|
|
13
|
-
render(_jsx(Table, { children: _jsx(TableHeader, {}) }));
|
|
14
|
-
const component = screen.getByRole('rowgroup');
|
|
15
|
-
expect(component).toBeInTheDocument();
|
|
16
|
-
expect(component).toBeVisible();
|
|
17
|
-
});
|
|
18
|
-
it('renders a design system BEM class name', () => {
|
|
19
|
-
render(_jsx(Table, { children: _jsx(TableHeader, {}) }));
|
|
20
|
-
const component = screen.getByRole('rowgroup');
|
|
21
|
-
expect(component).toHaveClass('ams-table__header');
|
|
22
|
-
});
|
|
23
|
-
it('renders an extra class name', () => {
|
|
24
|
-
render(_jsx(Table, { children: _jsx(TableHeader, { className: "extra" }) }));
|
|
25
|
-
const component = screen.getByRole('rowgroup');
|
|
26
|
-
expect(component).toHaveClass('ams-table__header extra');
|
|
27
|
-
});
|
|
28
|
-
it('supports ForwardRef in React', () => {
|
|
29
|
-
const ref = createRef();
|
|
30
|
-
render(_jsx(Table, { children: _jsx(TableHeader, { ref: ref }) }));
|
|
31
|
-
const component = screen.getByRole('rowgroup');
|
|
32
|
-
expect(ref.current).toBe(component);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import { render, screen } from '@testing-library/react';
|
|
7
|
-
import { createRef } from 'react';
|
|
8
|
-
import { Table } from './Table';
|
|
9
|
-
import { TableHeader } from './TableHeader';
|
|
10
|
-
import { TableHeaderCell } from './TableHeaderCell';
|
|
11
|
-
import { TableRow } from './TableRow';
|
|
12
|
-
import '@testing-library/jest-dom';
|
|
13
|
-
describe('Table header cell', () => {
|
|
14
|
-
it('renders', () => {
|
|
15
|
-
render(_jsx(Table, { children: _jsx(TableHeader, { children: _jsx(TableRow, { children: _jsx(TableHeaderCell, { children: "Data" }) }) }) }));
|
|
16
|
-
const component = screen.getByRole('columnheader');
|
|
17
|
-
expect(component).toBeInTheDocument();
|
|
18
|
-
expect(component).toBeVisible();
|
|
19
|
-
});
|
|
20
|
-
it('renders a rowheader when you specify it', () => {
|
|
21
|
-
render(_jsx(Table, { children: _jsx(TableHeader, { children: _jsx(TableRow, { children: _jsx(TableHeaderCell, { scope: "row", children: "Data" }) }) }) }));
|
|
22
|
-
const component = screen.getByRole('rowheader');
|
|
23
|
-
expect(component).toBeInTheDocument();
|
|
24
|
-
expect(component).toBeVisible();
|
|
25
|
-
});
|
|
26
|
-
it('renders a design system BEM class name', () => {
|
|
27
|
-
render(_jsx(Table, { children: _jsx(TableHeader, { children: _jsx(TableRow, { children: _jsx(TableHeaderCell, { children: "Data" }) }) }) }));
|
|
28
|
-
const component = screen.getByRole('columnheader');
|
|
29
|
-
expect(component).toHaveClass('ams-table__header-cell');
|
|
30
|
-
});
|
|
31
|
-
it('renders an extra class name', () => {
|
|
32
|
-
render(_jsx(Table, { children: _jsx(TableHeader, { children: _jsx(TableRow, { children: _jsx(TableHeaderCell, { className: "extra", children: "Data" }) }) }) }));
|
|
33
|
-
const component = screen.getByRole('columnheader');
|
|
34
|
-
expect(component).toHaveClass('ams-table__header-cell extra');
|
|
35
|
-
});
|
|
36
|
-
it('supports ForwardRef in React', () => {
|
|
37
|
-
const ref = createRef();
|
|
38
|
-
render(_jsx(Table, { children: _jsx(TableHeader, { children: _jsx(TableRow, { children: _jsx(TableHeaderCell, { ref: ref, children: "Data" }) }) }) }));
|
|
39
|
-
const component = screen.getByRole('columnheader');
|
|
40
|
-
expect(ref.current).toBe(component);
|
|
41
|
-
});
|
|
42
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import { render, screen } from '@testing-library/react';
|
|
7
|
-
import { createRef } from 'react';
|
|
8
|
-
import { Table } from './Table';
|
|
9
|
-
import { TableBody } from './TableBody';
|
|
10
|
-
import { TableRow } from './TableRow';
|
|
11
|
-
import '@testing-library/jest-dom';
|
|
12
|
-
describe('Table row', () => {
|
|
13
|
-
it('renders', () => {
|
|
14
|
-
render(_jsx(Table, { children: _jsx(TableBody, { children: _jsx(TableRow, {}) }) }));
|
|
15
|
-
const component = screen.getByRole('row');
|
|
16
|
-
expect(component).toBeInTheDocument();
|
|
17
|
-
expect(component).toBeVisible();
|
|
18
|
-
});
|
|
19
|
-
it('renders a design system BEM class name', () => {
|
|
20
|
-
render(_jsx(Table, { children: _jsx(TableBody, { children: _jsx(TableRow, {}) }) }));
|
|
21
|
-
const component = screen.getByRole('row');
|
|
22
|
-
expect(component).toHaveClass('ams-table__row');
|
|
23
|
-
});
|
|
24
|
-
it('renders an extra class name', () => {
|
|
25
|
-
render(_jsx(Table, { children: _jsx(TableBody, { children: _jsx(TableRow, { className: "extra" }) }) }));
|
|
26
|
-
const component = screen.getByRole('row');
|
|
27
|
-
expect(component).toHaveClass('ams-table__row extra');
|
|
28
|
-
});
|
|
29
|
-
it('supports ForwardRef in React', () => {
|
|
30
|
-
const ref = createRef();
|
|
31
|
-
render(_jsx(Table, { children: _jsx(TableBody, { children: _jsx(TableRow, { ref: ref }) }) }));
|
|
32
|
-
const component = screen.getByRole('row');
|
|
33
|
-
expect(ref.current).toBe(component);
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import { render, screen } from '@testing-library/react';
|
|
7
|
-
import { createRef } from 'react';
|
|
8
|
-
import { TableOfContents } from './TableOfContents';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Table of contents', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
const { container } = render(_jsx(TableOfContents, {}));
|
|
13
|
-
const component = container.querySelector(':only-child');
|
|
14
|
-
expect(component).toBeInTheDocument();
|
|
15
|
-
expect(component).toBeVisible();
|
|
16
|
-
});
|
|
17
|
-
it('renders its children', () => {
|
|
18
|
-
render(_jsx(TableOfContents, { children: _jsx(TableOfContents.List, {}) }));
|
|
19
|
-
const testChild = screen.getByRole('list');
|
|
20
|
-
expect(testChild).toBeTruthy();
|
|
21
|
-
});
|
|
22
|
-
it('renders a heading', () => {
|
|
23
|
-
render(_jsx(TableOfContents, { heading: "Test heading" }));
|
|
24
|
-
const heading = screen.getByRole('heading');
|
|
25
|
-
expect(heading).toBeInTheDocument();
|
|
26
|
-
expect(heading).toHaveTextContent('Test heading');
|
|
27
|
-
});
|
|
28
|
-
it('renders a design system BEM class name', () => {
|
|
29
|
-
const { container } = render(_jsx(TableOfContents, {}));
|
|
30
|
-
const component = container.querySelector(':only-child');
|
|
31
|
-
expect(component).toHaveClass('ams-table-of-contents');
|
|
32
|
-
});
|
|
33
|
-
it('renders an extra class name', () => {
|
|
34
|
-
const { container } = render(_jsx(TableOfContents, { className: "extra" }));
|
|
35
|
-
const component = container.querySelector(':only-child');
|
|
36
|
-
expect(component).toHaveClass('ams-table-of-contents extra');
|
|
37
|
-
});
|
|
38
|
-
it('supports ForwardRef in React', () => {
|
|
39
|
-
const ref = createRef();
|
|
40
|
-
const { container } = render(_jsx(TableOfContents, { ref: ref }));
|
|
41
|
-
const component = container.querySelector(':only-child');
|
|
42
|
-
expect(ref.current).toBe(component);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import '@testing-library/jest-dom';
|
|
7
|
-
import { render, screen } from '@testing-library/react';
|
|
8
|
-
import { createRef } from 'react';
|
|
9
|
-
import { TableOfContents } from './TableOfContents';
|
|
10
|
-
describe('Table of Contents link', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
render(_jsx(TableOfContents.Link, { href: "#", label: "Test label" }));
|
|
13
|
-
const link = screen.getByRole('link');
|
|
14
|
-
expect(link).toBeInTheDocument();
|
|
15
|
-
expect(link).toBeVisible();
|
|
16
|
-
expect(link).toHaveTextContent('Test label');
|
|
17
|
-
});
|
|
18
|
-
it('renders a design system BEM class name', () => {
|
|
19
|
-
render(_jsx(TableOfContents.Link, { href: "#", label: "Test" }));
|
|
20
|
-
const component = screen.getByRole('link');
|
|
21
|
-
expect(component).toHaveClass('ams-table-of-contents__link');
|
|
22
|
-
});
|
|
23
|
-
it('renders an extra class name', () => {
|
|
24
|
-
render(_jsx(TableOfContents.Link, { className: "extra", href: "#", label: "Test" }));
|
|
25
|
-
const component = screen.getByRole('link');
|
|
26
|
-
expect(component).toHaveClass('ams-table-of-contents__link extra');
|
|
27
|
-
});
|
|
28
|
-
it('supports ForwardRef in React', () => {
|
|
29
|
-
const ref = createRef();
|
|
30
|
-
render(_jsx(TableOfContents.Link, { href: "#", label: "Test", ref: ref }));
|
|
31
|
-
const component = screen.getByRole('link');
|
|
32
|
-
expect(ref.current).toBe(component);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import { render, screen } from '@testing-library/react';
|
|
7
|
-
import { createRef } from 'react';
|
|
8
|
-
import { TableOfContents } from './TableOfContents';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Table of Contents list', () => {
|
|
11
|
-
it('renders an HTML ul element', () => {
|
|
12
|
-
const { container } = render(_jsx(TableOfContents.List, {}));
|
|
13
|
-
const list = container.querySelector('ul:only-child');
|
|
14
|
-
expect(list).toBeInTheDocument();
|
|
15
|
-
});
|
|
16
|
-
it('renders a design system BEM class name', () => {
|
|
17
|
-
render(_jsx(TableOfContents.List, {}));
|
|
18
|
-
const component = screen.getByRole('list');
|
|
19
|
-
expect(component).toHaveClass('ams-table-of-contents__list');
|
|
20
|
-
});
|
|
21
|
-
it('renders an extra class name', () => {
|
|
22
|
-
render(_jsx(TableOfContents.List, { className: "extra" }));
|
|
23
|
-
const component = screen.getByRole('list');
|
|
24
|
-
expect(component).toHaveClass('ams-table-of-contents__list extra');
|
|
25
|
-
});
|
|
26
|
-
it('renders its subcomponent', () => {
|
|
27
|
-
const listItems = ['Item 1', 'Item 2', 'Item 3'];
|
|
28
|
-
const { container } = render(_jsx(TableOfContents.List, { children: listItems.map((item) => (_jsx(TableOfContents.Link, { label: `Link ${item}` }, item))) }));
|
|
29
|
-
const list = screen.getByRole('list');
|
|
30
|
-
const items = container.querySelectorAll('.ams-table-of-contents__item');
|
|
31
|
-
expect(list).toBeInTheDocument();
|
|
32
|
-
expect(items.length).toBe(3);
|
|
33
|
-
});
|
|
34
|
-
it('supports ForwardRef in React', () => {
|
|
35
|
-
const ref = createRef();
|
|
36
|
-
render(_jsx(TableOfContents.List, { ref: ref }));
|
|
37
|
-
const component = screen.getByRole('list');
|
|
38
|
-
expect(ref.current).toBe(component);
|
|
39
|
-
});
|
|
40
|
-
});
|
package/dist/Tabs/Tabs.test.d.ts
DELETED
package/dist/Tabs/Tabs.test.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import { render, screen } from '@testing-library/react';
|
|
7
|
-
import userEvent from '@testing-library/user-event';
|
|
8
|
-
import { createRef } from 'react';
|
|
9
|
-
import { Tabs } from './Tabs';
|
|
10
|
-
import '@testing-library/jest-dom';
|
|
11
|
-
describe('Tabs', () => {
|
|
12
|
-
it('renders', () => {
|
|
13
|
-
const { container } = render(_jsx(Tabs, {}));
|
|
14
|
-
const component = container.querySelector(':only-child');
|
|
15
|
-
expect(component).toBeInTheDocument();
|
|
16
|
-
expect(component).toBeVisible();
|
|
17
|
-
});
|
|
18
|
-
it('renders a design system BEM class name', () => {
|
|
19
|
-
const { container } = render(_jsx(Tabs, {}));
|
|
20
|
-
const component = container.querySelector(':only-child');
|
|
21
|
-
expect(component).toHaveClass('ams-tabs');
|
|
22
|
-
});
|
|
23
|
-
it('renders an extra class name', () => {
|
|
24
|
-
const { container } = render(_jsx(Tabs, { className: "extra" }));
|
|
25
|
-
const component = container.querySelector(':only-child');
|
|
26
|
-
expect(component).toHaveClass('ams-tabs extra');
|
|
27
|
-
});
|
|
28
|
-
it('supports ForwardRef in React', () => {
|
|
29
|
-
const ref = createRef();
|
|
30
|
-
const { container } = render(_jsx(Tabs, { ref: ref }));
|
|
31
|
-
const component = container.querySelector(':only-child');
|
|
32
|
-
expect(ref.current).toBe(component);
|
|
33
|
-
});
|
|
34
|
-
it('supports children', () => {
|
|
35
|
-
render(_jsxs(Tabs, { children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Button, { "aria-controls": "one", children: "Tab 1" }), _jsx(Tabs.Button, { "aria-controls": "two", children: "Tab 2" })] }), _jsx(Tabs.Panel, { id: "one", children: "Content 1" }), _jsx(Tabs.Panel, { id: "two", children: "Content 2" })] }));
|
|
36
|
-
expect(screen.getByRole('tablist')).toBeInTheDocument();
|
|
37
|
-
expect(screen.getByRole('tab', { selected: true })).toBeInTheDocument();
|
|
38
|
-
expect(screen.getByRole('tabpanel')).toBeInTheDocument();
|
|
39
|
-
});
|
|
40
|
-
it('should select a tab when clicked', async () => {
|
|
41
|
-
const user = userEvent.setup();
|
|
42
|
-
render(_jsxs(Tabs, { children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Button, { "aria-controls": "one", children: "Tab 1" }), _jsx(Tabs.Button, { "aria-controls": "two", children: "Tab 2" })] }), _jsx(Tabs.Panel, { id: "one", children: "Content 1" }), _jsx(Tabs.Panel, { id: "two", children: "Content 2" })] }));
|
|
43
|
-
const tabOne = screen.getByRole('tab', { name: 'Tab 1' });
|
|
44
|
-
const tabTwo = screen.getByRole('tab', { name: 'Tab 2' });
|
|
45
|
-
expect(tabOne).toHaveAttribute('aria-selected', 'true');
|
|
46
|
-
expect(tabOne).toHaveAttribute('tabindex', '0');
|
|
47
|
-
expect(tabTwo).toHaveAttribute('aria-selected', 'false');
|
|
48
|
-
expect(tabTwo).toHaveAttribute('tabindex', '-1');
|
|
49
|
-
expect(screen.getByRole('tabpanel')).toHaveTextContent('Content 1');
|
|
50
|
-
if (tabTwo) {
|
|
51
|
-
await user.click(tabTwo);
|
|
52
|
-
}
|
|
53
|
-
expect(tabOne).toHaveAttribute('aria-selected', 'false');
|
|
54
|
-
expect(tabOne).toHaveAttribute('tabindex', '-1');
|
|
55
|
-
expect(tabTwo).toHaveAttribute('aria-selected', 'true');
|
|
56
|
-
expect(tabTwo).toHaveAttribute('tabindex', '0');
|
|
57
|
-
expect(screen.getByRole('tabpanel')).toHaveTextContent('Content 2');
|
|
58
|
-
});
|
|
59
|
-
it('calls onTabChange with the newly activated tab', async () => {
|
|
60
|
-
const user = userEvent.setup();
|
|
61
|
-
const onTabChange = jest.fn();
|
|
62
|
-
render(_jsx(Tabs, { onTabChange: onTabChange, children: _jsx(Tabs.List, { children: _jsx(Tabs.Button, { "aria-controls": "one", children: "Tab 1" }) }) }));
|
|
63
|
-
const button = screen.getByRole('tab', { name: 'Tab 1' });
|
|
64
|
-
await user.click(button);
|
|
65
|
-
expect(onTabChange).toHaveBeenCalledWith('one');
|
|
66
|
-
});
|
|
67
|
-
it('should be able to set the initially active tab', () => {
|
|
68
|
-
render(_jsxs(Tabs, { activeTab: "three", children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Button, { "aria-controls": "one", children: "Tab 1" }), _jsx(Tabs.Button, { "aria-controls": "two", children: "Tab 2" }), _jsx(Tabs.Button, { "aria-controls": "three", children: "Tab 3" }), _jsx(Tabs.Button, { "aria-controls": "four", children: "Tab 4" })] }), _jsx(Tabs.Panel, { id: "one", children: "Content 1" }), _jsx(Tabs.Panel, { id: "two", children: "Content 2" }), _jsx(Tabs.Panel, { id: "three", children: "Content 3" }), _jsx(Tabs.Panel, { id: "four", children: "Content 4" })] }));
|
|
69
|
-
const tabOne = screen.getByRole('tab', { name: 'Tab 1' });
|
|
70
|
-
const tabThree = screen.getByRole('tab', { name: 'Tab 3' });
|
|
71
|
-
expect(tabOne).toHaveAttribute('aria-selected', 'false');
|
|
72
|
-
expect(tabOne).toHaveAttribute('tabindex', '-1');
|
|
73
|
-
expect(tabThree).toHaveAttribute('aria-selected', 'true');
|
|
74
|
-
expect(tabThree).toHaveAttribute('tabindex', '0');
|
|
75
|
-
expect(screen.getByRole('tabpanel')).toHaveTextContent('Content 3');
|
|
76
|
-
});
|
|
77
|
-
it('should set the first tab as the initially active tab when the supplied active tab does not exist', async () => {
|
|
78
|
-
// Disable console.warn for this test, to prevent it from cluttering the test output
|
|
79
|
-
jest.spyOn(console, 'warn').mockImplementation(() => { });
|
|
80
|
-
render(_jsxs(Tabs, { activeTab: "unknown", children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Button, { "aria-controls": "one", children: "Tab 1" }), _jsx(Tabs.Button, { "aria-controls": "two", children: "Tab 2" }), _jsx(Tabs.Button, { "aria-controls": "three", children: "Tab 3" }), _jsx(Tabs.Button, { "aria-controls": "four", children: "Tab 4" })] }), _jsx(Tabs.Panel, { id: "one", children: "Content 1" }), _jsx(Tabs.Panel, { id: "two", children: "Content 2" }), _jsx(Tabs.Panel, { id: "three", children: "Content 3" }), _jsx(Tabs.Panel, { id: "four", children: "Content 4" })] }));
|
|
81
|
-
const firstTab = screen.getByRole('tab', { name: 'Tab 1' });
|
|
82
|
-
const lastTab = screen.getByRole('tab', { name: 'Tab 4' });
|
|
83
|
-
expect(firstTab).toHaveAttribute('aria-selected', 'true');
|
|
84
|
-
expect(firstTab).toHaveAttribute('tabindex', '0');
|
|
85
|
-
expect(lastTab).toHaveAttribute('aria-selected', 'false');
|
|
86
|
-
expect(lastTab).toHaveAttribute('tabindex', '-1');
|
|
87
|
-
expect(screen.getByRole('tabpanel')).toHaveTextContent('Content 1');
|
|
88
|
-
});
|
|
89
|
-
it('sets focus on Tabs buttons when using arrow keys', async () => {
|
|
90
|
-
const user = userEvent.setup();
|
|
91
|
-
render(_jsxs(Tabs, { children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Button, { "aria-controls": "one", children: "Tab 1" }), _jsx(Tabs.Button, { "aria-controls": "two", children: "Tab 2" }), _jsx(Tabs.Button, { "aria-controls": "three", children: "Tab 3" })] }), _jsx(Tabs.Panel, { id: "one" }), _jsx(Tabs.Panel, { id: "two" }), _jsx(Tabs.Panel, { id: "three" })] }));
|
|
92
|
-
const firstButton = screen.getByRole('tab', { name: 'Tab 1' });
|
|
93
|
-
const thirdButton = screen.getByRole('tab', { name: 'Tab 3' });
|
|
94
|
-
await user.click(firstButton);
|
|
95
|
-
expect(firstButton).toHaveFocus();
|
|
96
|
-
// Click the right arrow key twice
|
|
97
|
-
await user.keyboard('{ArrowRight}');
|
|
98
|
-
await user.keyboard('{ArrowRight}');
|
|
99
|
-
expect(thirdButton).toHaveFocus();
|
|
100
|
-
expect(firstButton).not.toHaveFocus();
|
|
101
|
-
await user.keyboard('{ArrowRight}');
|
|
102
|
-
expect(firstButton).toHaveFocus();
|
|
103
|
-
});
|
|
104
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import { render, screen } from '@testing-library/react';
|
|
7
|
-
import userEvent from '@testing-library/user-event';
|
|
8
|
-
import { createRef } from 'react';
|
|
9
|
-
import { TabsButton } from './TabsButton';
|
|
10
|
-
import '@testing-library/jest-dom';
|
|
11
|
-
import { TabsContext } from './TabsContext';
|
|
12
|
-
describe('Tabs button', () => {
|
|
13
|
-
it('renders', () => {
|
|
14
|
-
render(_jsx(TabsButton, { "aria-controls": "one" }));
|
|
15
|
-
const component = screen.getByRole('tab');
|
|
16
|
-
expect(component).toBeInTheDocument();
|
|
17
|
-
});
|
|
18
|
-
it('renders a design system BEM class name', () => {
|
|
19
|
-
render(_jsx(TabsButton, { "aria-controls": "one" }));
|
|
20
|
-
const component = screen.getByRole('tab');
|
|
21
|
-
expect(component).toHaveClass('ams-tabs__button');
|
|
22
|
-
});
|
|
23
|
-
it('renders an extra class name', () => {
|
|
24
|
-
render(_jsx(TabsButton, { "aria-controls": "one", className: "extra" }));
|
|
25
|
-
const component = screen.getByRole('tab');
|
|
26
|
-
expect(component).toHaveClass('ams-tabs__button extra');
|
|
27
|
-
});
|
|
28
|
-
it('renders a label', () => {
|
|
29
|
-
render(_jsx(TabsButton, { "aria-controls": "one", children: "Label" }));
|
|
30
|
-
const component = screen.getByRole('tab', { name: 'Label' });
|
|
31
|
-
expect(component).toBeInTheDocument();
|
|
32
|
-
});
|
|
33
|
-
it('renders the correct id based on the tabs prop', () => {
|
|
34
|
-
const { container } = render(_jsx(TabsButton, { "aria-controls": "one" }));
|
|
35
|
-
const component = container.querySelector('#button-one');
|
|
36
|
-
expect(component).toBeInTheDocument();
|
|
37
|
-
});
|
|
38
|
-
it('should associate the button with the correct tab', () => {
|
|
39
|
-
render(_jsx(TabsButton, { "aria-controls": "one" }));
|
|
40
|
-
const component = screen.getByRole('tab');
|
|
41
|
-
expect(component).toHaveAttribute('aria-controls', 'one');
|
|
42
|
-
});
|
|
43
|
-
it('does not call updateTab if event.preventDefault is invoked', async () => {
|
|
44
|
-
const user = userEvent.setup();
|
|
45
|
-
const mockUpdateTab = jest.fn();
|
|
46
|
-
render(_jsx(TabsContext.Provider, { value: { updateTab: mockUpdateTab }, children: _jsx(TabsButton, { "aria-controls": "one", onClick: (event) => event.preventDefault(), children: "Label" }) }));
|
|
47
|
-
const button = screen.getByRole('tab', { name: 'Label' });
|
|
48
|
-
await user.click(button);
|
|
49
|
-
expect(mockUpdateTab).not.toHaveBeenCalled();
|
|
50
|
-
});
|
|
51
|
-
it('supports ForwardRef in React', () => {
|
|
52
|
-
const ref = createRef();
|
|
53
|
-
render(_jsx(TabsButton, { "aria-controls": "one", ref: ref }));
|
|
54
|
-
const component = screen.getByRole('tab');
|
|
55
|
-
expect(ref.current).toBe(component);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import { render, screen } from '@testing-library/react';
|
|
7
|
-
import { createRef } from 'react';
|
|
8
|
-
import { TabsList } from './TabsList';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Tabs list', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
render(_jsx(TabsList, {}));
|
|
13
|
-
const component = screen.getByRole('tablist');
|
|
14
|
-
expect(component).toBeInTheDocument();
|
|
15
|
-
});
|
|
16
|
-
it('renders a design system BEM class name', () => {
|
|
17
|
-
render(_jsx(TabsList, {}));
|
|
18
|
-
const component = screen.getByRole('tablist');
|
|
19
|
-
expect(component).toHaveClass('ams-tabs__list');
|
|
20
|
-
});
|
|
21
|
-
it('renders an extra class name', () => {
|
|
22
|
-
render(_jsx(TabsList, { className: "extra" }));
|
|
23
|
-
const component = screen.getByRole('tablist');
|
|
24
|
-
expect(component).toHaveClass('ams-tabs__list extra');
|
|
25
|
-
});
|
|
26
|
-
it('supports ForwardRef in React', () => {
|
|
27
|
-
const ref = createRef();
|
|
28
|
-
render(_jsx(TabsList, { ref: ref }));
|
|
29
|
-
const component = screen.getByRole('tablist');
|
|
30
|
-
expect(ref.current).toBe(component);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import { render, screen } from '@testing-library/react';
|
|
7
|
-
import { createRef } from 'react';
|
|
8
|
-
import { Tabs } from './Tabs';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Tabs Panel', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { "aria-controls": "one" }) }), _jsx(Tabs.Panel, { id: "one" })] }));
|
|
13
|
-
const component = screen.getByRole('tabpanel');
|
|
14
|
-
expect(component).toBeInTheDocument();
|
|
15
|
-
});
|
|
16
|
-
it('renders a design system BEM class name', () => {
|
|
17
|
-
render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { "aria-controls": "one" }) }), _jsx(Tabs.Panel, { id: "one" })] }));
|
|
18
|
-
const component = screen.getByRole('tabpanel');
|
|
19
|
-
expect(component).toHaveClass('ams-tabs__panel');
|
|
20
|
-
});
|
|
21
|
-
it('renders an extra class name', () => {
|
|
22
|
-
render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { "aria-controls": "one" }) }), _jsx(Tabs.Panel, { className: "extra", id: "one" })] }));
|
|
23
|
-
const component = screen.getByRole('tabpanel');
|
|
24
|
-
expect(component).toHaveClass('ams-tabs__panel extra');
|
|
25
|
-
});
|
|
26
|
-
it('renders the correct id based on the tabs prop', () => {
|
|
27
|
-
render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { "aria-controls": "one" }) }), _jsx(Tabs.Panel, { id: "one" })] }));
|
|
28
|
-
const component = screen.getByRole('tabpanel');
|
|
29
|
-
expect(component).toHaveAttribute('id', 'one');
|
|
30
|
-
});
|
|
31
|
-
it('should associate the tab with the correct button', () => {
|
|
32
|
-
render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { "aria-controls": "one" }) }), _jsx(Tabs.Panel, { id: "one" })] }));
|
|
33
|
-
const component = screen.getByRole('tabpanel');
|
|
34
|
-
expect(component).toHaveAttribute('aria-labelledby', 'button-one');
|
|
35
|
-
});
|
|
36
|
-
it('supports ForwardRef in React', () => {
|
|
37
|
-
const ref = createRef();
|
|
38
|
-
render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { "aria-controls": "one" }) }), _jsx(Tabs.Panel, { id: "one", ref: ref })] }));
|
|
39
|
-
const component = screen.getByRole('tabpanel');
|
|
40
|
-
expect(ref.current).toBe(component);
|
|
41
|
-
});
|
|
42
|
-
});
|