@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.
Files changed (262) hide show
  1. package/dist/Avatar/Avatar.d.ts +2 -2
  2. package/dist/Card/Card.d.ts +1 -1
  3. package/dist/Card/CardHeading.d.ts +1 -1
  4. package/dist/Checkbox/Checkbox.d.ts +1 -1
  5. package/dist/DateInput/DateInput.d.ts +1 -1
  6. package/dist/FieldSet/FieldSet.d.ts +11 -0
  7. package/dist/FieldSet/FieldSet.js +3 -3
  8. package/dist/Hint/Hint.d.ts +1 -0
  9. package/dist/Hint/Hint.js +2 -2
  10. package/dist/Image/Image.js +1 -1
  11. package/dist/Label/Label.d.ts +11 -0
  12. package/dist/Label/Label.js +2 -2
  13. package/dist/LinkList/LinkList.d.ts +1 -1
  14. package/dist/Menu/MenuLink.d.ts +2 -2
  15. package/dist/Page/Page.d.ts +6 -2
  16. package/dist/Page/Page.js +1 -1
  17. package/dist/PageHeader/PageHeader.d.ts +1 -0
  18. package/dist/PageHeader/PageHeaderMenuIcon.js +1 -1
  19. package/dist/PageHeader/PageHeaderMenuLink.d.ts +7 -0
  20. package/dist/PageHeader/PageHeaderMenuLink.js +3 -2
  21. package/dist/PasswordInput/PasswordInput.d.ts +1 -1
  22. package/dist/Radio/Radio.d.ts +1 -1
  23. package/dist/SearchField/SearchField.d.ts +1 -1
  24. package/dist/TimeInput/TimeInput.d.ts +1 -1
  25. package/dist/index.cjs.js +29 -28
  26. package/dist/index.cjs.js.map +1 -1
  27. package/dist/index.d.ts +1935 -61
  28. package/dist/index.esm.js +29 -28
  29. package/dist/index.esm.js.map +1 -1
  30. package/dist/tsconfig.build.tsbuildinfo +1 -1
  31. package/package.json +5 -5
  32. package/dist/Accordion/Accordion.test.d.ts +0 -5
  33. package/dist/Accordion/Accordion.test.js +0 -44
  34. package/dist/Accordion/AccordionSection.test.d.ts +0 -5
  35. package/dist/Accordion/AccordionSection.test.js +0 -100
  36. package/dist/ActionGroup/ActionGroup.test.d.ts +0 -5
  37. package/dist/ActionGroup/ActionGroup.test.js +0 -33
  38. package/dist/Alert/Alert.test.d.ts +0 -5
  39. package/dist/Alert/Alert.test.js +0 -74
  40. package/dist/App/App.d.ts +0 -12
  41. package/dist/App/App.js +0 -8
  42. package/dist/App/App.test.d.ts +0 -5
  43. package/dist/App/App.test.js +0 -33
  44. package/dist/App/index.d.ts +0 -6
  45. package/dist/App/index.js +0 -5
  46. package/dist/AppNavigation/AppNavigation.d.ts +0 -45
  47. package/dist/AppNavigation/AppNavigation.js +0 -18
  48. package/dist/AppNavigation/AppNavigation.test.d.ts +0 -5
  49. package/dist/AppNavigation/AppNavigation.test.js +0 -33
  50. package/dist/AppNavigation/AppNavigationButton.d.ts +0 -18
  51. package/dist/AppNavigation/AppNavigationButton.js +0 -17
  52. package/dist/AppNavigation/AppNavigationLink.d.ts +0 -19
  53. package/dist/AppNavigation/AppNavigationLink.js +0 -19
  54. package/dist/AppNavigation/AppNavigationMenu.d.ts +0 -9
  55. package/dist/AppNavigation/AppNavigationMenu.js +0 -5
  56. package/dist/AppNavigation/index.d.ts +0 -6
  57. package/dist/AppNavigation/index.js +0 -5
  58. package/dist/Avatar/Avatar.test.d.ts +0 -5
  59. package/dist/Avatar/Avatar.test.js +0 -63
  60. package/dist/Badge/Badge.test.d.ts +0 -5
  61. package/dist/Badge/Badge.test.js +0 -43
  62. package/dist/Blockquote/Blockquote.test.d.ts +0 -5
  63. package/dist/Blockquote/Blockquote.test.js +0 -46
  64. package/dist/Breadcrumb/Breadcrumb.test.d.ts +0 -5
  65. package/dist/Breadcrumb/Breadcrumb.test.js +0 -45
  66. package/dist/Breadcrumb/BreadcrumbLink.test.d.ts +0 -5
  67. package/dist/Breadcrumb/BreadcrumbLink.test.js +0 -40
  68. package/dist/Breakout/Breakout.test.d.ts +0 -5
  69. package/dist/Breakout/Breakout.test.js +0 -62
  70. package/dist/Breakout/BreakoutCell.test.d.ts +0 -5
  71. package/dist/Breakout/BreakoutCell.test.js +0 -128
  72. package/dist/Button/Button.test.d.ts +0 -5
  73. package/dist/Button/Button.test.js +0 -114
  74. package/dist/CallToActionLink/CallToActionLink.test.d.ts +0 -5
  75. package/dist/CallToActionLink/CallToActionLink.test.js +0 -33
  76. package/dist/Card/Card.test.d.ts +0 -5
  77. package/dist/Card/Card.test.js +0 -33
  78. package/dist/Card/CardHeading.test.d.ts +0 -5
  79. package/dist/Card/CardHeading.test.js +0 -38
  80. package/dist/Card/CardHeadingGroup.test.d.ts +0 -5
  81. package/dist/Card/CardHeadingGroup.test.js +0 -38
  82. package/dist/Card/CardImage.test.d.ts +0 -5
  83. package/dist/Card/CardImage.test.js +0 -33
  84. package/dist/Card/CardLink.test.d.ts +0 -5
  85. package/dist/Card/CardLink.test.js +0 -33
  86. package/dist/CharacterCount/CharacterCount.test.d.ts +0 -5
  87. package/dist/CharacterCount/CharacterCount.test.js +0 -38
  88. package/dist/Checkbox/Checkbox.test.d.ts +0 -5
  89. package/dist/Checkbox/Checkbox.test.js +0 -142
  90. package/dist/Column/Column.test.d.ts +0 -5
  91. package/dist/Column/Column.test.js +0 -59
  92. package/dist/DateInput/DateInput.test.d.ts +0 -5
  93. package/dist/DateInput/DateInput.test.js +0 -58
  94. package/dist/DescriptionList/DescriptionList.test.d.ts +0 -5
  95. package/dist/DescriptionList/DescriptionList.test.js +0 -43
  96. package/dist/DescriptionList/DescriptionListDescription.test.d.ts +0 -5
  97. package/dist/DescriptionList/DescriptionListDescription.test.js +0 -33
  98. package/dist/DescriptionList/DescriptionListSection.test.d.ts +0 -5
  99. package/dist/DescriptionList/DescriptionListSection.test.js +0 -33
  100. package/dist/DescriptionList/DescriptionListTerm.test.d.ts +0 -5
  101. package/dist/DescriptionList/DescriptionListTerm.test.js +0 -33
  102. package/dist/Dialog/Dialog.test.d.ts +0 -5
  103. package/dist/Dialog/Dialog.test.js +0 -82
  104. package/dist/ErrorMessage/ErrorMessage.test.d.ts +0 -5
  105. package/dist/ErrorMessage/ErrorMessage.test.js +0 -53
  106. package/dist/Field/Field.test.d.ts +0 -5
  107. package/dist/Field/Field.test.js +0 -38
  108. package/dist/FieldSet/FieldSet.test.d.ts +0 -5
  109. package/dist/FieldSet/FieldSet.test.js +0 -70
  110. package/dist/Figure/Figure.test.d.ts +0 -5
  111. package/dist/Figure/Figure.test.js +0 -33
  112. package/dist/Figure/FigureCaption.test.d.ts +0 -5
  113. package/dist/Figure/FigureCaption.test.js +0 -38
  114. package/dist/FileInput/FileInput.test.d.ts +0 -5
  115. package/dist/FileInput/FileInput.test.js +0 -33
  116. package/dist/FileList/FileList.test.d.ts +0 -5
  117. package/dist/FileList/FileList.test.js +0 -33
  118. package/dist/FileList/FileListItem.test.d.ts +0 -5
  119. package/dist/FileList/FileListItem.test.js +0 -44
  120. package/dist/Grid/Grid.test.d.ts +0 -5
  121. package/dist/Grid/Grid.test.js +0 -69
  122. package/dist/Grid/GridCell.test.d.ts +0 -5
  123. package/dist/Grid/GridCell.test.js +0 -84
  124. package/dist/Heading/Heading.test.d.ts +0 -5
  125. package/dist/Heading/Heading.test.js +0 -70
  126. package/dist/Hint/Hint.test.d.ts +0 -5
  127. package/dist/Hint/Hint.test.js +0 -53
  128. package/dist/Icon/Icon.test.d.ts +0 -5
  129. package/dist/Icon/Icon.test.js +0 -60
  130. package/dist/IconButton/IconButton.test.d.ts +0 -5
  131. package/dist/IconButton/IconButton.test.js +0 -48
  132. package/dist/Image/Image.test.d.ts +0 -5
  133. package/dist/Image/Image.test.js +0 -43
  134. package/dist/ImageSlider/ImageSlider.test.d.ts +0 -5
  135. package/dist/ImageSlider/ImageSlider.test.js +0 -70
  136. package/dist/ImageSlider/ImageSliderControls.test.d.ts +0 -5
  137. package/dist/ImageSlider/ImageSliderControls.test.js +0 -25
  138. package/dist/ImageSlider/ImageSliderItem.test.d.ts +0 -5
  139. package/dist/ImageSlider/ImageSliderItem.test.js +0 -37
  140. package/dist/ImageSlider/ImageSliderScroller.test.d.ts +0 -5
  141. package/dist/ImageSlider/ImageSliderScroller.test.js +0 -37
  142. package/dist/ImageSlider/ImageSliderThumbnails.test.d.ts +0 -5
  143. package/dist/ImageSlider/ImageSliderThumbnails.test.js +0 -52
  144. package/dist/InvalidFormAlert/InvalidFormAlert.test.d.ts +0 -5
  145. package/dist/InvalidFormAlert/InvalidFormAlert.test.js +0 -108
  146. package/dist/Label/Label.test.d.ts +0 -5
  147. package/dist/Label/Label.test.js +0 -82
  148. package/dist/Link/Link.test.d.ts +0 -5
  149. package/dist/Link/Link.test.js +0 -43
  150. package/dist/LinkList/LinkList.test.d.ts +0 -5
  151. package/dist/LinkList/LinkList.test.js +0 -33
  152. package/dist/LinkList/LinkListLink.test.d.ts +0 -5
  153. package/dist/LinkList/LinkListLink.test.js +0 -54
  154. package/dist/Logo/Logo.test.d.ts +0 -5
  155. package/dist/Logo/Logo.test.js +0 -33
  156. package/dist/Mark/Mark.test.d.ts +0 -5
  157. package/dist/Mark/Mark.test.js +0 -33
  158. package/dist/Menu/Menu.test.d.ts +0 -5
  159. package/dist/Menu/Menu.test.js +0 -55
  160. package/dist/Menu/MenuLink.test.d.ts +0 -5
  161. package/dist/Menu/MenuLink.test.js +0 -56
  162. package/dist/OrderedList/OrderedList.test.d.ts +0 -5
  163. package/dist/OrderedList/OrderedList.test.js +0 -55
  164. package/dist/OrderedList/OrderedListItem.test.d.ts +0 -5
  165. package/dist/OrderedList/OrderedListItem.test.js +0 -32
  166. package/dist/Overlap/Overlap.test.d.ts +0 -5
  167. package/dist/Overlap/Overlap.test.js +0 -38
  168. package/dist/Page/Page.test.d.ts +0 -5
  169. package/dist/Page/Page.test.js +0 -33
  170. package/dist/PageFooter/PageFooter.test.d.ts +0 -5
  171. package/dist/PageFooter/PageFooter.test.js +0 -33
  172. package/dist/PageFooter/PageFooterMenu.test.d.ts +0 -5
  173. package/dist/PageFooter/PageFooterMenu.test.js +0 -35
  174. package/dist/PageFooter/PageFooterMenuLink.test.d.ts +0 -5
  175. package/dist/PageFooter/PageFooterMenuLink.test.js +0 -33
  176. package/dist/PageFooter/PageFooterSpotlight.test.d.ts +0 -5
  177. package/dist/PageFooter/PageFooterSpotlight.test.js +0 -33
  178. package/dist/PageHeader/PageHeader.test.d.ts +0 -6
  179. package/dist/PageHeader/PageHeader.test.js +0 -131
  180. package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.test.d.ts +0 -5
  181. package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.test.js +0 -38
  182. package/dist/PageHeader/PageHeaderMenuLink.test.d.ts +0 -5
  183. package/dist/PageHeader/PageHeaderMenuLink.test.js +0 -45
  184. package/dist/PageHeading/PageHeading.test.d.ts +0 -5
  185. package/dist/PageHeading/PageHeading.test.js +0 -40
  186. package/dist/Pagination/Pagination.test.d.ts +0 -5
  187. package/dist/Pagination/Pagination.test.js +0 -137
  188. package/dist/Paragraph/Paragraph.test.d.ts +0 -5
  189. package/dist/Paragraph/Paragraph.test.js +0 -62
  190. package/dist/PasswordInput/PasswordInput.test.d.ts +0 -5
  191. package/dist/PasswordInput/PasswordInput.test.js +0 -89
  192. package/dist/Radio/Radio.test.d.ts +0 -5
  193. package/dist/Radio/Radio.test.js +0 -134
  194. package/dist/Row/Row.test.d.ts +0 -5
  195. package/dist/Row/Row.test.js +0 -64
  196. package/dist/SearchField/SearchField.test.d.ts +0 -5
  197. package/dist/SearchField/SearchField.test.js +0 -33
  198. package/dist/SearchField/SearchFieldButton.test.d.ts +0 -5
  199. package/dist/SearchField/SearchFieldButton.test.js +0 -47
  200. package/dist/SearchField/SearchFieldInput.test.d.ts +0 -5
  201. package/dist/SearchField/SearchFieldInput.test.js +0 -65
  202. package/dist/Select/Select.test.d.ts +0 -5
  203. package/dist/Select/Select.test.js +0 -74
  204. package/dist/Select/SelectOption.test.d.ts +0 -5
  205. package/dist/Select/SelectOption.test.js +0 -45
  206. package/dist/Select/SelectOptionGroup.test.d.ts +0 -5
  207. package/dist/Select/SelectOptionGroup.test.js +0 -45
  208. package/dist/SkipLink/SkipLink.test.d.ts +0 -5
  209. package/dist/SkipLink/SkipLink.test.js +0 -33
  210. package/dist/Spotlight/Spotlight.test.d.ts +0 -5
  211. package/dist/Spotlight/Spotlight.test.js +0 -46
  212. package/dist/StandaloneLink/StandaloneLink.test.d.ts +0 -5
  213. package/dist/StandaloneLink/StandaloneLink.test.js +0 -46
  214. package/dist/Switch/Switch.test.d.ts +0 -5
  215. package/dist/Switch/Switch.test.js +0 -69
  216. package/dist/Table/Table.test.d.ts +0 -5
  217. package/dist/Table/Table.test.js +0 -33
  218. package/dist/Table/TableBody.test.d.ts +0 -5
  219. package/dist/Table/TableBody.test.js +0 -34
  220. package/dist/Table/TableCaption.test.d.ts +0 -5
  221. package/dist/Table/TableCaption.test.js +0 -45
  222. package/dist/Table/TableCell.test.d.ts +0 -5
  223. package/dist/Table/TableCell.test.js +0 -36
  224. package/dist/Table/TableFooter.test.d.ts +0 -5
  225. package/dist/Table/TableFooter.test.js +0 -34
  226. package/dist/Table/TableHeader.test.d.ts +0 -5
  227. package/dist/Table/TableHeader.test.js +0 -34
  228. package/dist/Table/TableHeaderCell.test.d.ts +0 -5
  229. package/dist/Table/TableHeaderCell.test.js +0 -42
  230. package/dist/Table/TableRow.test.d.ts +0 -5
  231. package/dist/Table/TableRow.test.js +0 -35
  232. package/dist/TableOfContents/TableOfContents.test.d.ts +0 -5
  233. package/dist/TableOfContents/TableOfContents.test.js +0 -44
  234. package/dist/TableOfContents/TableOfContentsLink.test.d.ts +0 -5
  235. package/dist/TableOfContents/TableOfContentsLink.test.js +0 -34
  236. package/dist/TableOfContents/TableOfContentsList.test.d.ts +0 -5
  237. package/dist/TableOfContents/TableOfContentsList.test.js +0 -40
  238. package/dist/Tabs/Tabs.test.d.ts +0 -5
  239. package/dist/Tabs/Tabs.test.js +0 -104
  240. package/dist/Tabs/TabsButton.test.d.ts +0 -5
  241. package/dist/Tabs/TabsButton.test.js +0 -57
  242. package/dist/Tabs/TabsList.test.d.ts +0 -5
  243. package/dist/Tabs/TabsList.test.js +0 -32
  244. package/dist/Tabs/TabsPanel.test.d.ts +0 -5
  245. package/dist/Tabs/TabsPanel.test.js +0 -42
  246. package/dist/TextArea/TextArea.test.d.ts +0 -5
  247. package/dist/TextArea/TextArea.test.js +0 -105
  248. package/dist/TextInput/TextInput.test.d.ts +0 -5
  249. package/dist/TextInput/TextInput.test.js +0 -92
  250. package/dist/TimeInput/TimeInput.test.d.ts +0 -5
  251. package/dist/TimeInput/TimeInput.test.js +0 -51
  252. package/dist/UnorderedList/UnorderedList.test.d.ts +0 -5
  253. package/dist/UnorderedList/UnorderedList.test.js +0 -55
  254. package/dist/UnorderedList/UnorderedListItem.test.d.ts +0 -5
  255. package/dist/UnorderedList/UnorderedListItem.test.js +0 -32
  256. package/dist/common/formatFileSize.test.d.ts +0 -5
  257. package/dist/common/formatFileSize.test.js +0 -22
  258. package/dist/common/formatFileType.test.d.ts +0 -5
  259. package/dist/common/formatFileType.test.js +0 -27
  260. package/dist/common/useKeyboardFocus.test.d.ts +0 -5
  261. package/dist/common/useKeyboardFocus.test.js +0 -79
  262. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -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,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -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,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -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,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -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,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -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,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -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,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -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
- });
@@ -1,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -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,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -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,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -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,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -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
- });
@@ -1,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';