@amsterdam/design-system-react 2.0.2 → 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/Accordion/Accordion.d.ts +3 -3
- package/dist/Accordion/AccordionSection.d.ts +5 -5
- package/dist/Avatar/Avatar.d.ts +2 -2
- package/dist/Badge/Badge.d.ts +4 -4
- package/dist/Blockquote/Blockquote.d.ts +5 -5
- package/dist/Breakout/BreakoutCell.d.ts +2 -2
- package/dist/Button/Button.d.ts +7 -5
- package/dist/Button/Button.js +1 -0
- package/dist/Card/Card.d.ts +8 -8
- package/dist/Card/CardHeading.d.ts +3 -3
- package/dist/Card/CardHeadingGroup.d.ts +5 -5
- package/dist/Card/CardImage.d.ts +2 -2
- package/dist/Checkbox/Checkbox.d.ts +5 -5
- package/dist/Column/Column.d.ts +5 -5
- package/dist/DateInput/DateInput.d.ts +4 -4
- package/dist/DescriptionList/DescriptionList.d.ts +5 -5
- package/dist/Dialog/Dialog.d.ts +6 -7
- package/dist/Field/Field.d.ts +5 -5
- package/dist/FieldSet/FieldSet.d.ts +31 -10
- package/dist/FieldSet/FieldSet.js +4 -3
- package/dist/Figure/Figure.d.ts +3 -3
- package/dist/Figure/FigureCaption.d.ts +5 -5
- package/dist/FileList/FileList.d.ts +2 -2
- package/dist/FileList/FileListItem.d.ts +4 -4
- package/dist/Grid/Grid.d.ts +2 -2
- package/dist/Grid/GridCell.d.ts +2 -2
- package/dist/Heading/Heading.d.ts +10 -11
- package/dist/Heading/Heading.js +1 -0
- package/dist/Hint/Hint.d.ts +1 -0
- package/dist/Hint/Hint.js +2 -2
- package/dist/Icon/Icon.d.ts +0 -4
- package/dist/IconButton/IconButton.d.ts +4 -2
- package/dist/IconButton/IconButton.js +1 -0
- package/dist/Image/Image.d.ts +5 -5
- package/dist/Image/Image.js +1 -1
- package/dist/ImageSlider/ImageSlider.d.ts +4 -4
- package/dist/ImageSlider/ImageSliderItem.d.ts +5 -5
- package/dist/ImageSlider/ImageSliderThumbnails.d.ts +5 -5
- package/dist/InvalidFormAlert/InvalidFormAlertWithErrors.d.ts +2 -2
- package/dist/Label/Label.d.ts +25 -6
- package/dist/Label/Label.js +3 -2
- package/dist/Link/Link.d.ts +4 -4
- package/dist/LinkList/LinkList.d.ts +1 -1
- package/dist/LinkList/LinkListLink.d.ts +9 -4
- package/dist/LinkList/LinkListLink.js +2 -0
- package/dist/Logo/Logo.d.ts +2 -2
- package/dist/Menu/Menu.d.ts +31 -10
- package/dist/Menu/Menu.js +6 -1
- package/dist/Menu/MenuLink.d.ts +10 -4
- package/dist/OrderedList/OrderedList.d.ts +5 -5
- package/dist/Page/Page.d.ts +6 -2
- package/dist/Page/Page.js +1 -1
- package/dist/PageHeader/PageHeader.d.ts +8 -7
- package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.d.ts +1 -1
- package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.js +0 -4
- package/dist/PageHeader/PageHeaderMenuIcon.js +1 -1
- package/dist/PageHeader/PageHeaderMenuLink.d.ts +13 -6
- package/dist/PageHeader/PageHeaderMenuLink.js +3 -6
- package/dist/PageHeading/PageHeading.d.ts +5 -5
- package/dist/Pagination/LinkItem.d.ts +3 -3
- package/dist/Pagination/Pagination.d.ts +4 -4
- package/dist/Paragraph/Paragraph.d.ts +5 -9
- package/dist/PasswordInput/PasswordInput.d.ts +4 -4
- package/dist/Radio/Radio.d.ts +5 -5
- package/dist/Row/Row.d.ts +5 -5
- package/dist/SearchField/SearchField.d.ts +2 -2
- package/dist/SearchField/SearchFieldButton.js +1 -1
- package/dist/SearchField/SearchFieldInput.d.ts +2 -2
- package/dist/Select/Select.d.ts +5 -5
- package/dist/Spotlight/Spotlight.d.ts +6 -6
- package/dist/Spotlight/Spotlight.js +0 -4
- package/dist/StandaloneLink/StandaloneLink.d.ts +4 -4
- package/dist/Table/TableCaption.d.ts +0 -4
- package/dist/TableOfContents/TableOfContents.d.ts +7 -7
- package/dist/TableOfContents/TableOfContentsLink.d.ts +4 -4
- package/dist/Tabs/Tabs.d.ts +11 -11
- package/dist/Tabs/TabsButton.d.ts +5 -5
- package/dist/Tabs/TabsPanel.d.ts +5 -5
- package/dist/TextArea/TextArea.d.ts +12 -6
- package/dist/TextInput/TextInput.d.ts +4 -4
- package/dist/TimeInput/TimeInput.d.ts +4 -4
- package/dist/UnorderedList/UnorderedList.d.ts +5 -5
- package/dist/common/useIsAfterBreakpoint.d.ts +4 -0
- package/dist/common/useIsAfterBreakpoint.js +4 -4
- package/dist/index.cjs.js +62 -44
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +293 -218
- package/dist/index.esm.js +62 -44
- package/dist/index.esm.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +21 -20
- 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/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 -63
- 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 -77
- 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 -38
- 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 -135
- 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 -50
- 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/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.0
|
|
2
|
+
"version": "2.2.0",
|
|
3
3
|
"author": "Design System Team, City of Amsterdam <designsystem@amsterdam.nl>",
|
|
4
4
|
"description": "All React components from the Amsterdam Design System. Use it to compose pages in your website or application.",
|
|
5
5
|
"homepage": "https://designsystem.amsterdam",
|
|
@@ -31,51 +31,52 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@babel/runtime": "7.28.4",
|
|
33
33
|
"clsx": "2.1.1",
|
|
34
|
-
"@amsterdam/design-system-react-icons": "1.1.
|
|
34
|
+
"@amsterdam/design-system-react-icons": "1.1.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@babel/core": "7.28.
|
|
38
|
-
"@babel/plugin-transform-runtime": "7.28.
|
|
39
|
-
"@babel/preset-env": "7.28.
|
|
40
|
-
"@babel/preset-react": "7.
|
|
41
|
-
"@rollup/plugin-babel": "6.0
|
|
42
|
-
"@rollup/plugin-commonjs": "28.0.
|
|
43
|
-
"@rollup/plugin-node-resolve": "16.0.
|
|
37
|
+
"@babel/core": "7.28.5",
|
|
38
|
+
"@babel/plugin-transform-runtime": "7.28.5",
|
|
39
|
+
"@babel/preset-env": "7.28.5",
|
|
40
|
+
"@babel/preset-react": "7.28.5",
|
|
41
|
+
"@rollup/plugin-babel": "6.1.0",
|
|
42
|
+
"@rollup/plugin-commonjs": "28.0.9",
|
|
43
|
+
"@rollup/plugin-node-resolve": "16.0.3",
|
|
44
44
|
"@rollup/pluginutils": "5.3.0",
|
|
45
45
|
"@testing-library/dom": "10.4.1",
|
|
46
|
-
"@testing-library/jest-dom": "6.
|
|
46
|
+
"@testing-library/jest-dom": "6.9.1",
|
|
47
47
|
"@testing-library/react": "16.3.0",
|
|
48
48
|
"@testing-library/user-event": "14.6.1",
|
|
49
49
|
"@types/jest": "30.0.0",
|
|
50
50
|
"@types/lodash": "4.17.20",
|
|
51
|
-
"@types/react": "18.3.
|
|
52
|
-
"
|
|
53
|
-
"jest
|
|
54
|
-
"
|
|
51
|
+
"@types/react": "18.3.26",
|
|
52
|
+
"@types/react-dom": "18.3.7",
|
|
53
|
+
"jest": "30.2.0",
|
|
54
|
+
"jest-environment-jsdom": "30.2.0",
|
|
55
|
+
"next": "15.5.6",
|
|
55
56
|
"npm-run-all": "4.1.5",
|
|
56
57
|
"postcss": "8.5.6",
|
|
57
58
|
"react": "18.3.1",
|
|
58
59
|
"react-dom": "18.3.1",
|
|
59
|
-
"rollup": "4.
|
|
60
|
+
"rollup": "4.53.2",
|
|
60
61
|
"rollup-plugin-dts": "6.2.3",
|
|
61
62
|
"rollup-plugin-filesize": "10.0.0",
|
|
62
|
-
"rollup-plugin-node-externals": "8.1.
|
|
63
|
+
"rollup-plugin-node-externals": "8.1.2",
|
|
63
64
|
"rollup-plugin-node-polyfills": "0.2.1",
|
|
64
65
|
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
65
66
|
"rollup-plugin-typescript2": "0.36.0",
|
|
66
|
-
"sass": "1.
|
|
67
|
+
"sass": "1.94.0",
|
|
67
68
|
"tslib": "2.8.1"
|
|
68
69
|
},
|
|
69
70
|
"peerDependencies": {
|
|
70
71
|
"react": "16 - 19",
|
|
71
72
|
"react-dom": "16 - 19",
|
|
72
|
-
"@amsterdam/design-system-css": "2.0
|
|
73
|
+
"@amsterdam/design-system-css": "2.2.0"
|
|
73
74
|
},
|
|
74
75
|
"scripts": {
|
|
75
|
-
"build": "tsc && rollup -c",
|
|
76
|
+
"build": "tsc --project ./tsconfig.build.json && rollup -c",
|
|
76
77
|
"build:watch": "rollup -c --watch",
|
|
77
78
|
"clean": "rimraf dist/",
|
|
78
|
-
"lint": "tsc --noEmit --project ./tsconfig.json
|
|
79
|
+
"lint": "tsc --noEmit --project ./tsconfig.json",
|
|
79
80
|
"test": "jest --verbose --coverage",
|
|
80
81
|
"watch:test": "jest --verbose --watch"
|
|
81
82
|
}
|
|
@@ -1,44 +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 { Accordion } from './Accordion';
|
|
10
|
-
import '@testing-library/jest-dom';
|
|
11
|
-
describe('Accordion', () => {
|
|
12
|
-
it('renders an accordion', () => {
|
|
13
|
-
const { container } = render(_jsx(Accordion, { headingLevel: 2 }));
|
|
14
|
-
const accordion = container.querySelector('.ams-accordion');
|
|
15
|
-
expect(accordion).toBeInTheDocument();
|
|
16
|
-
expect(accordion).toBeVisible();
|
|
17
|
-
});
|
|
18
|
-
it('renders an extra class name', () => {
|
|
19
|
-
const { container } = render(_jsx(Accordion, { className: "test", headingLevel: 2 }));
|
|
20
|
-
const accordion = container.querySelector('.ams-accordion');
|
|
21
|
-
expect(accordion).toHaveClass('test');
|
|
22
|
-
});
|
|
23
|
-
it('sets focus on Accordion buttons when using arrow keys', async () => {
|
|
24
|
-
const user = userEvent.setup();
|
|
25
|
-
render(_jsxs(Accordion, { headingLevel: 2, children: [_jsx(Accordion.Section, { label: "one" }), _jsx(Accordion.Section, { label: "two" }), _jsx(Accordion.Section, { label: "three" })] }));
|
|
26
|
-
const firstButton = screen.getByRole('button', { name: 'one' });
|
|
27
|
-
const thirdButton = screen.getByRole('button', { name: 'three' });
|
|
28
|
-
await user.click(firstButton);
|
|
29
|
-
expect(firstButton).toHaveFocus();
|
|
30
|
-
// Click the down arrow key twice
|
|
31
|
-
await user.keyboard('{ArrowDown}');
|
|
32
|
-
await user.keyboard('{ArrowDown}');
|
|
33
|
-
expect(thirdButton).toHaveFocus();
|
|
34
|
-
expect(firstButton).not.toHaveFocus();
|
|
35
|
-
await user.keyboard('{ArrowDown}');
|
|
36
|
-
expect(firstButton).toHaveFocus();
|
|
37
|
-
});
|
|
38
|
-
it('supports ForwardRef in React', () => {
|
|
39
|
-
const ref = createRef();
|
|
40
|
-
const { container } = render(_jsx(Accordion, { headingLevel: 2, ref: ref }));
|
|
41
|
-
const accordion = container.querySelector('.ams-accordion');
|
|
42
|
-
expect(ref.current).toBe(accordion);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import { fireEvent, render, screen } from '@testing-library/react';
|
|
7
|
-
import { createRef } from 'react';
|
|
8
|
-
import { Accordion } from './Accordion';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Accordion section', () => {
|
|
11
|
-
const testLabel = 'Test title';
|
|
12
|
-
const testContent = 'Test content';
|
|
13
|
-
it('renders an accordion section', () => {
|
|
14
|
-
const { container } = render(_jsx(Accordion.Section, { label: testLabel, children: testContent }));
|
|
15
|
-
const accordionSection = container.querySelector('.ams-accordion__section');
|
|
16
|
-
expect(accordionSection).toBeInTheDocument();
|
|
17
|
-
expect(accordionSection).toBeVisible();
|
|
18
|
-
});
|
|
19
|
-
it('renders the accordion section BEM class names', () => {
|
|
20
|
-
const { container } = render(_jsx(Accordion.Section, { label: testLabel, children: testContent }));
|
|
21
|
-
const heading = screen.getByRole('heading', {
|
|
22
|
-
name: testLabel,
|
|
23
|
-
});
|
|
24
|
-
const button = screen.getByRole('button', {
|
|
25
|
-
name: testLabel,
|
|
26
|
-
});
|
|
27
|
-
const section = container.querySelector('.ams-accordion__panel');
|
|
28
|
-
expect(heading).toHaveClass('ams-heading ams-accordion__header');
|
|
29
|
-
expect(button).toHaveClass('ams-accordion__button');
|
|
30
|
-
expect(section).toBeInTheDocument();
|
|
31
|
-
});
|
|
32
|
-
it('adds and removes --expanded class when the button is clicked', () => {
|
|
33
|
-
const { getByText } = render(_jsx(Accordion.Section, { label: testLabel, children: testContent }));
|
|
34
|
-
const button = screen.getByRole('button', {
|
|
35
|
-
name: testLabel,
|
|
36
|
-
});
|
|
37
|
-
const sectionContent = getByText(testContent);
|
|
38
|
-
expect(sectionContent).not.toHaveClass('ams-accordion__panel--expanded');
|
|
39
|
-
fireEvent.click(button);
|
|
40
|
-
expect(sectionContent).toHaveClass('ams-accordion__panel--expanded');
|
|
41
|
-
fireEvent.click(button);
|
|
42
|
-
expect(sectionContent).not.toHaveClass('ams-accordion__panel--expanded');
|
|
43
|
-
});
|
|
44
|
-
it('adds --expanded class when expanded prop is true', () => {
|
|
45
|
-
const { getByText } = render(_jsx(Accordion.Section, { expanded: true, label: testLabel, children: testContent }));
|
|
46
|
-
const sectionContent = getByText(testContent);
|
|
47
|
-
expect(sectionContent).toHaveClass('ams-accordion__panel--expanded');
|
|
48
|
-
});
|
|
49
|
-
it('renders a section HTML tag by default', () => {
|
|
50
|
-
render(_jsx(Accordion, { headingLevel: 2, children: _jsx(Accordion.Section, { label: testLabel, children: testContent }) }));
|
|
51
|
-
const sectionQuery = screen.queryByRole('region');
|
|
52
|
-
expect(sectionQuery).toBeInTheDocument();
|
|
53
|
-
});
|
|
54
|
-
it('does not render a section HTML tag when the sectionAs is "div"', () => {
|
|
55
|
-
render(_jsx(Accordion, { headingLevel: 2, sectionAs: "div", children: _jsx(Accordion.Section, { label: testLabel, children: testContent }) }));
|
|
56
|
-
const sectionQuery = screen.queryByRole('region');
|
|
57
|
-
expect(sectionQuery).not.toBeInTheDocument();
|
|
58
|
-
});
|
|
59
|
-
it('renders an accessible heading', () => {
|
|
60
|
-
render(_jsx(Accordion, { headingLevel: 3, children: _jsx(Accordion.Section, { label: testLabel, children: testContent }) }));
|
|
61
|
-
const heading = screen.getByRole('heading', {
|
|
62
|
-
level: 3,
|
|
63
|
-
name: testLabel,
|
|
64
|
-
});
|
|
65
|
-
expect(heading).toBeInTheDocument();
|
|
66
|
-
expect(heading).toBeVisible();
|
|
67
|
-
});
|
|
68
|
-
it('renders the allowed levels correctly', () => {
|
|
69
|
-
render(_jsxs(_Fragment, { children: [_jsx(Accordion, { headingLevel: 2, children: _jsx(Accordion.Section, { label: "Level 2", children: testContent }) }), _jsx(Accordion, { headingLevel: 4, children: _jsx(Accordion.Section, { label: "Level 4", children: testContent }) })] }));
|
|
70
|
-
const headingLevel2 = screen.getByRole('heading', {
|
|
71
|
-
level: 2,
|
|
72
|
-
name: 'Level 2',
|
|
73
|
-
});
|
|
74
|
-
const headingLevel4 = screen.getByRole('heading', {
|
|
75
|
-
level: 4,
|
|
76
|
-
name: 'Level 4',
|
|
77
|
-
});
|
|
78
|
-
expect(headingLevel2).toBeInTheDocument();
|
|
79
|
-
expect(headingLevel4).toBeInTheDocument();
|
|
80
|
-
});
|
|
81
|
-
it('renders an icon', () => {
|
|
82
|
-
render(_jsx(Accordion.Section, { label: testLabel, children: testContent }));
|
|
83
|
-
const button = screen.getByRole('button', {
|
|
84
|
-
name: testLabel,
|
|
85
|
-
});
|
|
86
|
-
const icon = button ? button.querySelector('svg:only-child') : null;
|
|
87
|
-
expect(icon).toBeInTheDocument();
|
|
88
|
-
});
|
|
89
|
-
it('renders an extra class name', () => {
|
|
90
|
-
const { container } = render(_jsx(Accordion.Section, { className: "test", label: testLabel, children: testContent }));
|
|
91
|
-
const accordionSection = container.querySelector('.ams-accordion__section');
|
|
92
|
-
expect(accordionSection).toHaveClass('test');
|
|
93
|
-
});
|
|
94
|
-
it('supports ForwardRef in React', () => {
|
|
95
|
-
const ref = createRef();
|
|
96
|
-
const { container } = render(_jsx(Accordion.Section, { label: testLabel, ref: ref, children: testContent }));
|
|
97
|
-
const accordionSection = container.querySelector('.ams-accordion__section');
|
|
98
|
-
expect(ref.current).toBe(accordionSection);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
@@ -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 { ActionGroup } from './ActionGroup';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Action Group', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
render(_jsx(ActionGroup, {}));
|
|
13
|
-
const component = screen.getByRole('group');
|
|
14
|
-
expect(component).toBeInTheDocument();
|
|
15
|
-
expect(component).toBeVisible();
|
|
16
|
-
});
|
|
17
|
-
it('renders a design system BEM class name', () => {
|
|
18
|
-
render(_jsx(ActionGroup, {}));
|
|
19
|
-
const component = screen.getByRole('group');
|
|
20
|
-
expect(component).toHaveClass('ams-action-group');
|
|
21
|
-
});
|
|
22
|
-
it('renders an extra class name', () => {
|
|
23
|
-
render(_jsx(ActionGroup, { className: "extra" }));
|
|
24
|
-
const component = screen.getByRole('group');
|
|
25
|
-
expect(component).toHaveClass('ams-action-group extra');
|
|
26
|
-
});
|
|
27
|
-
it('supports ForwardRef in React', () => {
|
|
28
|
-
const ref = createRef();
|
|
29
|
-
render(_jsx(ActionGroup, { ref: ref }));
|
|
30
|
-
const component = screen.getByRole('group');
|
|
31
|
-
expect(ref.current).toBe(component);
|
|
32
|
-
});
|
|
33
|
-
});
|
package/dist/Alert/Alert.test.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @license EUPL-1.2+
|
|
4
|
-
* Copyright Gemeente Amsterdam
|
|
5
|
-
*/
|
|
6
|
-
import { fireEvent, render, screen } from '@testing-library/react';
|
|
7
|
-
import { createRef } from 'react';
|
|
8
|
-
import { Alert } from './Alert';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Alert', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
render(_jsx(Alert, { heading: "Let op!", headingLevel: 2 }));
|
|
13
|
-
const component = screen.getByRole('region', { name: 'Let op!' });
|
|
14
|
-
const icon = component?.querySelector('.ams-alert__severity-indicator > .ams-icon');
|
|
15
|
-
expect(component).toBeInTheDocument();
|
|
16
|
-
expect(component).toBeVisible();
|
|
17
|
-
expect(icon).toBeInTheDocument();
|
|
18
|
-
expect(icon).not.toBeVisible(); // The icon is hidden by default, and only shown when the CSS loads.
|
|
19
|
-
});
|
|
20
|
-
it('renders a design system BEM class name', () => {
|
|
21
|
-
render(_jsx(Alert, { heading: "Let op!", headingLevel: 2 }));
|
|
22
|
-
const component = screen.getByRole('region', { name: 'Let op!' });
|
|
23
|
-
expect(component).toHaveClass('ams-alert');
|
|
24
|
-
});
|
|
25
|
-
it('renders an extra class name', () => {
|
|
26
|
-
render(_jsx(Alert, { className: "extra", heading: "Let op!", headingLevel: 2 }));
|
|
27
|
-
const component = screen.getByRole('region', { name: 'Let op!' });
|
|
28
|
-
expect(component).toHaveClass('ams-alert extra');
|
|
29
|
-
});
|
|
30
|
-
it('supports ForwardRef in React', () => {
|
|
31
|
-
const ref = createRef();
|
|
32
|
-
render(_jsx(Alert, { heading: "Let op!", headingLevel: 2, ref: ref }));
|
|
33
|
-
const component = screen.getByRole('region', { name: 'Let op!' });
|
|
34
|
-
expect(ref.current).toBe(component);
|
|
35
|
-
});
|
|
36
|
-
it('renders a heading', () => {
|
|
37
|
-
render(_jsx(Alert, { heading: "Test heading", headingLevel: 2 }));
|
|
38
|
-
const heading = screen.getByRole('heading', {
|
|
39
|
-
name: 'Test heading',
|
|
40
|
-
});
|
|
41
|
-
expect(heading).toBeInTheDocument();
|
|
42
|
-
});
|
|
43
|
-
it('renders the close button', () => {
|
|
44
|
-
render(_jsx(Alert, { closeable: true, heading: "Let op!", headingLevel: 2 }));
|
|
45
|
-
const component = screen.getByRole('region', { name: 'Let op!' });
|
|
46
|
-
const closeButton = component?.querySelector('.ams-icon-button');
|
|
47
|
-
expect(closeButton).toBeInTheDocument();
|
|
48
|
-
expect(closeButton).toBeVisible();
|
|
49
|
-
});
|
|
50
|
-
it('renders the close button with a label', () => {
|
|
51
|
-
render(_jsx(Alert, { closeable: true, closeButtonLabel: "Close", heading: "Let op!", headingLevel: 2 }));
|
|
52
|
-
const closeButton = screen.getByRole('button', { name: 'Close' });
|
|
53
|
-
expect(closeButton).toBeInTheDocument();
|
|
54
|
-
});
|
|
55
|
-
it('fires the onClose event when the close button is clicked', () => {
|
|
56
|
-
const onClose = jest.fn();
|
|
57
|
-
render(_jsx(Alert, { closeable: true, heading: "Let op!", headingLevel: 2, onClose: onClose }));
|
|
58
|
-
const component = screen.getByRole('region', { name: 'Let op!' });
|
|
59
|
-
const closeButton = component?.querySelector('.ams-icon-button');
|
|
60
|
-
fireEvent.click(closeButton);
|
|
61
|
-
expect(onClose).toHaveBeenCalled();
|
|
62
|
-
});
|
|
63
|
-
it('uses a custom headingId to label the Alert', () => {
|
|
64
|
-
render(_jsx(Alert, { heading: "Let op!", headingId: "custom-heading-id", headingLevel: 2 }));
|
|
65
|
-
const component = screen.getByRole('region', { name: 'Let op!' });
|
|
66
|
-
expect(component).toBeInTheDocument();
|
|
67
|
-
expect(component).toHaveAttribute('aria-labelledby', 'custom-heading-id');
|
|
68
|
-
});
|
|
69
|
-
it('does not label the Alert when headingId is set to null', () => {
|
|
70
|
-
const { container } = render(_jsx(Alert, { heading: "Let op!", headingId: null, headingLevel: 2 }));
|
|
71
|
-
const component = container.querySelector(':only-child');
|
|
72
|
-
expect(component).not.toHaveAttribute('aria-labelledby');
|
|
73
|
-
});
|
|
74
|
-
});
|
|
@@ -1,63 +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 { Avatar, avatarColors } from './Avatar';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Avatar', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
render(_jsx(Avatar, { label: "NR" }));
|
|
13
|
-
const component = screen.getByText('Initialen gebruiker: NR');
|
|
14
|
-
expect(component).toBeInTheDocument();
|
|
15
|
-
expect(component).toBeVisible();
|
|
16
|
-
});
|
|
17
|
-
it('renders a design system BEM class name', () => {
|
|
18
|
-
const { container } = render(_jsx(Avatar, { label: "RS" }));
|
|
19
|
-
const component = container.querySelector(':only-child');
|
|
20
|
-
expect(component).toHaveClass('ams-avatar');
|
|
21
|
-
});
|
|
22
|
-
it('renders an extra class name', () => {
|
|
23
|
-
const { container } = render(_jsx(Avatar, { className: "extra", label: "VS" }));
|
|
24
|
-
const component = container.querySelector(':only-child');
|
|
25
|
-
expect(component).toHaveClass('ams-avatar extra');
|
|
26
|
-
});
|
|
27
|
-
it('renders with a label consisting of no more than two, uppercase letters', () => {
|
|
28
|
-
const { container } = render(_jsx(Avatar, { label: "Design System" }));
|
|
29
|
-
const component = container.querySelector(':only-child');
|
|
30
|
-
expect(component).toHaveTextContent('DE');
|
|
31
|
-
});
|
|
32
|
-
it('renders with default content and title', () => {
|
|
33
|
-
const { container } = render(_jsx(Avatar, { label: "" }));
|
|
34
|
-
const component = screen.getByText('Gebruiker');
|
|
35
|
-
const svg = container.querySelector('svg');
|
|
36
|
-
expect(component).toBeVisible();
|
|
37
|
-
expect(svg).toBeInTheDocument();
|
|
38
|
-
expect(svg).not.toBeVisible(); // The icon is hidden by default, and only shown when the CSS loads.
|
|
39
|
-
});
|
|
40
|
-
it('renders with a profile picture', () => {
|
|
41
|
-
const { container } = render(_jsx(Avatar, { imageSrc: "image-source", label: "RS" }));
|
|
42
|
-
const component = screen.getByText('Initialen gebruiker: RS');
|
|
43
|
-
const image = container.querySelector('[src="image-source"]');
|
|
44
|
-
expect(component).toBeVisible();
|
|
45
|
-
expect(image).toBeVisible();
|
|
46
|
-
});
|
|
47
|
-
it('shortens a label that is too long', () => {
|
|
48
|
-
const { container } = render(_jsx(Avatar, { label: "ABC" }));
|
|
49
|
-
const component = container.querySelector(':only-child');
|
|
50
|
-
expect(component).toHaveTextContent('AB');
|
|
51
|
-
});
|
|
52
|
-
avatarColors.map((color) => it(`renders with ${color} color`, () => {
|
|
53
|
-
const { container } = render(_jsx(Avatar, { color: color, label: "AL" }));
|
|
54
|
-
const component = container.querySelector(':only-child');
|
|
55
|
-
expect(component).toHaveClass(`ams-avatar--${color}`);
|
|
56
|
-
}));
|
|
57
|
-
it('supports ForwardRef in React', () => {
|
|
58
|
-
const ref = createRef();
|
|
59
|
-
const { container } = render(_jsx(Avatar, { label: "AL", ref: ref }));
|
|
60
|
-
const component = container.querySelector(':only-child');
|
|
61
|
-
expect(ref.current).toBe(component);
|
|
62
|
-
});
|
|
63
|
-
});
|
package/dist/Badge/Badge.test.js
DELETED
|
@@ -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 { Badge, badgeColors } from './Badge';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Badge', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
const { container } = render(_jsx(Badge, { label: "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(Badge, { label: "test" }));
|
|
19
|
-
const component = container.querySelector(':only-child');
|
|
20
|
-
expect(component).toHaveClass('ams-badge');
|
|
21
|
-
});
|
|
22
|
-
it('renders an extra class name', () => {
|
|
23
|
-
const { container } = render(_jsx(Badge, { className: "extra", label: "test" }));
|
|
24
|
-
const component = container.querySelector(':only-child');
|
|
25
|
-
expect(component).toHaveClass('ams-badge extra');
|
|
26
|
-
});
|
|
27
|
-
it('supports ForwardRef in React', () => {
|
|
28
|
-
const ref = createRef();
|
|
29
|
-
const { container } = render(_jsx(Badge, { label: "test", ref: ref }));
|
|
30
|
-
const component = container.querySelector(':only-child');
|
|
31
|
-
expect(ref.current).toBe(component);
|
|
32
|
-
});
|
|
33
|
-
it('renders with a number label', () => {
|
|
34
|
-
const { container } = render(_jsx(Badge, { label: 1 }));
|
|
35
|
-
const component = container.querySelector(':only-child');
|
|
36
|
-
expect(component).toHaveTextContent('1');
|
|
37
|
-
});
|
|
38
|
-
badgeColors.map((color) => it(`renders with ${color} color`, () => {
|
|
39
|
-
const { container } = render(_jsx(Badge, { color: color, label: "test" }));
|
|
40
|
-
const component = container.querySelector(':only-child');
|
|
41
|
-
expect(component).toHaveClass(`ams-badge--${color}`);
|
|
42
|
-
}));
|
|
43
|
-
});
|
|
@@ -1,46 +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 { Blockquote } from './Blockquote';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Blockquote', () => {
|
|
11
|
-
it('renders a blockquote HTML element', () => {
|
|
12
|
-
const { container } = render(_jsx(Blockquote, {}));
|
|
13
|
-
// TODO: Testing library doesn't seem to recognize the 'blockquote' ARIA role?
|
|
14
|
-
// const quote = screen.getByRole('blockquote')
|
|
15
|
-
const quote = container.querySelector('blockquote:only-child');
|
|
16
|
-
expect(quote).toBeInTheDocument();
|
|
17
|
-
expect(quote).toBeVisible();
|
|
18
|
-
});
|
|
19
|
-
it('renders its content', () => {
|
|
20
|
-
render(_jsx(Blockquote, { children: "Quote" }));
|
|
21
|
-
const quote = screen.getByText('Quote');
|
|
22
|
-
expect(quote).toBeInTheDocument();
|
|
23
|
-
expect(quote).toBeVisible();
|
|
24
|
-
});
|
|
25
|
-
it('renders a design system BEM class name', () => {
|
|
26
|
-
const { container } = render(_jsx(Blockquote, {}));
|
|
27
|
-
const quote = container.querySelector(':only-child');
|
|
28
|
-
expect(quote).toHaveClass('ams-blockquote');
|
|
29
|
-
});
|
|
30
|
-
it('renders an extra class name', () => {
|
|
31
|
-
const { container } = render(_jsx(Blockquote, { className: "extra" }));
|
|
32
|
-
const quote = container.querySelector(':only-child');
|
|
33
|
-
expect(quote).toHaveClass('ams-blockquote extra');
|
|
34
|
-
});
|
|
35
|
-
it('renders the class name for inverse color', () => {
|
|
36
|
-
const { container } = render(_jsx(Blockquote, { color: "inverse" }));
|
|
37
|
-
const quote = container.querySelector(':only-child');
|
|
38
|
-
expect(quote).toHaveClass('ams-blockquote--inverse');
|
|
39
|
-
});
|
|
40
|
-
it('supports ForwardRef in React', () => {
|
|
41
|
-
const ref = createRef();
|
|
42
|
-
const { container } = render(_jsx(Blockquote, { ref: ref }));
|
|
43
|
-
const quote = container.querySelector(':only-child');
|
|
44
|
-
expect(ref.current).toBe(quote);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
@@ -1,45 +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 { Breadcrumb } from './Breadcrumb';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Breadcrumb', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
render(_jsx(Breadcrumb, {}));
|
|
13
|
-
const component = screen.getByRole('navigation');
|
|
14
|
-
expect(component).toBeInTheDocument();
|
|
15
|
-
expect(component).toBeVisible();
|
|
16
|
-
});
|
|
17
|
-
it('renders a design system BEM class name', () => {
|
|
18
|
-
render(_jsx(Breadcrumb, {}));
|
|
19
|
-
const component = screen.getByRole('navigation');
|
|
20
|
-
expect(component).toHaveClass('ams-breadcrumb');
|
|
21
|
-
});
|
|
22
|
-
it('renders an extra class name', () => {
|
|
23
|
-
render(_jsx(Breadcrumb, { className: "extra" }));
|
|
24
|
-
const component = screen.getByRole('navigation');
|
|
25
|
-
expect(component).toHaveClass('ams-breadcrumb extra');
|
|
26
|
-
});
|
|
27
|
-
it('renders Breadcrumb component with children', () => {
|
|
28
|
-
const breadcrumbLinks = [
|
|
29
|
-
{ href: '/link-1', label: 'Link 1' },
|
|
30
|
-
{ href: '/link-2', label: 'Link 2' },
|
|
31
|
-
{ href: '/link-3', label: 'Link 3' },
|
|
32
|
-
];
|
|
33
|
-
const { container } = render(_jsx(Breadcrumb, { children: breadcrumbLinks.map((link) => (_jsx(Breadcrumb.Link, { href: link.href, children: link.label }, link.label))) }));
|
|
34
|
-
const breadcrumb = screen.getByRole('navigation');
|
|
35
|
-
const breadcrumbs = container.querySelectorAll('.ams-breadcrumb__item');
|
|
36
|
-
expect(breadcrumb).toBeInTheDocument();
|
|
37
|
-
expect(breadcrumbs.length).toBe(3);
|
|
38
|
-
});
|
|
39
|
-
it('is able to pass a React ref', () => {
|
|
40
|
-
const ref = createRef();
|
|
41
|
-
const { container } = render(_jsx(Breadcrumb, { ref: ref, children: _jsx(Breadcrumb.Link, { href: "/link-1", children: "Valid Link" }) }));
|
|
42
|
-
const breadcrumb = container.querySelector(':only-child');
|
|
43
|
-
expect(ref.current).toBe(breadcrumb);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
@@ -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 { BreadcrumbLink } from './BreadcrumbLink';
|
|
9
|
-
import '@testing-library/jest-dom';
|
|
10
|
-
describe('Breadcrumb link', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
render(_jsx(BreadcrumbLink, { href: "/" }));
|
|
13
|
-
const component = screen.getByRole('listitem');
|
|
14
|
-
expect(component).toBeInTheDocument();
|
|
15
|
-
expect(component).toBeVisible();
|
|
16
|
-
});
|
|
17
|
-
it('renders a design system BEM class name', () => {
|
|
18
|
-
render(_jsx(BreadcrumbLink, { href: "/" }));
|
|
19
|
-
const item = screen.getByRole('listitem');
|
|
20
|
-
expect(item).toHaveClass('ams-breadcrumb__item');
|
|
21
|
-
const link = screen.getByRole('link');
|
|
22
|
-
expect(link).toHaveClass('ams-breadcrumb__link');
|
|
23
|
-
});
|
|
24
|
-
it('renders an extra class name', () => {
|
|
25
|
-
render(_jsx(BreadcrumbLink, { className: "extra", href: "/" }));
|
|
26
|
-
const component = screen.getByRole('link');
|
|
27
|
-
expect(component).toHaveClass('ams-breadcrumb__link extra');
|
|
28
|
-
});
|
|
29
|
-
it('renders the href attribute', () => {
|
|
30
|
-
render(_jsx(BreadcrumbLink, { href: "/" }));
|
|
31
|
-
const component = screen.getByRole('link');
|
|
32
|
-
expect(component).toHaveAttribute('href', '/');
|
|
33
|
-
});
|
|
34
|
-
it('supports ForwardRef in React', () => {
|
|
35
|
-
const ref = createRef();
|
|
36
|
-
render(_jsx(BreadcrumbLink, { href: "/", ref: ref }));
|
|
37
|
-
const component = screen.getByRole('link');
|
|
38
|
-
expect(ref.current).toBe(component);
|
|
39
|
-
});
|
|
40
|
-
});
|