@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
package/dist/Card/Card.test.js
DELETED
|
@@ -1,33 +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 { Card } from './Card';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Card', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
const { container } = render(_jsx(Card, {}));
|
|
13
|
-
const component = container.querySelector(':only-child');
|
|
14
|
-
expect(component).toBeInTheDocument();
|
|
15
|
-
expect(component).toBeVisible();
|
|
16
|
-
});
|
|
17
|
-
it('renders a design system BEM class name', () => {
|
|
18
|
-
render(_jsx(Card, {}));
|
|
19
|
-
const component = screen.getByRole('article');
|
|
20
|
-
expect(component).toHaveClass('ams-card');
|
|
21
|
-
});
|
|
22
|
-
it('renders an extra class name', () => {
|
|
23
|
-
render(_jsx(Card, { className: "extra" }));
|
|
24
|
-
const component = screen.getByRole('article');
|
|
25
|
-
expect(component).toHaveClass('ams-card extra');
|
|
26
|
-
});
|
|
27
|
-
it('supports ForwardRef in React', () => {
|
|
28
|
-
const ref = createRef();
|
|
29
|
-
render(_jsx(Card, { ref: ref }));
|
|
30
|
-
const component = screen.getByRole('article');
|
|
31
|
-
expect(ref.current).toBe(component);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,38 +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 { CardHeading } from './CardHeading';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Card Heading', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
render(_jsx(CardHeading, { level: 1 }));
|
|
13
|
-
const component = screen.getByRole('heading');
|
|
14
|
-
expect(component).toBeInTheDocument();
|
|
15
|
-
expect(component).toBeVisible();
|
|
16
|
-
});
|
|
17
|
-
it('renders a design system BEM class name', () => {
|
|
18
|
-
render(_jsx(CardHeading, { level: 2 }));
|
|
19
|
-
const component = screen.getByRole('heading');
|
|
20
|
-
expect(component).toHaveClass('ams-card__heading');
|
|
21
|
-
});
|
|
22
|
-
it('renders an extra class name', () => {
|
|
23
|
-
render(_jsx(CardHeading, { className: "extra", level: 3 }));
|
|
24
|
-
const component = screen.getByRole('heading');
|
|
25
|
-
expect(component).toHaveClass('ams-card__heading extra');
|
|
26
|
-
});
|
|
27
|
-
it('renders the correct size level class', () => {
|
|
28
|
-
render(_jsx(CardHeading, { level: 3, size: "level-1", children: "Size level 1" }));
|
|
29
|
-
const component = screen.getByRole('heading');
|
|
30
|
-
expect(component).toHaveClass('ams-heading--1');
|
|
31
|
-
});
|
|
32
|
-
it('supports ForwardRef in React', () => {
|
|
33
|
-
const ref = createRef();
|
|
34
|
-
render(_jsx(CardHeading, { level: 4, ref: ref }));
|
|
35
|
-
const component = screen.getByRole('heading');
|
|
36
|
-
expect(ref.current).toBe(component);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
@@ -1,38 +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 { CardHeadingGroup } from './CardHeadingGroup';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Card heading group', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
const { container } = render(_jsx(CardHeadingGroup, { tagline: "test" }));
|
|
13
|
-
const component = container.querySelector(':only-child');
|
|
14
|
-
expect(component).toBeInTheDocument();
|
|
15
|
-
expect(component).toBeVisible();
|
|
16
|
-
});
|
|
17
|
-
it('renders a design system BEM class name', () => {
|
|
18
|
-
const { container } = render(_jsx(CardHeadingGroup, { tagline: "test" }));
|
|
19
|
-
const component = container.querySelector(':only-child');
|
|
20
|
-
expect(component).toHaveClass('ams-card__heading-group');
|
|
21
|
-
});
|
|
22
|
-
it('renders an extra class name', () => {
|
|
23
|
-
const { container } = render(_jsx(CardHeadingGroup, { className: "extra", tagline: "test" }));
|
|
24
|
-
const component = container.querySelector(':only-child');
|
|
25
|
-
expect(component).toHaveClass('ams-card__heading-group extra');
|
|
26
|
-
});
|
|
27
|
-
it('renders a tagline', () => {
|
|
28
|
-
render(_jsx(CardHeadingGroup, { tagline: "tagline" }));
|
|
29
|
-
const tagline = screen.getByText('tagline');
|
|
30
|
-
expect(tagline).toBeInTheDocument();
|
|
31
|
-
});
|
|
32
|
-
it('supports ForwardRef in React', () => {
|
|
33
|
-
const ref = createRef();
|
|
34
|
-
const { container } = render(_jsx(CardHeadingGroup, { ref: ref, tagline: "test" }));
|
|
35
|
-
const component = container.querySelector(':only-child');
|
|
36
|
-
expect(ref.current).toBe(component);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
@@ -1,33 +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 } from '@testing-library/react';
|
|
7
|
-
import { createRef } from 'react';
|
|
8
|
-
import { CardImage } from './CardImage';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Card Image', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
const { container } = render(_jsx(CardImage, { alt: "" }));
|
|
13
|
-
const component = container.querySelector(':only-child');
|
|
14
|
-
expect(component).toBeInTheDocument();
|
|
15
|
-
expect(component).toBeVisible();
|
|
16
|
-
});
|
|
17
|
-
it('renders a design system BEM class name', () => {
|
|
18
|
-
const { container } = render(_jsx(CardImage, { alt: "" }));
|
|
19
|
-
const component = container.querySelector(':only-child');
|
|
20
|
-
expect(component).toHaveClass('ams-card__image');
|
|
21
|
-
});
|
|
22
|
-
it('renders an extra class name', () => {
|
|
23
|
-
const { container } = render(_jsx(CardImage, { alt: "", className: "extra" }));
|
|
24
|
-
const component = container.querySelector(':only-child');
|
|
25
|
-
expect(component).toHaveClass('ams-card__image extra');
|
|
26
|
-
});
|
|
27
|
-
it('supports ForwardRef in React', () => {
|
|
28
|
-
const ref = createRef();
|
|
29
|
-
const { container } = render(_jsx(CardImage, { alt: "", ref: ref }));
|
|
30
|
-
const component = container.querySelector(':only-child');
|
|
31
|
-
expect(ref.current).toBe(component);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,33 +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 { CardLink } from './CardLink';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Card link', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
render(_jsx(CardLink, { href: "/" }));
|
|
13
|
-
const component = screen.getByRole('link');
|
|
14
|
-
expect(component).toBeInTheDocument();
|
|
15
|
-
expect(component).toBeVisible();
|
|
16
|
-
});
|
|
17
|
-
it('renders a design system BEM class name', () => {
|
|
18
|
-
render(_jsx(CardLink, { href: "/" }));
|
|
19
|
-
const component = screen.getByRole('link');
|
|
20
|
-
expect(component).toHaveClass('ams-card__link');
|
|
21
|
-
});
|
|
22
|
-
it('renders an extra class name', () => {
|
|
23
|
-
render(_jsx(CardLink, { className: "extra", href: "/" }));
|
|
24
|
-
const component = screen.getByRole('link');
|
|
25
|
-
expect(component).toHaveClass('ams-card__link extra');
|
|
26
|
-
});
|
|
27
|
-
it('supports ForwardRef in React', () => {
|
|
28
|
-
const ref = createRef();
|
|
29
|
-
render(_jsx(CardLink, { href: "/", ref: ref }));
|
|
30
|
-
const component = screen.getByRole('link');
|
|
31
|
-
expect(ref.current).toBe(component);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,38 +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 { CharacterCount } from './CharacterCount';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Character count', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
render(_jsx(CharacterCount, { length: 10, maxLength: 100 }));
|
|
13
|
-
const component = screen.getByRole('status');
|
|
14
|
-
expect(component).toBeInTheDocument();
|
|
15
|
-
expect(component).toBeVisible();
|
|
16
|
-
});
|
|
17
|
-
it('renders a design system BEM class name', () => {
|
|
18
|
-
render(_jsx(CharacterCount, { length: 10, maxLength: 100 }));
|
|
19
|
-
const component = screen.getByRole('status');
|
|
20
|
-
expect(component).toHaveClass('ams-character-count');
|
|
21
|
-
});
|
|
22
|
-
it('renders an extra class name', () => {
|
|
23
|
-
render(_jsx(CharacterCount, { className: "extra", length: 10, maxLength: 100 }));
|
|
24
|
-
const component = screen.getByRole('status');
|
|
25
|
-
expect(component).toHaveClass('ams-character-count extra');
|
|
26
|
-
});
|
|
27
|
-
it('renders an error class when length is larger than maxLength', () => {
|
|
28
|
-
render(_jsx(CharacterCount, { length: 101, maxLength: 100 }));
|
|
29
|
-
const component = screen.getByRole('status');
|
|
30
|
-
expect(component).toHaveClass('ams-character-count--error');
|
|
31
|
-
});
|
|
32
|
-
it('supports ForwardRef in React', () => {
|
|
33
|
-
const ref = createRef();
|
|
34
|
-
render(_jsx(CharacterCount, { length: 10, maxLength: 100, ref: ref }));
|
|
35
|
-
const component = screen.getByRole('status');
|
|
36
|
-
expect(ref.current).toBe(component);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import { StarIcon } from '@amsterdam/design-system-react-icons';
|
|
7
|
-
import { render, screen } from '@testing-library/react';
|
|
8
|
-
import { createRef } from 'react';
|
|
9
|
-
import { Checkbox } from './Checkbox';
|
|
10
|
-
import '@testing-library/jest-dom';
|
|
11
|
-
describe('Checkbox', () => {
|
|
12
|
-
it('renders', () => {
|
|
13
|
-
const { container } = render(_jsx(Checkbox, {}));
|
|
14
|
-
const wrapper = container.querySelector(':only-child');
|
|
15
|
-
const input = screen.getByRole('checkbox');
|
|
16
|
-
const label = container.querySelector('label');
|
|
17
|
-
expect(wrapper).toBeInTheDocument();
|
|
18
|
-
expect(wrapper).toBeVisible();
|
|
19
|
-
expect(input).toBeInTheDocument();
|
|
20
|
-
expect(input).toBeVisible();
|
|
21
|
-
expect(label).toBeInTheDocument();
|
|
22
|
-
expect(label).toBeVisible();
|
|
23
|
-
});
|
|
24
|
-
it('renders a design system BEM class name', () => {
|
|
25
|
-
const { container } = render(_jsx(Checkbox, {}));
|
|
26
|
-
const wrapper = container.querySelector(':only-child');
|
|
27
|
-
const input = screen.getByRole('checkbox');
|
|
28
|
-
const label = container.querySelector('label');
|
|
29
|
-
expect(wrapper).toHaveClass('ams-checkbox');
|
|
30
|
-
expect(input).toHaveClass('ams-checkbox__input');
|
|
31
|
-
expect(label).toHaveClass('ams-checkbox__label');
|
|
32
|
-
});
|
|
33
|
-
it('renders an extra class name', () => {
|
|
34
|
-
const { container } = render(_jsx(Checkbox, { className: "extra" }));
|
|
35
|
-
const wrapper = container.querySelector(':only-child');
|
|
36
|
-
expect(wrapper).toHaveClass('ams-checkbox extra');
|
|
37
|
-
});
|
|
38
|
-
describe('Checked state', () => {
|
|
39
|
-
it('is not checked by default', () => {
|
|
40
|
-
render(_jsx(Checkbox, {}));
|
|
41
|
-
const input = screen.getByRole('checkbox');
|
|
42
|
-
expect(input).not.toBeChecked();
|
|
43
|
-
});
|
|
44
|
-
it('can have a checked state', () => {
|
|
45
|
-
const handleChange = () => { };
|
|
46
|
-
render(_jsx(Checkbox, { checked: true, onChange: handleChange }));
|
|
47
|
-
const input = screen.getByRole('checkbox');
|
|
48
|
-
expect(input).toBeChecked();
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
describe('Indeterminate state', () => {
|
|
52
|
-
it('is not indeterminate by default', () => {
|
|
53
|
-
render(_jsx(Checkbox, {}));
|
|
54
|
-
const input = screen.getByRole('checkbox');
|
|
55
|
-
expect(input).not.toBePartiallyChecked();
|
|
56
|
-
});
|
|
57
|
-
it('can have an indeterminate state', () => {
|
|
58
|
-
render(_jsx(Checkbox, { indeterminate: true }));
|
|
59
|
-
const input = screen.getByRole('checkbox');
|
|
60
|
-
expect(input).toBePartiallyChecked();
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
describe('Invalid state', () => {
|
|
64
|
-
it('is not invalid by default', () => {
|
|
65
|
-
render(_jsx(Checkbox, {}));
|
|
66
|
-
const input = screen.getByRole('checkbox');
|
|
67
|
-
expect(input).not.toBeInvalid();
|
|
68
|
-
});
|
|
69
|
-
it('can have an invalid state', () => {
|
|
70
|
-
render(_jsx(Checkbox, { invalid: true }));
|
|
71
|
-
const input = screen.getByRole('checkbox');
|
|
72
|
-
expect(input).toHaveAttribute('aria-invalid');
|
|
73
|
-
expect(input).toBeInvalid();
|
|
74
|
-
});
|
|
75
|
-
it('omits non-essential invalid attributes when not invalid', () => {
|
|
76
|
-
render(_jsx(Checkbox, { invalid: false }));
|
|
77
|
-
const input = screen.getByRole('checkbox');
|
|
78
|
-
expect(input).not.toHaveAttribute('aria-invalid');
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
describe('Disabled state', () => {
|
|
82
|
-
it('is not disabled by default', () => {
|
|
83
|
-
render(_jsx(Checkbox, {}));
|
|
84
|
-
const input = screen.getByRole('checkbox');
|
|
85
|
-
expect(input).not.toBeDisabled();
|
|
86
|
-
});
|
|
87
|
-
it('can have a disabled state', () => {
|
|
88
|
-
render(_jsx(Checkbox, { disabled: true }));
|
|
89
|
-
const input = screen.getByRole('checkbox');
|
|
90
|
-
expect(input).toBeDisabled();
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
describe('Disabled invalid state', () => {
|
|
94
|
-
it('can have a disabled invalid state', () => {
|
|
95
|
-
render(_jsx(Checkbox, { disabled: true, invalid: true }));
|
|
96
|
-
const input = screen.getByRole('checkbox');
|
|
97
|
-
expect(input).toBeDisabled();
|
|
98
|
-
expect(input).toBeInvalid();
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
it('can trigger a change event', () => {
|
|
102
|
-
const handleChange = jest.fn();
|
|
103
|
-
render(_jsx(Checkbox, { onChange: handleChange }));
|
|
104
|
-
const input = screen.getByRole('checkbox');
|
|
105
|
-
input?.click();
|
|
106
|
-
expect(handleChange).toHaveBeenCalled();
|
|
107
|
-
});
|
|
108
|
-
it('does not trigger a change event when disabled', () => {
|
|
109
|
-
const handleChange = jest.fn();
|
|
110
|
-
render(_jsx(Checkbox, { disabled: true, onChange: handleChange }));
|
|
111
|
-
const input = screen.getByRole('checkbox');
|
|
112
|
-
input?.click();
|
|
113
|
-
expect(handleChange).not.toHaveBeenCalled();
|
|
114
|
-
});
|
|
115
|
-
it('can trigger a change event by clicking on label', () => {
|
|
116
|
-
const handleChange = jest.fn();
|
|
117
|
-
const { container } = render(_jsx(Checkbox, { onChange: handleChange }));
|
|
118
|
-
const label = container.querySelector('label');
|
|
119
|
-
label?.click();
|
|
120
|
-
expect(handleChange).toHaveBeenCalled();
|
|
121
|
-
});
|
|
122
|
-
it('can use a custom id', () => {
|
|
123
|
-
const handleChange = jest.fn();
|
|
124
|
-
const { container } = render(_jsx(Checkbox, { id: "test-id", onChange: handleChange }));
|
|
125
|
-
const input = screen.getByRole('checkbox');
|
|
126
|
-
expect(input).toHaveAttribute('id', 'test-id');
|
|
127
|
-
const label = container.querySelector('label');
|
|
128
|
-
label?.click();
|
|
129
|
-
expect(handleChange).toHaveBeenCalled();
|
|
130
|
-
});
|
|
131
|
-
it('shows a custom icon', () => {
|
|
132
|
-
const { container } = render(_jsx(Checkbox, { icon: _jsx(StarIcon, { className: "test-class" }) }));
|
|
133
|
-
const icon = container.querySelector('svg');
|
|
134
|
-
expect(icon).toHaveClass('test-class');
|
|
135
|
-
});
|
|
136
|
-
it('supports ForwardRef in React', () => {
|
|
137
|
-
const ref = createRef();
|
|
138
|
-
render(_jsx(Checkbox, { ref: ref }));
|
|
139
|
-
const input = screen.getByRole('checkbox');
|
|
140
|
-
expect(ref.current).toBe(input);
|
|
141
|
-
});
|
|
142
|
-
});
|
|
@@ -1,59 +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 { ariaRoleForTag } from '../common/accessibility';
|
|
9
|
-
import { crossAlignOptionsForColumn, mainAlignOptions } from '../common/types';
|
|
10
|
-
import { Column, columnGapSizes, columnTags } from './Column';
|
|
11
|
-
import '@testing-library/jest-dom';
|
|
12
|
-
describe('Column', () => {
|
|
13
|
-
it('renders', () => {
|
|
14
|
-
const { container } = render(_jsx(Column, {}));
|
|
15
|
-
const component = container.querySelector(':only-child');
|
|
16
|
-
expect(component).toBeInTheDocument();
|
|
17
|
-
expect(component).toBeVisible();
|
|
18
|
-
});
|
|
19
|
-
it('renders a design system BEM class name', () => {
|
|
20
|
-
const { container } = render(_jsx(Column, {}));
|
|
21
|
-
const component = container.querySelector(':only-child');
|
|
22
|
-
expect(component).toHaveClass('ams-column');
|
|
23
|
-
});
|
|
24
|
-
columnGapSizes.map((gap) => it(`renders with ‘${gap}’ gap`, () => {
|
|
25
|
-
const { container } = render(_jsx(Column, { gap: gap }));
|
|
26
|
-
const component = container.querySelector(':only-child');
|
|
27
|
-
expect(component).toHaveClass(`ams-column--gap-${gap}`);
|
|
28
|
-
}));
|
|
29
|
-
it('renders an extra class name', () => {
|
|
30
|
-
const { container } = render(_jsx(Column, { className: "extra" }));
|
|
31
|
-
const component = container.querySelector(':only-child');
|
|
32
|
-
expect(component).toHaveClass('ams-column extra');
|
|
33
|
-
});
|
|
34
|
-
columnTags.forEach((tag) => {
|
|
35
|
-
it(`renders with a custom ${tag} tag`, () => {
|
|
36
|
-
const { container } = render(_jsx(Column, { "aria-label": tag === 'section' ? 'Accessible name' : undefined, as: tag }));
|
|
37
|
-
const component = tag === 'div' ? container.querySelector(tag) : screen.getByRole(ariaRoleForTag[tag]);
|
|
38
|
-
expect(component).toBeInTheDocument();
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
it('supports ForwardRef in React', () => {
|
|
42
|
-
const ref = createRef();
|
|
43
|
-
const { container } = render(_jsx(Column, { ref: ref }));
|
|
44
|
-
const component = container.querySelector(':only-child');
|
|
45
|
-
expect(ref.current).toBe(component);
|
|
46
|
-
});
|
|
47
|
-
describe('Alignment', () => {
|
|
48
|
-
mainAlignOptions.map((align) => it(`sets the ‘${align}’ alignment`, () => {
|
|
49
|
-
const { container } = render(_jsx(Column, { align: align }));
|
|
50
|
-
const component = container.querySelector(':only-child');
|
|
51
|
-
expect(component).toHaveClass(`ams-column--align-${align}`);
|
|
52
|
-
}));
|
|
53
|
-
crossAlignOptionsForColumn.map((align) => it(`sets the ‘${align}’ vertical alignment`, () => {
|
|
54
|
-
const { container } = render(_jsx(Column, { alignHorizontal: align }));
|
|
55
|
-
const component = container.querySelector(':only-child');
|
|
56
|
-
expect(component).toHaveClass(`ams-column--align-horizontal-${align}`);
|
|
57
|
-
}));
|
|
58
|
-
});
|
|
59
|
-
});
|
|
@@ -1,58 +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 } from '@testing-library/react';
|
|
7
|
-
import { createRef } from 'react';
|
|
8
|
-
import { DateInput, dateInputTypes } from './DateInput';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Date input', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
const { container } = render(_jsx(DateInput, {}));
|
|
13
|
-
const component = container.querySelector(':only-child');
|
|
14
|
-
expect(component).toBeInTheDocument();
|
|
15
|
-
expect(component).toBeVisible();
|
|
16
|
-
});
|
|
17
|
-
it('renders a design system BEM class name', () => {
|
|
18
|
-
const { container } = render(_jsx(DateInput, {}));
|
|
19
|
-
const component = container.querySelector(':only-child');
|
|
20
|
-
expect(component).toHaveClass('ams-date-input');
|
|
21
|
-
});
|
|
22
|
-
it('renders an extra class name', () => {
|
|
23
|
-
const { container } = render(_jsx(DateInput, { className: "extra" }));
|
|
24
|
-
const component = container.querySelector(':only-child');
|
|
25
|
-
expect(component).toHaveClass('ams-date-input extra');
|
|
26
|
-
});
|
|
27
|
-
it('supports ForwardRef in React', () => {
|
|
28
|
-
const ref = createRef();
|
|
29
|
-
const { container } = render(_jsx(DateInput, { ref: ref }));
|
|
30
|
-
const component = container.querySelector(':only-child');
|
|
31
|
-
expect(ref.current).toBe(component);
|
|
32
|
-
});
|
|
33
|
-
describe('Invalid state', () => {
|
|
34
|
-
it('is not invalid by default', () => {
|
|
35
|
-
const { container } = render(_jsx(DateInput, {}));
|
|
36
|
-
const component = container.querySelector(':only-child');
|
|
37
|
-
expect(component).not.toBeInvalid();
|
|
38
|
-
});
|
|
39
|
-
it('can have an invalid state', () => {
|
|
40
|
-
const { container } = render(_jsx(DateInput, { invalid: true }));
|
|
41
|
-
const component = container.querySelector(':only-child');
|
|
42
|
-
expect(component).toHaveAttribute('aria-invalid');
|
|
43
|
-
expect(component).toBeInvalid();
|
|
44
|
-
});
|
|
45
|
-
it('omits non-essential invalid attributes when not invalid', () => {
|
|
46
|
-
const { container } = render(_jsx(DateInput, { invalid: false }));
|
|
47
|
-
const component = container.querySelector(':only-child');
|
|
48
|
-
expect(component).not.toHaveAttribute('aria-invalid');
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
describe('Type', () => {
|
|
52
|
-
dateInputTypes.map((type) => it(`sets the ‘${type}’ type`, () => {
|
|
53
|
-
const { container } = render(_jsx(DateInput, { type: type }));
|
|
54
|
-
const component = container.querySelector(':only-child');
|
|
55
|
-
expect(component).toHaveAttribute('type', type);
|
|
56
|
-
}));
|
|
57
|
-
});
|
|
58
|
-
});
|
|
@@ -1,43 +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 } from '@testing-library/react';
|
|
7
|
-
import { createRef } from 'react';
|
|
8
|
-
import { DescriptionList, descriptionListTermsWidths } from './DescriptionList';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Description List', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
const { container } = render(_jsx(DescriptionList, {}));
|
|
13
|
-
const component = container.querySelector(':only-child');
|
|
14
|
-
expect(component).toBeInTheDocument();
|
|
15
|
-
expect(component).toBeVisible();
|
|
16
|
-
});
|
|
17
|
-
it('renders a design system BEM class name', () => {
|
|
18
|
-
const { container } = render(_jsx(DescriptionList, {}));
|
|
19
|
-
const component = container.querySelector(':only-child');
|
|
20
|
-
expect(component).toHaveClass('ams-description-list');
|
|
21
|
-
});
|
|
22
|
-
it('renders an extra class name', () => {
|
|
23
|
-
const { container } = render(_jsx(DescriptionList, { className: "extra" }));
|
|
24
|
-
const component = container.querySelector(':only-child');
|
|
25
|
-
expect(component).toHaveClass('ams-description-list extra');
|
|
26
|
-
});
|
|
27
|
-
descriptionListTermsWidths.map((width) => it(`renders the class name for the ‘${width}’ terms column width`, () => {
|
|
28
|
-
const { container } = render(_jsx(DescriptionList, { termsWidth: width }));
|
|
29
|
-
const component = container.querySelector(':only-child');
|
|
30
|
-
expect(component).toHaveClass(`ams-description-list--${width}`);
|
|
31
|
-
}));
|
|
32
|
-
it('supports ForwardRef in React', () => {
|
|
33
|
-
const ref = createRef();
|
|
34
|
-
const { container } = render(_jsx(DescriptionList, { ref: ref }));
|
|
35
|
-
const component = container.querySelector(':only-child');
|
|
36
|
-
expect(ref.current).toBe(component);
|
|
37
|
-
});
|
|
38
|
-
it('renders the class name for inverse color', () => {
|
|
39
|
-
const { container } = render(_jsx(DescriptionList, { color: "inverse" }));
|
|
40
|
-
const component = container.querySelector(':only-child');
|
|
41
|
-
expect(component).toHaveClass('ams-description-list--inverse');
|
|
42
|
-
});
|
|
43
|
-
});
|
|
@@ -1,33 +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 { DescriptionList } from './DescriptionList';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Description List Description', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
render(_jsx(DescriptionList.Description, { children: "Test" }));
|
|
13
|
-
const component = screen.getByRole('definition');
|
|
14
|
-
expect(component).toBeInTheDocument();
|
|
15
|
-
expect(component).toBeVisible();
|
|
16
|
-
});
|
|
17
|
-
it('renders a design system BEM class name', () => {
|
|
18
|
-
render(_jsx(DescriptionList.Description, { children: "Test" }));
|
|
19
|
-
const component = screen.getByRole('definition');
|
|
20
|
-
expect(component).toHaveClass('ams-description-list__description');
|
|
21
|
-
});
|
|
22
|
-
it('renders an extra class name', () => {
|
|
23
|
-
render(_jsx(DescriptionList.Description, { className: "extra", children: "Test" }));
|
|
24
|
-
const component = screen.getByRole('definition');
|
|
25
|
-
expect(component).toHaveClass('ams-description-list__description extra');
|
|
26
|
-
});
|
|
27
|
-
it('supports ForwardRef in React', () => {
|
|
28
|
-
const ref = createRef();
|
|
29
|
-
render(_jsx(DescriptionList.Description, { ref: ref, children: "Test" }));
|
|
30
|
-
const component = screen.getByRole('definition');
|
|
31
|
-
expect(ref.current).toBe(component);
|
|
32
|
-
});
|
|
33
|
-
});
|