@amsterdam/design-system-react 2.1.0 → 3.0.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 (279) hide show
  1. package/README.md +1 -1
  2. package/dist/Avatar/Avatar.d.ts +2 -2
  3. package/dist/Card/Card.d.ts +1 -1
  4. package/dist/Card/CardHeading.d.ts +1 -1
  5. package/dist/Checkbox/Checkbox.d.ts +1 -1
  6. package/dist/Column/Column.d.ts +1 -1
  7. package/dist/DateInput/DateInput.d.ts +1 -1
  8. package/dist/FieldSet/FieldSet.d.ts +11 -0
  9. package/dist/FieldSet/FieldSet.js +3 -3
  10. package/dist/Grid/Grid.d.ts +1 -1
  11. package/dist/Grid/GridCell.d.ts +1 -1
  12. package/dist/Hint/Hint.d.ts +1 -0
  13. package/dist/Hint/Hint.js +2 -2
  14. package/dist/Image/Image.js +1 -1
  15. package/dist/Label/Label.d.ts +11 -0
  16. package/dist/Label/Label.js +2 -2
  17. package/dist/LinkList/LinkList.d.ts +1 -1
  18. package/dist/Logo/Logo.d.ts +10 -5
  19. package/dist/Logo/Logo.js +17 -9
  20. package/dist/Menu/MenuLink.d.ts +2 -2
  21. package/dist/Page/Page.d.ts +6 -2
  22. package/dist/Page/Page.js +1 -1
  23. package/dist/PageFooter/PageFooter.d.ts +4 -1
  24. package/dist/PageFooter/PageFooterMenu.d.ts +27 -2
  25. package/dist/PageFooter/PageFooterMenu.js +6 -2
  26. package/dist/PageHeader/PageHeader.d.ts +14 -4
  27. package/dist/PageHeader/PageHeader.js +3 -2
  28. package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.js +2 -1
  29. package/dist/PageHeader/PageHeaderMenuIcon.js +1 -1
  30. package/dist/PageHeader/PageHeaderMenuLink.d.ts +7 -0
  31. package/dist/PageHeader/PageHeaderMenuLink.js +3 -2
  32. package/dist/Paragraph/Paragraph.d.ts +2 -2
  33. package/dist/Paragraph/Paragraph.js +8 -1
  34. package/dist/PasswordInput/PasswordInput.d.ts +1 -1
  35. package/dist/Radio/Radio.d.ts +1 -1
  36. package/dist/Row/Row.d.ts +1 -1
  37. package/dist/SearchField/SearchField.d.ts +1 -1
  38. package/dist/Spotlight/Spotlight.d.ts +1 -1
  39. package/dist/TimeInput/TimeInput.d.ts +1 -1
  40. package/dist/common/useIsAfterBreakpoint.d.ts +4 -4
  41. package/dist/common/useIsAfterBreakpoint.js +12 -13
  42. package/dist/index.cjs.js +95 -62
  43. package/dist/index.cjs.js.map +1 -1
  44. package/dist/index.d.ts +1958 -61
  45. package/dist/index.esm.js +96 -63
  46. package/dist/index.esm.js.map +1 -1
  47. package/dist/tsconfig.build.tsbuildinfo +1 -1
  48. package/package.json +11 -16
  49. package/dist/Accordion/Accordion.test.d.ts +0 -5
  50. package/dist/Accordion/Accordion.test.js +0 -44
  51. package/dist/Accordion/AccordionSection.test.d.ts +0 -5
  52. package/dist/Accordion/AccordionSection.test.js +0 -100
  53. package/dist/ActionGroup/ActionGroup.test.d.ts +0 -5
  54. package/dist/ActionGroup/ActionGroup.test.js +0 -33
  55. package/dist/Alert/Alert.test.d.ts +0 -5
  56. package/dist/Alert/Alert.test.js +0 -74
  57. package/dist/App/App.d.ts +0 -12
  58. package/dist/App/App.js +0 -8
  59. package/dist/App/App.test.d.ts +0 -5
  60. package/dist/App/App.test.js +0 -33
  61. package/dist/App/index.d.ts +0 -6
  62. package/dist/App/index.js +0 -5
  63. package/dist/AppNavigation/AppNavigation.d.ts +0 -45
  64. package/dist/AppNavigation/AppNavigation.js +0 -18
  65. package/dist/AppNavigation/AppNavigation.test.d.ts +0 -5
  66. package/dist/AppNavigation/AppNavigation.test.js +0 -33
  67. package/dist/AppNavigation/AppNavigationButton.d.ts +0 -18
  68. package/dist/AppNavigation/AppNavigationButton.js +0 -17
  69. package/dist/AppNavigation/AppNavigationLink.d.ts +0 -19
  70. package/dist/AppNavigation/AppNavigationLink.js +0 -19
  71. package/dist/AppNavigation/AppNavigationMenu.d.ts +0 -9
  72. package/dist/AppNavigation/AppNavigationMenu.js +0 -5
  73. package/dist/AppNavigation/index.d.ts +0 -6
  74. package/dist/AppNavigation/index.js +0 -5
  75. package/dist/Avatar/Avatar.test.d.ts +0 -5
  76. package/dist/Avatar/Avatar.test.js +0 -63
  77. package/dist/Badge/Badge.test.d.ts +0 -5
  78. package/dist/Badge/Badge.test.js +0 -43
  79. package/dist/Blockquote/Blockquote.test.d.ts +0 -5
  80. package/dist/Blockquote/Blockquote.test.js +0 -46
  81. package/dist/Breadcrumb/Breadcrumb.test.d.ts +0 -5
  82. package/dist/Breadcrumb/Breadcrumb.test.js +0 -45
  83. package/dist/Breadcrumb/BreadcrumbLink.test.d.ts +0 -5
  84. package/dist/Breadcrumb/BreadcrumbLink.test.js +0 -40
  85. package/dist/Breakout/Breakout.test.d.ts +0 -5
  86. package/dist/Breakout/Breakout.test.js +0 -62
  87. package/dist/Breakout/BreakoutCell.test.d.ts +0 -5
  88. package/dist/Breakout/BreakoutCell.test.js +0 -128
  89. package/dist/Button/Button.test.d.ts +0 -5
  90. package/dist/Button/Button.test.js +0 -114
  91. package/dist/CallToActionLink/CallToActionLink.test.d.ts +0 -5
  92. package/dist/CallToActionLink/CallToActionLink.test.js +0 -33
  93. package/dist/Card/Card.test.d.ts +0 -5
  94. package/dist/Card/Card.test.js +0 -33
  95. package/dist/Card/CardHeading.test.d.ts +0 -5
  96. package/dist/Card/CardHeading.test.js +0 -38
  97. package/dist/Card/CardHeadingGroup.test.d.ts +0 -5
  98. package/dist/Card/CardHeadingGroup.test.js +0 -38
  99. package/dist/Card/CardImage.test.d.ts +0 -5
  100. package/dist/Card/CardImage.test.js +0 -33
  101. package/dist/Card/CardLink.test.d.ts +0 -5
  102. package/dist/Card/CardLink.test.js +0 -33
  103. package/dist/CharacterCount/CharacterCount.test.d.ts +0 -5
  104. package/dist/CharacterCount/CharacterCount.test.js +0 -38
  105. package/dist/Checkbox/Checkbox.test.d.ts +0 -5
  106. package/dist/Checkbox/Checkbox.test.js +0 -142
  107. package/dist/Column/Column.test.d.ts +0 -5
  108. package/dist/Column/Column.test.js +0 -59
  109. package/dist/DateInput/DateInput.test.d.ts +0 -5
  110. package/dist/DateInput/DateInput.test.js +0 -58
  111. package/dist/DescriptionList/DescriptionList.test.d.ts +0 -5
  112. package/dist/DescriptionList/DescriptionList.test.js +0 -43
  113. package/dist/DescriptionList/DescriptionListDescription.test.d.ts +0 -5
  114. package/dist/DescriptionList/DescriptionListDescription.test.js +0 -33
  115. package/dist/DescriptionList/DescriptionListSection.test.d.ts +0 -5
  116. package/dist/DescriptionList/DescriptionListSection.test.js +0 -33
  117. package/dist/DescriptionList/DescriptionListTerm.test.d.ts +0 -5
  118. package/dist/DescriptionList/DescriptionListTerm.test.js +0 -33
  119. package/dist/Dialog/Dialog.test.d.ts +0 -5
  120. package/dist/Dialog/Dialog.test.js +0 -82
  121. package/dist/ErrorMessage/ErrorMessage.test.d.ts +0 -5
  122. package/dist/ErrorMessage/ErrorMessage.test.js +0 -53
  123. package/dist/Field/Field.test.d.ts +0 -5
  124. package/dist/Field/Field.test.js +0 -38
  125. package/dist/FieldSet/FieldSet.test.d.ts +0 -5
  126. package/dist/FieldSet/FieldSet.test.js +0 -70
  127. package/dist/Figure/Figure.test.d.ts +0 -5
  128. package/dist/Figure/Figure.test.js +0 -33
  129. package/dist/Figure/FigureCaption.test.d.ts +0 -5
  130. package/dist/Figure/FigureCaption.test.js +0 -38
  131. package/dist/FileInput/FileInput.test.d.ts +0 -5
  132. package/dist/FileInput/FileInput.test.js +0 -33
  133. package/dist/FileList/FileList.test.d.ts +0 -5
  134. package/dist/FileList/FileList.test.js +0 -33
  135. package/dist/FileList/FileListItem.test.d.ts +0 -5
  136. package/dist/FileList/FileListItem.test.js +0 -44
  137. package/dist/Grid/Grid.test.d.ts +0 -5
  138. package/dist/Grid/Grid.test.js +0 -69
  139. package/dist/Grid/GridCell.test.d.ts +0 -5
  140. package/dist/Grid/GridCell.test.js +0 -84
  141. package/dist/Heading/Heading.test.d.ts +0 -5
  142. package/dist/Heading/Heading.test.js +0 -70
  143. package/dist/Hint/Hint.test.d.ts +0 -5
  144. package/dist/Hint/Hint.test.js +0 -53
  145. package/dist/Icon/Icon.test.d.ts +0 -5
  146. package/dist/Icon/Icon.test.js +0 -60
  147. package/dist/IconButton/IconButton.test.d.ts +0 -5
  148. package/dist/IconButton/IconButton.test.js +0 -48
  149. package/dist/Image/Image.test.d.ts +0 -5
  150. package/dist/Image/Image.test.js +0 -43
  151. package/dist/ImageSlider/ImageSlider.test.d.ts +0 -5
  152. package/dist/ImageSlider/ImageSlider.test.js +0 -70
  153. package/dist/ImageSlider/ImageSliderControls.test.d.ts +0 -5
  154. package/dist/ImageSlider/ImageSliderControls.test.js +0 -25
  155. package/dist/ImageSlider/ImageSliderItem.test.d.ts +0 -5
  156. package/dist/ImageSlider/ImageSliderItem.test.js +0 -37
  157. package/dist/ImageSlider/ImageSliderScroller.test.d.ts +0 -5
  158. package/dist/ImageSlider/ImageSliderScroller.test.js +0 -37
  159. package/dist/ImageSlider/ImageSliderThumbnails.test.d.ts +0 -5
  160. package/dist/ImageSlider/ImageSliderThumbnails.test.js +0 -52
  161. package/dist/InvalidFormAlert/InvalidFormAlert.test.d.ts +0 -5
  162. package/dist/InvalidFormAlert/InvalidFormAlert.test.js +0 -108
  163. package/dist/Label/Label.test.d.ts +0 -5
  164. package/dist/Label/Label.test.js +0 -82
  165. package/dist/Link/Link.test.d.ts +0 -5
  166. package/dist/Link/Link.test.js +0 -43
  167. package/dist/LinkList/LinkList.test.d.ts +0 -5
  168. package/dist/LinkList/LinkList.test.js +0 -33
  169. package/dist/LinkList/LinkListLink.test.d.ts +0 -5
  170. package/dist/LinkList/LinkListLink.test.js +0 -54
  171. package/dist/Logo/Logo.test.d.ts +0 -5
  172. package/dist/Logo/Logo.test.js +0 -33
  173. package/dist/Mark/Mark.test.d.ts +0 -5
  174. package/dist/Mark/Mark.test.js +0 -33
  175. package/dist/Menu/Menu.test.d.ts +0 -5
  176. package/dist/Menu/Menu.test.js +0 -55
  177. package/dist/Menu/MenuLink.test.d.ts +0 -5
  178. package/dist/Menu/MenuLink.test.js +0 -56
  179. package/dist/OrderedList/OrderedList.test.d.ts +0 -5
  180. package/dist/OrderedList/OrderedList.test.js +0 -55
  181. package/dist/OrderedList/OrderedListItem.test.d.ts +0 -5
  182. package/dist/OrderedList/OrderedListItem.test.js +0 -32
  183. package/dist/Overlap/Overlap.test.d.ts +0 -5
  184. package/dist/Overlap/Overlap.test.js +0 -38
  185. package/dist/Page/Page.test.d.ts +0 -5
  186. package/dist/Page/Page.test.js +0 -33
  187. package/dist/PageFooter/PageFooter.test.d.ts +0 -5
  188. package/dist/PageFooter/PageFooter.test.js +0 -33
  189. package/dist/PageFooter/PageFooterMenu.test.d.ts +0 -5
  190. package/dist/PageFooter/PageFooterMenu.test.js +0 -35
  191. package/dist/PageFooter/PageFooterMenuLink.test.d.ts +0 -5
  192. package/dist/PageFooter/PageFooterMenuLink.test.js +0 -33
  193. package/dist/PageFooter/PageFooterSpotlight.test.d.ts +0 -5
  194. package/dist/PageFooter/PageFooterSpotlight.test.js +0 -33
  195. package/dist/PageHeader/PageHeader.test.d.ts +0 -6
  196. package/dist/PageHeader/PageHeader.test.js +0 -131
  197. package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.test.d.ts +0 -5
  198. package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.test.js +0 -38
  199. package/dist/PageHeader/PageHeaderMenuLink.test.d.ts +0 -5
  200. package/dist/PageHeader/PageHeaderMenuLink.test.js +0 -45
  201. package/dist/PageHeading/PageHeading.test.d.ts +0 -5
  202. package/dist/PageHeading/PageHeading.test.js +0 -40
  203. package/dist/Pagination/Pagination.test.d.ts +0 -5
  204. package/dist/Pagination/Pagination.test.js +0 -137
  205. package/dist/Paragraph/Paragraph.test.d.ts +0 -5
  206. package/dist/Paragraph/Paragraph.test.js +0 -62
  207. package/dist/PasswordInput/PasswordInput.test.d.ts +0 -5
  208. package/dist/PasswordInput/PasswordInput.test.js +0 -89
  209. package/dist/Radio/Radio.test.d.ts +0 -5
  210. package/dist/Radio/Radio.test.js +0 -134
  211. package/dist/Row/Row.test.d.ts +0 -5
  212. package/dist/Row/Row.test.js +0 -64
  213. package/dist/SearchField/SearchField.test.d.ts +0 -5
  214. package/dist/SearchField/SearchField.test.js +0 -33
  215. package/dist/SearchField/SearchFieldButton.test.d.ts +0 -5
  216. package/dist/SearchField/SearchFieldButton.test.js +0 -47
  217. package/dist/SearchField/SearchFieldInput.test.d.ts +0 -5
  218. package/dist/SearchField/SearchFieldInput.test.js +0 -65
  219. package/dist/Select/Select.test.d.ts +0 -5
  220. package/dist/Select/Select.test.js +0 -74
  221. package/dist/Select/SelectOption.test.d.ts +0 -5
  222. package/dist/Select/SelectOption.test.js +0 -45
  223. package/dist/Select/SelectOptionGroup.test.d.ts +0 -5
  224. package/dist/Select/SelectOptionGroup.test.js +0 -45
  225. package/dist/SkipLink/SkipLink.test.d.ts +0 -5
  226. package/dist/SkipLink/SkipLink.test.js +0 -33
  227. package/dist/Spotlight/Spotlight.test.d.ts +0 -5
  228. package/dist/Spotlight/Spotlight.test.js +0 -46
  229. package/dist/StandaloneLink/StandaloneLink.test.d.ts +0 -5
  230. package/dist/StandaloneLink/StandaloneLink.test.js +0 -46
  231. package/dist/Switch/Switch.test.d.ts +0 -5
  232. package/dist/Switch/Switch.test.js +0 -69
  233. package/dist/Table/Table.test.d.ts +0 -5
  234. package/dist/Table/Table.test.js +0 -33
  235. package/dist/Table/TableBody.test.d.ts +0 -5
  236. package/dist/Table/TableBody.test.js +0 -34
  237. package/dist/Table/TableCaption.test.d.ts +0 -5
  238. package/dist/Table/TableCaption.test.js +0 -45
  239. package/dist/Table/TableCell.test.d.ts +0 -5
  240. package/dist/Table/TableCell.test.js +0 -36
  241. package/dist/Table/TableFooter.test.d.ts +0 -5
  242. package/dist/Table/TableFooter.test.js +0 -34
  243. package/dist/Table/TableHeader.test.d.ts +0 -5
  244. package/dist/Table/TableHeader.test.js +0 -34
  245. package/dist/Table/TableHeaderCell.test.d.ts +0 -5
  246. package/dist/Table/TableHeaderCell.test.js +0 -42
  247. package/dist/Table/TableRow.test.d.ts +0 -5
  248. package/dist/Table/TableRow.test.js +0 -35
  249. package/dist/TableOfContents/TableOfContents.test.d.ts +0 -5
  250. package/dist/TableOfContents/TableOfContents.test.js +0 -44
  251. package/dist/TableOfContents/TableOfContentsLink.test.d.ts +0 -5
  252. package/dist/TableOfContents/TableOfContentsLink.test.js +0 -34
  253. package/dist/TableOfContents/TableOfContentsList.test.d.ts +0 -5
  254. package/dist/TableOfContents/TableOfContentsList.test.js +0 -40
  255. package/dist/Tabs/Tabs.test.d.ts +0 -5
  256. package/dist/Tabs/Tabs.test.js +0 -104
  257. package/dist/Tabs/TabsButton.test.d.ts +0 -5
  258. package/dist/Tabs/TabsButton.test.js +0 -57
  259. package/dist/Tabs/TabsList.test.d.ts +0 -5
  260. package/dist/Tabs/TabsList.test.js +0 -32
  261. package/dist/Tabs/TabsPanel.test.d.ts +0 -5
  262. package/dist/Tabs/TabsPanel.test.js +0 -42
  263. package/dist/TextArea/TextArea.test.d.ts +0 -5
  264. package/dist/TextArea/TextArea.test.js +0 -105
  265. package/dist/TextInput/TextInput.test.d.ts +0 -5
  266. package/dist/TextInput/TextInput.test.js +0 -92
  267. package/dist/TimeInput/TimeInput.test.d.ts +0 -5
  268. package/dist/TimeInput/TimeInput.test.js +0 -51
  269. package/dist/UnorderedList/UnorderedList.test.d.ts +0 -5
  270. package/dist/UnorderedList/UnorderedList.test.js +0 -55
  271. package/dist/UnorderedList/UnorderedListItem.test.d.ts +0 -5
  272. package/dist/UnorderedList/UnorderedListItem.test.js +0 -32
  273. package/dist/common/formatFileSize.test.d.ts +0 -5
  274. package/dist/common/formatFileSize.test.js +0 -22
  275. package/dist/common/formatFileType.test.d.ts +0 -5
  276. package/dist/common/formatFileType.test.js +0 -27
  277. package/dist/common/useKeyboardFocus.test.d.ts +0 -5
  278. package/dist/common/useKeyboardFocus.test.js +0 -79
  279. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,65 +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, useState } from 'react';
9
- import { SearchFieldInput } from './SearchFieldInput';
10
- import '@testing-library/jest-dom';
11
- describe('Search field input', () => {
12
- it('renders', () => {
13
- render(_jsx(SearchFieldInput, {}));
14
- const component = screen.getByRole('searchbox', { name: 'Zoeken' });
15
- expect(component).toBeInTheDocument();
16
- expect(component).toBeVisible();
17
- });
18
- it('renders a design system BEM class name', () => {
19
- render(_jsx(SearchFieldInput, {}));
20
- const component = screen.getByRole('searchbox', { name: 'Zoeken' });
21
- expect(component).toHaveClass('ams-search-field__input');
22
- });
23
- it('renders an extra class name', () => {
24
- render(_jsx(SearchFieldInput, { className: "extra" }));
25
- const component = screen.getByRole('searchbox', { name: 'Zoeken' });
26
- expect(component).toHaveClass('ams-search-field__input extra');
27
- });
28
- it('supports a custom label', () => {
29
- render(_jsx(SearchFieldInput, { label: "Test label" }));
30
- const component = screen.getByRole('searchbox', { name: 'Test label' });
31
- expect(component).toBeInTheDocument();
32
- expect(component).toBeVisible();
33
- });
34
- it('should be working in a controlled state', async () => {
35
- function ControlledComponent() {
36
- const [value, setValue] = useState('Hello');
37
- return _jsx(SearchFieldInput, { onChange: (e) => setValue(e.target.value), value: value });
38
- }
39
- render(_jsx(ControlledComponent, {}));
40
- const componentText = screen.getByDisplayValue('Hello');
41
- expect(componentText).toBeInTheDocument();
42
- const component = screen.getByRole('searchbox', { name: 'Zoeken' });
43
- if (component) {
44
- await userEvent.type(component, ', World!');
45
- }
46
- const newComponentText = screen.getByDisplayValue('Hello, World!');
47
- expect(newComponentText).toBeInTheDocument();
48
- });
49
- it('supports ForwardRef in React', () => {
50
- const ref = createRef();
51
- render(_jsx(SearchFieldInput, { ref: ref }));
52
- const component = screen.getByRole('searchbox', { name: 'Zoeken' });
53
- expect(ref.current).toBe(component);
54
- });
55
- it('renders bidirectional by default using `dir="auto"`', () => {
56
- render(_jsx(SearchFieldInput, {}));
57
- const component = screen.getByRole('searchbox', { name: 'Zoeken' });
58
- expect(component).toHaveAttribute('dir', 'auto');
59
- });
60
- it('renders left-to-right by using `dir="ltr"`', () => {
61
- render(_jsx(SearchFieldInput, { dir: "ltr" }));
62
- const component = screen.getByRole('searchbox', { name: 'Zoeken' });
63
- expect(component).toHaveAttribute('dir', 'ltr');
64
- });
65
- });
@@ -1,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -1,74 +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 { Select } from './Select';
9
- import '@testing-library/jest-dom';
10
- describe('Select', () => {
11
- it('renders', () => {
12
- render(_jsx(Select, {}));
13
- const component = screen.getByRole('combobox');
14
- expect(component).toBeInTheDocument();
15
- expect(component).toBeVisible();
16
- });
17
- it('renders a design system BEM class name', () => {
18
- render(_jsx(Select, {}));
19
- const component = screen.getByRole('combobox');
20
- expect(component).toHaveClass('ams-select');
21
- });
22
- it('renders an extra class name', () => {
23
- render(_jsx(Select, { className: "extra" }));
24
- const component = screen.getByRole('combobox');
25
- expect(component).toHaveClass('ams-select extra');
26
- });
27
- it('supports ForwardRef in React', () => {
28
- const ref = createRef();
29
- render(_jsx(Select, { ref: ref }));
30
- const component = screen.getByRole('combobox');
31
- expect(ref.current).toBe(component);
32
- });
33
- it('renders options', () => {
34
- render(_jsxs(Select, { children: [_jsx(Select.Option, { value: "a", children: "Option A" }), _jsx(Select.Option, { value: "b", children: "Option B" })] }));
35
- const select = screen.getByRole('combobox');
36
- const option = screen.getByRole('option', {
37
- name: 'Option B',
38
- });
39
- expect(select).toContain(option);
40
- });
41
- it('can be disabled', () => {
42
- render(_jsx(Select, { disabled: true }));
43
- const component = screen.getByRole('combobox');
44
- expect(component).toBeDisabled();
45
- });
46
- describe('Invalid state', () => {
47
- it('is not invalid by default', () => {
48
- render(_jsx(Select, {}));
49
- const component = screen.getByRole('combobox');
50
- expect(component).not.toBeInvalid();
51
- });
52
- it('can have an invalid state', () => {
53
- render(_jsx(Select, { invalid: true }));
54
- const component = screen.getByRole('combobox');
55
- expect(component).toHaveAttribute('aria-invalid');
56
- expect(component).toBeInvalid();
57
- });
58
- it('omits non-essential invalid attributes when not invalid', () => {
59
- render(_jsx(Select, { invalid: false }));
60
- const component = screen.getByRole('combobox');
61
- expect(component).not.toHaveAttribute('aria-invalid');
62
- });
63
- });
64
- it('is not required by default', () => {
65
- render(_jsx(Select, {}));
66
- const component = screen.getByRole('combobox');
67
- expect(component).not.toBeRequired();
68
- });
69
- it('omits the required attribute when not required', () => {
70
- render(_jsx(Select, { required: false }));
71
- const component = screen.getByRole('combobox');
72
- expect(component).not.toHaveAttribute('required');
73
- });
74
- });
@@ -1,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -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 { Select } from './Select';
9
- import '@testing-library/jest-dom';
10
- describe('Select option', () => {
11
- it('renders', () => {
12
- render(_jsx(Select.Option, {}));
13
- const component = screen.getByRole('option');
14
- expect(component).toBeInTheDocument();
15
- expect(component).toBeVisible();
16
- });
17
- it('renders an option role element with a text label', () => {
18
- render(_jsx(Select.Option, { children: "Option" }));
19
- const option = screen.getByRole('option', {
20
- name: 'Option',
21
- });
22
- expect(option).toBeInTheDocument();
23
- });
24
- it('renders a design system BEM class name', () => {
25
- render(_jsx(Select.Option, {}));
26
- const component = screen.getByRole('option');
27
- expect(component).toHaveClass('ams-select__option');
28
- });
29
- it('renders an extra class name', () => {
30
- render(_jsx(Select.Option, { className: "extra" }));
31
- const component = screen.getByRole('option');
32
- expect(component).toHaveClass('ams-select__option extra');
33
- });
34
- it('supports ForwardRef in React', () => {
35
- const ref = createRef();
36
- render(_jsx(Select.Option, { ref: ref }));
37
- const component = screen.getByRole('option');
38
- expect(ref.current).toBe(component);
39
- });
40
- it('can be disabled', () => {
41
- render(_jsx(Select.Option, { disabled: true }));
42
- const component = screen.getByRole('option');
43
- expect(component).toBeDisabled();
44
- });
45
- });
@@ -1,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -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 { Select } from './Select';
9
- import '@testing-library/jest-dom';
10
- describe('Select option group', () => {
11
- it('renders', () => {
12
- render(_jsx(Select.Group, {}));
13
- const component = screen.getByRole('group');
14
- expect(component).toBeInTheDocument();
15
- expect(component).toBeVisible();
16
- });
17
- it('renders an group role element with a text label', () => {
18
- render(_jsx(Select.Group, { label: "Options" }));
19
- const option = screen.getByRole('group', {
20
- name: 'Options',
21
- });
22
- expect(option).toBeInTheDocument();
23
- });
24
- it('renders a design system BEM class name', () => {
25
- render(_jsx(Select.Group, {}));
26
- const component = screen.getByRole('group');
27
- expect(component).toHaveClass('ams-select__group');
28
- });
29
- it('renders an extra class name', () => {
30
- render(_jsx(Select.Group, { className: "extra" }));
31
- const component = screen.getByRole('group');
32
- expect(component).toHaveClass('ams-select__group extra');
33
- });
34
- it('supports ForwardRef in React', () => {
35
- const ref = createRef();
36
- render(_jsx(Select.Group, { ref: ref }));
37
- const component = screen.getByRole('group');
38
- expect(ref.current).toBe(component);
39
- });
40
- it('can be disabled', () => {
41
- render(_jsx(Select.Group, { disabled: true }));
42
- const component = screen.getByRole('group');
43
- expect(component).toBeDisabled();
44
- });
45
- });
@@ -1,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -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 { SkipLink } from './SkipLink';
9
- import '@testing-library/jest-dom';
10
- describe('Skip link', () => {
11
- it('renders', () => {
12
- render(_jsx(SkipLink, { 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(SkipLink, { href: "/" }));
19
- const component = screen.getByRole('link');
20
- expect(component).toHaveClass('ams-skip-link');
21
- });
22
- it('renders an extra class name', () => {
23
- render(_jsx(SkipLink, { className: "extra", href: "/" }));
24
- const component = screen.getByRole('link');
25
- expect(component).toHaveClass('ams-skip-link extra');
26
- });
27
- it('supports ForwardRef in React', () => {
28
- const ref = createRef();
29
- render(_jsx(SkipLink, { href: "/", ref: ref }));
30
- const component = screen.getByRole('link');
31
- expect(ref.current).toBe(component);
32
- });
33
- });
@@ -1,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -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 { ariaRoleForTag } from '../common/accessibility';
9
- import { Spotlight, spotlightColors, spotlightTags } from './Spotlight';
10
- import '@testing-library/jest-dom';
11
- describe('Spotlight', () => {
12
- it('renders', () => {
13
- const { container } = render(_jsx(Spotlight, {}));
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(Spotlight, {}));
20
- const component = container.querySelector(':only-child');
21
- expect(component).toHaveClass('ams-spotlight');
22
- });
23
- it('renders an extra class name', () => {
24
- const { container } = render(_jsx(Spotlight, { className: "extra" }));
25
- const component = container.querySelector(':only-child');
26
- expect(component).toHaveClass('ams-spotlight extra');
27
- });
28
- spotlightTags.forEach((tag) => {
29
- it(`renders with a custom ${tag} tag`, () => {
30
- const { container } = render(_jsx(Spotlight, { "aria-label": tag === 'section' ? 'Accessible name' : undefined, as: tag }));
31
- const component = tag === 'div' ? container.querySelector(tag) : screen.getByRole(ariaRoleForTag[tag]);
32
- expect(component).toBeInTheDocument();
33
- });
34
- });
35
- it('supports ForwardRef in React', () => {
36
- const ref = createRef();
37
- const { container } = render(_jsx(Spotlight, { ref: ref }));
38
- const component = container.querySelector(':only-child');
39
- expect(ref.current).toBe(component);
40
- });
41
- spotlightColors.map((color) => it(`renders with ${color} color`, () => {
42
- const { container } = render(_jsx(Spotlight, { color: color }));
43
- const component = container.querySelector(':only-child');
44
- expect(component).toHaveClass(`ams-spotlight--${color}`);
45
- }));
46
- });
@@ -1,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -1,46 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { render, screen } from '@testing-library/react';
3
- import { createRef } from 'react';
4
- import { StandaloneLink } from './StandaloneLink';
5
- import '@testing-library/jest-dom';
6
- const TestIcon = (props) => _jsx("svg", { ...props, className: "test-class" });
7
- describe('Standalone Link', () => {
8
- it('renders with href attribute', () => {
9
- render(_jsx(StandaloneLink, { href: "#" }));
10
- const component = screen.getByRole('link');
11
- expect(component).toBeInTheDocument();
12
- expect(component).toBeVisible();
13
- expect(component).toHaveAttribute('href', '#');
14
- });
15
- it('renders a design system BEM class name', () => {
16
- render(_jsx(StandaloneLink, { href: "#" }));
17
- const component = screen.getByRole('link');
18
- expect(component).toHaveClass('ams-standalone-link');
19
- });
20
- it('renders an extra class name', () => {
21
- render(_jsx(StandaloneLink, { className: "extra", href: "#" }));
22
- const component = screen.getByRole('link');
23
- expect(component).toHaveClass('ams-standalone-link extra');
24
- });
25
- it('renders a custom icon', () => {
26
- const { container } = render(_jsx(StandaloneLink, { icon: TestIcon }));
27
- const icon = container.querySelector('svg');
28
- expect(icon).toHaveClass('test-class');
29
- });
30
- it('renders the class name for contrast color', () => {
31
- render(_jsx(StandaloneLink, { color: "contrast", href: "#" }));
32
- const component = screen.getByRole('link');
33
- expect(component).toHaveClass('ams-standalone-link ams-standalone-link--contrast');
34
- });
35
- it('renders the class name for inverse color', () => {
36
- render(_jsx(StandaloneLink, { color: "inverse", href: "#" }));
37
- const component = screen.getByRole('link');
38
- expect(component).toHaveClass('ams-standalone-link ams-standalone-link--inverse');
39
- });
40
- it('supports ForwardRef in React', () => {
41
- const ref = createRef();
42
- render(_jsx(StandaloneLink, { href: "#", ref: ref }));
43
- const component = screen.getByRole('link');
44
- expect(ref.current).toBe(component);
45
- });
46
- });
@@ -1,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -1,69 +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 { render, screen } from '@testing-library/react';
7
- import { createRef } from 'react';
8
- import { Switch } from './Switch';
9
- import '@testing-library/jest-dom';
10
- describe('Switch', () => {
11
- it('renders an element with role switch', () => {
12
- render(_jsx(Switch, {}));
13
- const switchElement = screen.getByRole('switch');
14
- expect(switchElement).toBeInTheDocument();
15
- expect(switchElement).not.toBeChecked();
16
- });
17
- it('is not disabled by default', () => {
18
- render(_jsx(Switch, {}));
19
- const switchElement = screen.getByRole('switch');
20
- expect(switchElement).not.toBeDisabled();
21
- });
22
- it('can trigger a change event', () => {
23
- const handleChange = jest.fn();
24
- render(_jsx(Switch, { onChange: handleChange }));
25
- const switchElement = screen.getByRole('switch');
26
- switchElement.click();
27
- expect(handleChange).toHaveBeenCalled();
28
- });
29
- it('does not trigger a change event when disabled', () => {
30
- const handleChange = jest.fn();
31
- render(_jsx(Switch, { disabled: true, onChange: handleChange }));
32
- const switchElement = screen.getByRole('switch');
33
- switchElement.click();
34
- expect(handleChange).not.toHaveBeenCalled();
35
- });
36
- it('does trigger a change event when clicking on associate label', () => {
37
- const handleChange = jest.fn();
38
- const MockImpl = () => {
39
- return (_jsxs(_Fragment, { children: [_jsx("label", { "data-testid": "switch-label", htmlFor: "switch-label", children: "Label" }), _jsx(Switch, { id: "switch-label", onChange: handleChange })] }));
40
- };
41
- render(_jsx(MockImpl, {}));
42
- const label = screen.getByTestId('switch-label');
43
- label.click();
44
- expect(handleChange).toHaveBeenCalled();
45
- });
46
- it('sets the checked state when switch is clicked', () => {
47
- render(_jsx(Switch, {}));
48
- const switchElement = screen.getByRole('switch');
49
- expect(switchElement).not.toBeChecked();
50
- switchElement.click();
51
- expect(switchElement).toBeChecked();
52
- });
53
- it('renders a design system BEM class name', () => {
54
- const { container } = render(_jsx(Switch, {}));
55
- const component = container.querySelector(':only-child');
56
- expect(component).toHaveClass('ams-switch');
57
- });
58
- it('renders an extra class name', () => {
59
- const { container } = render(_jsx(Switch, { className: "extra" }));
60
- const component = container.querySelector(':only-child');
61
- expect(component).toHaveClass('ams-switch extra');
62
- });
63
- it('is able to pass a React ref', () => {
64
- const ref = createRef();
65
- render(_jsx(Switch, { ref: ref }));
66
- const switchElement = screen.getByRole('switch');
67
- expect(ref.current).toBe(switchElement);
68
- });
69
- });
@@ -1,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -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 { Table } from './Table';
9
- import '@testing-library/jest-dom';
10
- describe('Table', () => {
11
- it('renders', () => {
12
- render(_jsx(Table, {}));
13
- const component = screen.getByRole('table');
14
- expect(component).toBeInTheDocument();
15
- expect(component).toBeVisible();
16
- });
17
- it('renders a design system BEM class name', () => {
18
- render(_jsx(Table, {}));
19
- const component = screen.getByRole('table');
20
- expect(component).toHaveClass('ams-table__table');
21
- });
22
- it('renders an extra class name', () => {
23
- render(_jsx(Table, { className: "extra" }));
24
- const component = screen.getByRole('table');
25
- expect(component).toHaveClass('ams-table__table extra');
26
- });
27
- it('supports ForwardRef in React', () => {
28
- const ref = createRef();
29
- render(_jsx(Table, { ref: ref }));
30
- const component = screen.getByRole('table');
31
- expect(ref.current).toBe(component);
32
- });
33
- });
@@ -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 { TableBody } from './TableBody';
10
- import '@testing-library/jest-dom';
11
- describe('Table body', () => {
12
- it('renders', () => {
13
- render(_jsx(Table, { children: _jsx(TableBody, {}) }));
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(TableBody, {}) }));
20
- const component = screen.getByRole('rowgroup');
21
- expect(component).toHaveClass('ams-table__body');
22
- });
23
- it('renders an extra class name', () => {
24
- render(_jsx(Table, { children: _jsx(TableBody, { className: "extra" }) }));
25
- const component = screen.getByRole('rowgroup');
26
- expect(component).toHaveClass('ams-table__body extra');
27
- });
28
- it('supports ForwardRef in React', () => {
29
- const ref = createRef();
30
- render(_jsx(Table, { children: _jsx(TableBody, { 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,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 { Table } from './Table';
9
- import { TableCaption } from './TableCaption';
10
- import '@testing-library/jest-dom';
11
- describe('Table caption', () => {
12
- it('renders', () => {
13
- render(_jsx(Table, { children: _jsx(TableCaption, { children: "Caption" }) }));
14
- const component = screen.getByRole('table', {
15
- name: 'Caption',
16
- });
17
- expect(component).toBeInTheDocument();
18
- expect(component).toBeVisible();
19
- });
20
- it('renders a design system BEM class name', () => {
21
- render(_jsx(Table, { children: _jsx(TableCaption, { children: "Caption" }) }));
22
- const component = screen.getByRole('table', {
23
- name: 'Caption',
24
- });
25
- const caption = component?.querySelector(':only-child');
26
- expect(caption).toHaveClass('ams-table__caption');
27
- });
28
- it('renders an extra class name', () => {
29
- render(_jsx(Table, { children: _jsx(TableCaption, { className: "extra", children: "Caption" }) }));
30
- const component = screen.getByRole('table', {
31
- name: 'Caption',
32
- });
33
- const caption = component?.querySelector(':only-child');
34
- expect(caption).toHaveClass('ams-table__caption extra');
35
- });
36
- it('supports ForwardRef in React', () => {
37
- const ref = createRef();
38
- render(_jsx(Table, { children: _jsx(TableCaption, { ref: ref, children: "Caption" }) }));
39
- const component = screen.getByRole('table', {
40
- name: 'Caption',
41
- });
42
- const caption = component?.querySelector(':only-child');
43
- expect(ref.current).toBe(caption);
44
- });
45
- });
@@ -1,5 +0,0 @@
1
- /**
2
- * @license EUPL-1.2+
3
- * Copyright Gemeente Amsterdam
4
- */
5
- import '@testing-library/jest-dom';
@@ -1,36 +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 { TableCell } from './TableCell';
11
- import { TableRow } from './TableRow';
12
- import '@testing-library/jest-dom';
13
- describe('Table cell', () => {
14
- it('renders', () => {
15
- render(_jsx(Table, { children: _jsx(TableBody, { children: _jsx(TableRow, { children: _jsx(TableCell, { children: "Data" }) }) }) }));
16
- const component = screen.getByRole('cell');
17
- expect(component).toBeInTheDocument();
18
- expect(component).toBeVisible();
19
- });
20
- it('renders a design system BEM class name', () => {
21
- render(_jsx(Table, { children: _jsx(TableBody, { children: _jsx(TableRow, { children: _jsx(TableCell, { children: "Data" }) }) }) }));
22
- const component = screen.getByRole('cell');
23
- expect(component).toHaveClass('ams-table__cell');
24
- });
25
- it('renders an extra class name', () => {
26
- render(_jsx(Table, { children: _jsx(TableBody, { children: _jsx(TableRow, { children: _jsx(TableCell, { className: "extra", children: "Data" }) }) }) }));
27
- const component = screen.getByRole('cell');
28
- expect(component).toHaveClass('ams-table__cell extra');
29
- });
30
- it('supports ForwardRef in React', () => {
31
- const ref = createRef();
32
- render(_jsx(Table, { children: _jsx(TableBody, { children: _jsx(TableRow, { children: _jsx(TableCell, { ref: ref, children: "Data" }) }) }) }));
33
- const component = screen.getByRole('cell');
34
- expect(ref.current).toBe(component);
35
- });
36
- });