@patternfly/react-core 5.2.0-prerelease.29 → 5.2.0-prerelease.30

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 (202) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/components/package.json +1 -1
  3. package/deprecated/package.json +1 -1
  4. package/dist/dynamic/components/AboutModal/package.json +1 -1
  5. package/dist/dynamic/components/Accordion/package.json +1 -1
  6. package/dist/dynamic/components/ActionList/package.json +1 -1
  7. package/dist/dynamic/components/Alert/package.json +1 -1
  8. package/dist/dynamic/components/Avatar/package.json +1 -1
  9. package/dist/dynamic/components/BackToTop/package.json +1 -1
  10. package/dist/dynamic/components/Backdrop/package.json +1 -1
  11. package/dist/dynamic/components/BackgroundImage/package.json +1 -1
  12. package/dist/dynamic/components/Badge/package.json +1 -1
  13. package/dist/dynamic/components/Banner/package.json +1 -1
  14. package/dist/dynamic/components/Brand/package.json +1 -1
  15. package/dist/dynamic/components/Breadcrumb/package.json +1 -1
  16. package/dist/dynamic/components/Button/package.json +1 -1
  17. package/dist/dynamic/components/CalendarMonth/package.json +1 -1
  18. package/dist/dynamic/components/Card/package.json +1 -1
  19. package/dist/dynamic/components/Checkbox/package.json +1 -1
  20. package/dist/dynamic/components/Chip/package.json +1 -1
  21. package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
  22. package/dist/dynamic/components/CodeBlock/package.json +1 -1
  23. package/dist/dynamic/components/DataList/package.json +1 -1
  24. package/dist/dynamic/components/DatePicker/package.json +1 -1
  25. package/dist/dynamic/components/DescriptionList/package.json +1 -1
  26. package/dist/dynamic/components/Divider/package.json +1 -1
  27. package/dist/dynamic/components/DragDrop/package.json +1 -1
  28. package/dist/dynamic/components/Drawer/package.json +1 -1
  29. package/dist/dynamic/components/Dropdown/package.json +1 -1
  30. package/dist/dynamic/components/DualListSelector/package.json +1 -1
  31. package/dist/dynamic/components/EmptyState/package.json +1 -1
  32. package/dist/dynamic/components/ExpandableSection/package.json +1 -1
  33. package/dist/dynamic/components/FileUpload/package.json +1 -1
  34. package/dist/dynamic/components/Form/package.json +1 -1
  35. package/dist/dynamic/components/FormSelect/package.json +1 -1
  36. package/dist/dynamic/components/HelperText/package.json +1 -1
  37. package/dist/dynamic/components/Hint/package.json +1 -1
  38. package/dist/dynamic/components/Icon/package.json +1 -1
  39. package/dist/dynamic/components/InputGroup/package.json +1 -1
  40. package/dist/dynamic/components/JumpLinks/package.json +1 -1
  41. package/dist/dynamic/components/Label/package.json +1 -1
  42. package/dist/dynamic/components/List/package.json +1 -1
  43. package/dist/dynamic/components/LoginPage/package.json +1 -1
  44. package/dist/dynamic/components/Masthead/package.json +1 -1
  45. package/dist/dynamic/components/Menu/package.json +1 -1
  46. package/dist/dynamic/components/MenuToggle/package.json +1 -1
  47. package/dist/dynamic/components/Modal/package.json +1 -1
  48. package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
  49. package/dist/dynamic/components/Nav/package.json +1 -1
  50. package/dist/dynamic/components/NotificationBadge/package.json +1 -1
  51. package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
  52. package/dist/dynamic/components/NumberInput/package.json +1 -1
  53. package/dist/dynamic/components/OverflowMenu/package.json +1 -1
  54. package/dist/dynamic/components/Page/package.json +1 -1
  55. package/dist/dynamic/components/Pagination/package.json +1 -1
  56. package/dist/dynamic/components/Panel/package.json +1 -1
  57. package/dist/dynamic/components/Popover/package.json +1 -1
  58. package/dist/dynamic/components/Progress/package.json +1 -1
  59. package/dist/dynamic/components/ProgressStepper/package.json +1 -1
  60. package/dist/dynamic/components/Radio/package.json +1 -1
  61. package/dist/dynamic/components/SearchInput/package.json +1 -1
  62. package/dist/dynamic/components/Select/package.json +1 -1
  63. package/dist/dynamic/components/Sidebar/package.json +1 -1
  64. package/dist/dynamic/components/SimpleList/package.json +1 -1
  65. package/dist/dynamic/components/Skeleton/package.json +1 -1
  66. package/dist/dynamic/components/SkipToContent/package.json +1 -1
  67. package/dist/dynamic/components/Slider/package.json +1 -1
  68. package/dist/dynamic/components/Spinner/package.json +1 -1
  69. package/dist/dynamic/components/Switch/package.json +1 -1
  70. package/dist/dynamic/components/Tabs/package.json +1 -1
  71. package/dist/dynamic/components/Text/package.json +1 -1
  72. package/dist/dynamic/components/TextArea/package.json +1 -1
  73. package/dist/dynamic/components/TextInput/package.json +1 -1
  74. package/dist/dynamic/components/TextInputGroup/package.json +1 -1
  75. package/dist/dynamic/components/Tile/package.json +1 -1
  76. package/dist/dynamic/components/TimePicker/package.json +1 -1
  77. package/dist/dynamic/components/Timestamp/package.json +1 -1
  78. package/dist/dynamic/components/Title/package.json +1 -1
  79. package/dist/dynamic/components/ToggleGroup/package.json +1 -1
  80. package/dist/dynamic/components/Toolbar/package.json +1 -1
  81. package/dist/dynamic/components/Tooltip/package.json +1 -1
  82. package/dist/dynamic/components/TreeView/package.json +1 -1
  83. package/dist/dynamic/components/Truncate/package.json +1 -1
  84. package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
  85. package/dist/dynamic/components/Wizard/package.json +1 -1
  86. package/dist/dynamic/deprecated/components/ApplicationLauncher/package.json +1 -1
  87. package/dist/dynamic/deprecated/components/ContextSelector/package.json +1 -1
  88. package/dist/dynamic/deprecated/components/Dropdown/package.json +1 -1
  89. package/dist/dynamic/deprecated/components/OptionsMenu/package.json +1 -1
  90. package/dist/dynamic/deprecated/components/PageHeader/package.json +1 -1
  91. package/dist/dynamic/deprecated/components/Select/package.json +1 -1
  92. package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
  93. package/dist/dynamic/deprecated/components/package.json +1 -1
  94. package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
  95. package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
  96. package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
  97. package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
  98. package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
  99. package/dist/dynamic/helpers/constants/package.json +1 -1
  100. package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
  101. package/dist/dynamic/helpers/favorites/package.json +1 -1
  102. package/dist/dynamic/helpers/fileUtils/package.json +1 -1
  103. package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
  104. package/dist/dynamic/helpers/package.json +1 -1
  105. package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
  106. package/dist/dynamic/helpers/typeUtils/package.json +1 -1
  107. package/dist/dynamic/helpers/useInterval/package.json +1 -1
  108. package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
  109. package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
  110. package/dist/dynamic/helpers/util/package.json +1 -1
  111. package/dist/dynamic/layouts/Bullseye/package.json +1 -1
  112. package/dist/dynamic/layouts/Flex/package.json +1 -1
  113. package/dist/dynamic/layouts/Gallery/package.json +1 -1
  114. package/dist/dynamic/layouts/Grid/package.json +1 -1
  115. package/dist/dynamic/layouts/Level/package.json +1 -1
  116. package/dist/dynamic/layouts/Split/package.json +1 -1
  117. package/dist/dynamic/layouts/Stack/package.json +1 -1
  118. package/dist/dynamic/next/components/package.json +1 -1
  119. package/dist/esm/components/Chip/Chip.d.ts +1 -0
  120. package/dist/esm/components/Chip/Chip.d.ts.map +1 -1
  121. package/dist/esm/components/Chip/Chip.js +8 -0
  122. package/dist/esm/components/Chip/Chip.js.map +1 -1
  123. package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts +5 -5
  124. package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
  125. package/dist/esm/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
  126. package/dist/esm/components/ClipboardCopy/ClipboardCopyExpanded.d.ts +0 -1
  127. package/dist/esm/components/ClipboardCopy/ClipboardCopyExpanded.d.ts.map +1 -1
  128. package/dist/esm/components/ClipboardCopy/ClipboardCopyExpanded.js.map +1 -1
  129. package/dist/esm/components/DataList/DataList.d.ts.map +1 -1
  130. package/dist/esm/components/DataList/DataList.js +2 -2
  131. package/dist/esm/components/DataList/DataList.js.map +1 -1
  132. package/dist/esm/components/DataList/DataListAction.js +3 -3
  133. package/dist/esm/components/DataList/DataListAction.js.map +1 -1
  134. package/dist/esm/components/DatePicker/DatePicker.js +1 -1
  135. package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
  136. package/dist/js/components/Chip/Chip.d.ts +1 -0
  137. package/dist/js/components/Chip/Chip.d.ts.map +1 -1
  138. package/dist/js/components/Chip/Chip.js +8 -0
  139. package/dist/js/components/Chip/Chip.js.map +1 -1
  140. package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts +5 -5
  141. package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
  142. package/dist/js/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
  143. package/dist/js/components/ClipboardCopy/ClipboardCopyExpanded.d.ts +0 -1
  144. package/dist/js/components/ClipboardCopy/ClipboardCopyExpanded.d.ts.map +1 -1
  145. package/dist/js/components/ClipboardCopy/ClipboardCopyExpanded.js.map +1 -1
  146. package/dist/js/components/DataList/DataList.d.ts.map +1 -1
  147. package/dist/js/components/DataList/DataList.js +2 -2
  148. package/dist/js/components/DataList/DataList.js.map +1 -1
  149. package/dist/js/components/DataList/DataListAction.js +3 -3
  150. package/dist/js/components/DataList/DataListAction.js.map +1 -1
  151. package/dist/js/components/DatePicker/DatePicker.js +1 -1
  152. package/dist/js/components/DatePicker/DatePicker.js.map +1 -1
  153. package/dist/umd/react-core.min.js +1 -1
  154. package/helpers/package.json +1 -1
  155. package/layouts/package.json +1 -1
  156. package/next/package.json +1 -1
  157. package/package.json +2 -2
  158. package/src/components/Chip/Chip.tsx +11 -0
  159. package/src/components/ClipboardCopy/ClipboardCopy.tsx +5 -5
  160. package/src/components/ClipboardCopy/ClipboardCopyExpanded.tsx +0 -1
  161. package/src/components/DataList/DataList.tsx +2 -0
  162. package/src/components/DataList/DataListAction.tsx +1 -1
  163. package/src/components/DataList/__tests__/DataList.test.tsx +140 -304
  164. package/src/components/DataList/__tests__/DataListAction.test.tsx +75 -0
  165. package/src/components/DataList/__tests__/DataListCell.test.tsx +120 -0
  166. package/src/components/DataList/__tests__/DataListCheck.test.tsx +5 -0
  167. package/src/components/DataList/__tests__/DataListContent.test.tsx +73 -0
  168. package/src/components/DataList/__tests__/DataListItem.test.tsx +46 -0
  169. package/src/components/DataList/__tests__/DataListItemCells.test.tsx +25 -0
  170. package/src/components/DataList/__tests__/DataListItemRow.test.tsx +44 -0
  171. package/src/components/DataList/__tests__/DataListToggle.test.tsx +61 -0
  172. package/src/components/DataList/__tests__/__snapshots__/DataList.test.tsx.snap +2 -323
  173. package/src/components/DataList/__tests__/__snapshots__/DataListAction.test.tsx.snap +11 -0
  174. package/src/components/DataList/__tests__/__snapshots__/DataListCell.test.tsx.snap +11 -0
  175. package/src/components/DataList/__tests__/__snapshots__/DataListContent.test.tsx.snap +17 -0
  176. package/src/components/DataList/__tests__/__snapshots__/DataListItem.test.tsx.snap +11 -0
  177. package/src/components/DataList/__tests__/__snapshots__/DataListItemCells.test.tsx.snap +9 -0
  178. package/src/components/DataList/__tests__/__snapshots__/DataListItemRow.test.tsx.snap +9 -0
  179. package/src/components/DataList/__tests__/__snapshots__/DataListToggle.test.tsx.snap +45 -0
  180. package/src/components/DataList/examples/DataListCheckboxes.tsx +5 -5
  181. package/src/components/DataList/examples/DataListMixedExpandable.tsx +1 -1
  182. package/src/components/DatePicker/DatePicker.tsx +1 -1
  183. package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.test.tsx.snap +2 -2
  184. package/src/components/DescriptionList/__tests__/DescriptionList.test.tsx +128 -102
  185. package/src/components/DescriptionList/__tests__/DescriptionListDescription.test.tsx +25 -0
  186. package/src/components/DescriptionList/__tests__/DescriptionListGroup.test.tsx +25 -0
  187. package/src/components/DescriptionList/__tests__/DescriptionListHelpTextButton.test.tsx +27 -0
  188. package/src/components/DescriptionList/__tests__/DescriptionListTerm.test.tsx +35 -0
  189. package/src/components/DescriptionList/__tests__/DescriptionListTermHelpText.test.tsx +25 -0
  190. package/src/components/DescriptionList/__tests__/__snapshots__/DescriptionList.test.tsx.snap +1 -157
  191. package/src/components/DescriptionList/__tests__/__snapshots__/DescriptionListDescription.test.tsx.snap +15 -0
  192. package/src/components/DescriptionList/__tests__/__snapshots__/DescriptionListGroup.test.tsx.snap +11 -0
  193. package/src/components/DescriptionList/__tests__/__snapshots__/DescriptionListHelpTextButton.test.tsx.snap +14 -0
  194. package/src/components/DescriptionList/__tests__/__snapshots__/DescriptionListTerm.test.tsx.snap +15 -0
  195. package/src/components/DescriptionList/__tests__/__snapshots__/DescriptionListTermHelpText.test.tsx.snap +11 -0
  196. package/src/components/HelperText/__tests__/HelperText.test.tsx +67 -57
  197. package/src/components/HelperText/__tests__/HelperTextItem.test.tsx +93 -0
  198. package/src/components/HelperText/__tests__/__snapshots__/HelperText.test.tsx.snap +2 -223
  199. package/src/components/HelperText/__tests__/__snapshots__/HelperTextItem.test.tsx.snap +15 -0
  200. package/src/demos/CustomMenus/CustomMenus.md +6 -0
  201. package/src/demos/CustomMenus/examples/InlineSearchFilterMenuDemo.tsx +102 -0
  202. package/src/demos/SearchInput/SearchInput.md +1 -1
@@ -1,130 +1,156 @@
1
1
  import React from 'react';
2
- import { render } from '@testing-library/react';
2
+ import { render, screen } from '@testing-library/react';
3
3
  import { DescriptionList } from '../DescriptionList';
4
- import { DescriptionListGroup } from '../DescriptionListGroup';
5
- import { DescriptionListTerm } from '../DescriptionListTerm';
6
- import { DescriptionListDescription } from '../DescriptionListDescription';
7
- import { DescriptionListTermHelpText } from '../DescriptionListTermHelpText';
8
- import { DescriptionListTermHelpTextButton } from '../DescriptionListTermHelpTextButton';
9
-
10
- describe('Description List', () => {
11
- test('default', () => {
12
- const { asFragment } = render(<DescriptionList />);
13
- expect(asFragment()).toMatchSnapshot();
14
- });
15
4
 
16
- test('1 col on all breakpoints', () => {
17
- const { asFragment } = render(
18
- <DescriptionList columnModifier={{ default: '1Col', md: '1Col', lg: '1Col', xl: '1Col', '2xl': '1Col' }} />
19
- );
20
- expect(asFragment()).toMatchSnapshot();
21
- });
5
+ import styles from '@patternfly/react-styles/css/components/DescriptionList/description-list';
22
6
 
23
- test('2 col on all breakpoints', () => {
24
- const { asFragment } = render(
25
- <DescriptionList columnModifier={{ default: '2Col', md: '2Col', lg: '2Col', xl: '2Col', '2xl': '2Col' }} />
26
- );
27
- expect(asFragment()).toMatchSnapshot();
28
- });
7
+ test('Renders to match snapshot', () => {
8
+ const { asFragment } = render(<DescriptionList />);
9
+ expect(asFragment()).toMatchSnapshot();
10
+ });
29
11
 
30
- test('3 col on all breakpoints', () => {
31
- const { asFragment } = render(
32
- <DescriptionList columnModifier={{ default: '3Col', md: '3Col', lg: '3Col', xl: '3Col', '2xl': '3Col' }} />
33
- );
34
- expect(asFragment()).toMatchSnapshot();
35
- });
12
+ test(`Renders default class ${styles.descriptionList}`, () => {
13
+ render(<DescriptionList aria-label="list" />);
14
+ expect(screen.getByLabelText('list')).toHaveClass(styles.descriptionList, { exact: true });
15
+ });
36
16
 
37
- test('Horizontal Description List', () => {
38
- const { asFragment } = render(<DescriptionList isHorizontal />);
39
- expect(asFragment()).toMatchSnapshot();
40
- });
17
+ test('Renders custom className', () => {
18
+ render(<DescriptionList aria-label="list" className="custom" />);
19
+ expect(screen.getByLabelText('list')).toHaveClass('custom');
20
+ });
41
21
 
42
- test('Compact Description List', () => {
43
- const { asFragment } = render(<DescriptionList isCompact />);
44
- expect(asFragment()).toMatchSnapshot();
22
+ Object.values(['1Col', '2Col', '3Col']).forEach((_col) => {
23
+ const col = _col as '1Col' | '2Col' | '3Col';
24
+ test(`Renders ${col} on all breakpoints`, () => {
25
+ render(
26
+ <DescriptionList
27
+ aria-label="list"
28
+ columnModifier={{ default: col, sm: col, md: col, lg: col, xl: col, '2xl': col }}
29
+ />
30
+ );
31
+ expect(screen.getByLabelText('list')).toHaveClass(
32
+ styles.modifiers[col],
33
+ styles.modifiers[`${col}OnSm`],
34
+ styles.modifiers[`${col}OnMd`],
35
+ styles.modifiers[`${col}OnLg`],
36
+ styles.modifiers[`${col}OnXl`],
37
+ styles.modifiers[`${col}On_2xl`]
38
+ );
45
39
  });
40
+ });
46
41
 
47
- test('Compact Horizontal Description List', () => {
48
- const { asFragment } = render(<DescriptionList isCompact isHorizontal />);
49
- expect(asFragment()).toMatchSnapshot();
50
- });
42
+ test(`Renders ${styles.modifiers.horizontal} when isHorizontal = true`, () => {
43
+ render(<DescriptionList aria-label="list" isHorizontal />);
44
+ expect(screen.getByLabelText('list')).toHaveClass(styles.modifiers.horizontal);
45
+ });
51
46
 
52
- test('Fluid Horizontal Description List', () => {
53
- const { asFragment } = render(<DescriptionList isFluid isHorizontal />);
54
- expect(asFragment()).toMatchSnapshot();
55
- });
47
+ test(`Renders ${styles.modifiers.compact} when isCompact = true`, () => {
48
+ render(<DescriptionList aria-label="list" isCompact />);
49
+ expect(screen.getByLabelText('list')).toHaveClass(styles.modifiers.compact);
50
+ });
51
+
52
+ test(`Renders ${styles.modifiers.horizontal} and ${styles.modifiers.fluid} when isFluid = true`, () => {
53
+ render(<DescriptionList aria-label="list" isFluid />);
54
+ expect(screen.getByLabelText('list')).toHaveClass(styles.modifiers.fluid, styles.modifiers.horizontal);
55
+ });
56
56
 
57
- test('alignment breakpoints', () => {
58
- const { asFragment } = render(
57
+ Object.values(['horizontal', 'vertical']).forEach((_align) => {
58
+ const align = _align as 'horizontal' | 'vertical';
59
+ test(`Renders ${align} on all breakpoints`, () => {
60
+ render(
59
61
  <DescriptionList
60
- isHorizontal
62
+ aria-label="list"
61
63
  orientation={{
62
- sm: 'horizontal',
63
- md: 'vertical',
64
- lg: 'horizontal',
65
- xl: 'vertical',
66
- '2xl': 'horizontal'
64
+ sm: align,
65
+ md: align,
66
+ lg: align,
67
+ xl: align,
68
+ '2xl': align
67
69
  }}
68
70
  />
69
71
  );
70
- expect(asFragment()).toMatchSnapshot();
72
+ expect(screen.getByLabelText('list')).toHaveClass(
73
+ styles.modifiers[`${align}OnSm`],
74
+ styles.modifiers[`${align}OnMd`],
75
+ styles.modifiers[`${align}OnLg`],
76
+ styles.modifiers[`${align}OnXl`],
77
+ styles.modifiers[`${align}On_2xl`]
78
+ );
71
79
  });
80
+ });
72
81
 
73
- test('Auto Column Widths Description List', () => {
74
- const { asFragment } = render(<DescriptionList isAutoColumnWidths />);
75
- expect(asFragment()).toMatchSnapshot();
76
- });
82
+ test(`Renders ${styles.modifiers.autoColumnWidths} when isAutoColumnWidths = true`, () => {
83
+ render(<DescriptionList aria-label="list" isAutoColumnWidths />);
84
+ expect(screen.getByLabelText('list')).toHaveClass(styles.modifiers.autoColumnWidths);
85
+ });
77
86
 
78
- test('Inline Grid Description List', () => {
79
- const { asFragment } = render(<DescriptionList isInlineGrid />);
80
- expect(asFragment()).toMatchSnapshot();
81
- });
87
+ test(`Renders ${styles.modifiers.inlineGrid} when isInlineGrid = true`, () => {
88
+ render(<DescriptionList aria-label="list" isInlineGrid />);
89
+ expect(screen.getByLabelText('list')).toHaveClass(styles.modifiers.inlineGrid);
90
+ });
82
91
 
83
- test('Auto fit Description List', () => {
84
- const { asFragment } = render(<DescriptionList isAutoFit />);
85
- expect(asFragment()).toMatchSnapshot();
86
- });
92
+ test(`Renders ${styles.modifiers.autoFit} when isAutoFit = true`, () => {
93
+ render(<DescriptionList aria-label="list" isAutoFit />);
94
+ expect(screen.getByLabelText('list')).toHaveClass(styles.modifiers.autoFit);
95
+ });
87
96
 
88
- test('Auto fit with responsive grid Description List', () => {
89
- const { asFragment } = render(
90
- <DescriptionList isAutoFit autoFitMinModifier={{ md: '100px', lg: '150px', xl: '200px', '2xl': '300px' }} />
91
- );
92
- expect(asFragment()).toMatchSnapshot();
93
- });
97
+ test(`Renders ${styles.modifiers.fillColumns} when isFillColumns = true`, () => {
98
+ render(<DescriptionList aria-label="list" isFillColumns />);
99
+ expect(screen.getByLabelText('list')).toHaveClass(styles.modifiers.fillColumns);
100
+ });
94
101
 
95
- test('Term default', () => {
96
- const { asFragment } = render(
97
- <DescriptionListTerm key="term-id-1" aria-labelledby="term-1">
98
- test
99
- </DescriptionListTerm>
100
- );
101
- expect(asFragment()).toMatchSnapshot();
102
- });
102
+ test(`Renders ${styles.modifiers.displayLg} when displaySize = lg`, () => {
103
+ render(<DescriptionList aria-label="list" displaySize="lg" />);
104
+ expect(screen.getByLabelText('list')).toHaveClass(styles.modifiers.displayLg);
105
+ });
103
106
 
104
- test('Term helper text', () => {
105
- const { asFragment } = render(
106
- <DescriptionListTermHelpText key="term-id-1" aria-labelledby="term-1">
107
- <DescriptionListTermHelpTextButton>test</DescriptionListTermHelpTextButton>
108
- </DescriptionListTermHelpText>
109
- );
110
- expect(asFragment()).toMatchSnapshot();
111
- });
107
+ test(`Renders ${styles.modifiers.display_2xl} when displaySize = 2xl`, () => {
108
+ render(<DescriptionList aria-label="list" displaySize="2xl" />);
109
+ expect(screen.getByLabelText('list')).toHaveClass(styles.modifiers.display_2xl);
110
+ });
112
111
 
113
- test('Group', () => {
114
- const { asFragment } = render(
115
- <DescriptionListGroup className="custom-description-list-group" aria-labelledby="group-1">
116
- test
117
- </DescriptionListGroup>
118
- );
119
- expect(asFragment()).toMatchSnapshot();
112
+ test(`Renders style when isHorizontal and horizontalTermWidthModifier is set`, () => {
113
+ render(
114
+ <DescriptionList
115
+ aria-label="list"
116
+ isHorizontal
117
+ horizontalTermWidthModifier={{
118
+ default: '12ch',
119
+ sm: '15ch',
120
+ md: '20ch',
121
+ lg: '28ch',
122
+ xl: '30ch',
123
+ '2xl': '35ch'
124
+ }}
125
+ />
126
+ );
127
+ expect(screen.getByLabelText('list')).toHaveStyle({
128
+ '--pf-v5-c-description-list--m-horizontal__term--width': '12ch',
129
+ '--pf-v5-c-description-list--m-horizontal__term--width-on-sm': '15ch',
130
+ '--pf-v5-c-description-list--m-horizontal__term--width-on-md': '20ch',
131
+ '--pf-v5-c-description-list--m-horizontal__term--width-on-lg': '28ch',
132
+ '--pf-v5-c-description-list--m-horizontal__term--width-on-xl': '30ch',
133
+ '--pf-v5-c-description-list--m-horizontal__term--width-on-2xl': '35ch'
120
134
  });
135
+ });
121
136
 
122
- test('Description', () => {
123
- const { asFragment } = render(
124
- <DescriptionListDescription className="custom-description-list-description" aria-labelledby="description-1">
125
- test
126
- </DescriptionListDescription>
127
- );
128
- expect(asFragment()).toMatchSnapshot();
137
+ test(`Renders style when termWidth is set`, () => {
138
+ render(<DescriptionList aria-label="list" isHorizontal termWidth="30px" />);
139
+ expect(screen.getByLabelText('list')).toHaveStyle({
140
+ '--pf-v5-c-description-list__term--width': '30px'
129
141
  });
130
142
  });
143
+
144
+ test(`Renders style when isAutoFit and horizontalTermWidthModifier is set`, () => {
145
+ render(
146
+ <DescriptionList
147
+ aria-label="list"
148
+ isAutoFit
149
+ autoFitMinModifier={{ default: '50px', sm: '50px', md: '100px', lg: '150px', xl: '200px', '2xl': '300px' }}
150
+ />
151
+ );
152
+ expect(screen.getByLabelText('list')).toHaveAttribute(
153
+ 'style',
154
+ '--pf-v5-c-description-list--GridTemplateColumns--min: 50px; --pf-v5-c-description-list--GridTemplateColumns--min-on-sm: 50px; --pf-v5-c-description-list--GridTemplateColumns--min-on-md: 100px; --pf-v5-c-description-list--GridTemplateColumns--min-on-lg: 150px; --pf-v5-c-description-list--GridTemplateColumns--min-on-xl: 200px; --pf-v5-c-description-list--GridTemplateColumns--min-on-2xl: 300px;'
155
+ );
156
+ });
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { DescriptionListDescription } from '../DescriptionListDescription';
4
+
5
+ import styles from '@patternfly/react-styles/css/components/DescriptionList/description-list';
6
+
7
+ test('Renders to match snapshot', () => {
8
+ const { asFragment } = render(<DescriptionListDescription>test</DescriptionListDescription>);
9
+ expect(asFragment()).toMatchSnapshot();
10
+ });
11
+
12
+ test(`Renders default class ${styles.descriptionListDescription}`, () => {
13
+ render(<DescriptionListDescription>test</DescriptionListDescription>);
14
+ expect(screen.getByText('test').parentElement).toHaveClass(styles.descriptionListDescription, { exact: true });
15
+ });
16
+
17
+ test('Renders custom className', () => {
18
+ render(<DescriptionListDescription className="custom">test</DescriptionListDescription>);
19
+ expect(screen.getByText('test').parentElement).toHaveClass('custom');
20
+ });
21
+
22
+ test('Renders spread props', () => {
23
+ render(<DescriptionListDescription id="id">test</DescriptionListDescription>);
24
+ expect(screen.getByText('test').parentElement).toHaveAttribute('id', 'id');
25
+ });
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { DescriptionListGroup } from '../DescriptionListGroup';
4
+
5
+ import styles from '@patternfly/react-styles/css/components/DescriptionList/description-list';
6
+
7
+ test('Renders to match snapshot', () => {
8
+ const { asFragment } = render(<DescriptionListGroup>test</DescriptionListGroup>);
9
+ expect(asFragment()).toMatchSnapshot();
10
+ });
11
+
12
+ test(`Renders default class ${styles.descriptionListGroup}`, () => {
13
+ render(<DescriptionListGroup>test</DescriptionListGroup>);
14
+ expect(screen.getByText('test')).toHaveClass(styles.descriptionListGroup, { exact: true });
15
+ });
16
+
17
+ test('Renders custom className', () => {
18
+ render(<DescriptionListGroup className="custom">test</DescriptionListGroup>);
19
+ expect(screen.getByText('test')).toHaveClass('custom');
20
+ });
21
+
22
+ test('Renders spread props', () => {
23
+ render(<DescriptionListGroup id="id">test</DescriptionListGroup>);
24
+ expect(screen.getByText('test')).toHaveAttribute('id', 'id');
25
+ });
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { DescriptionListTermHelpTextButton } from '../DescriptionListTermHelpTextButton';
4
+
5
+ import styles from '@patternfly/react-styles/css/components/DescriptionList/description-list';
6
+
7
+ test('Renders to match snapshot', () => {
8
+ const { asFragment } = render(<DescriptionListTermHelpTextButton>test</DescriptionListTermHelpTextButton>);
9
+ expect(asFragment()).toMatchSnapshot();
10
+ });
11
+
12
+ test(`Renders default class ${styles.descriptionListText}`, () => {
13
+ render(<DescriptionListTermHelpTextButton>test</DescriptionListTermHelpTextButton>);
14
+ expect(screen.getByText('test')).toHaveClass(`${styles.descriptionListText} ${styles.modifiers.helpText}`, {
15
+ exact: true
16
+ });
17
+ });
18
+
19
+ test('Renders custom className', () => {
20
+ render(<DescriptionListTermHelpTextButton className="custom">test</DescriptionListTermHelpTextButton>);
21
+ expect(screen.getByText('test')).toHaveClass('custom');
22
+ });
23
+
24
+ test('Renders spread props', () => {
25
+ render(<DescriptionListTermHelpTextButton id="id">test</DescriptionListTermHelpTextButton>);
26
+ expect(screen.getByText('test')).toHaveAttribute('id', 'id');
27
+ });
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { DescriptionListTerm } from '../DescriptionListTerm';
4
+
5
+ import styles from '@patternfly/react-styles/css/components/DescriptionList/description-list';
6
+
7
+ test('Renders to match snapshot', () => {
8
+ const { asFragment } = render(<DescriptionListTerm>test</DescriptionListTerm>);
9
+ expect(asFragment()).toMatchSnapshot();
10
+ });
11
+
12
+ test(`Renders default class ${styles.descriptionListTerm}`, () => {
13
+ render(<DescriptionListTerm>test</DescriptionListTerm>);
14
+ expect(screen.getByText('test').parentElement).toHaveClass(styles.descriptionListTerm, { exact: true });
15
+ });
16
+
17
+ test(`Renders default class ${styles.descriptionListText}`, () => {
18
+ render(<DescriptionListTerm>test</DescriptionListTerm>);
19
+ expect(screen.getByText('test')).toHaveClass(styles.descriptionListText, { exact: true });
20
+ });
21
+
22
+ test('Renders custom className', () => {
23
+ render(<DescriptionListTerm className="custom">test</DescriptionListTerm>);
24
+ expect(screen.getByText('test').parentElement).toHaveClass('custom');
25
+ });
26
+
27
+ test('Renders icon', () => {
28
+ render(<DescriptionListTerm icon={<div>icon</div>}>test</DescriptionListTerm>);
29
+ expect(screen.getByText('icon').parentElement).toHaveClass(styles.descriptionListTermIcon);
30
+ });
31
+
32
+ test('Renders spread props', () => {
33
+ render(<DescriptionListTerm id="id">test</DescriptionListTerm>);
34
+ expect(screen.getByText('test').parentElement).toHaveAttribute('id', 'id');
35
+ });
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { DescriptionListTermHelpText } from '../DescriptionListTermHelpText';
4
+
5
+ import styles from '@patternfly/react-styles/css/components/DescriptionList/description-list';
6
+
7
+ test('Renders to match snapshot', () => {
8
+ const { asFragment } = render(<DescriptionListTermHelpText>test</DescriptionListTermHelpText>);
9
+ expect(asFragment()).toMatchSnapshot();
10
+ });
11
+
12
+ test(`Renders default class ${styles.descriptionListTerm}`, () => {
13
+ render(<DescriptionListTermHelpText>test</DescriptionListTermHelpText>);
14
+ expect(screen.getByText('test')).toHaveClass(styles.descriptionListTerm, { exact: true });
15
+ });
16
+
17
+ test('Renders custom className', () => {
18
+ render(<DescriptionListTermHelpText className="custom">test</DescriptionListTermHelpText>);
19
+ expect(screen.getByText('test')).toHaveClass('custom');
20
+ });
21
+
22
+ test('Renders spread props', () => {
23
+ render(<DescriptionListTermHelpText id="id">test</DescriptionListTermHelpText>);
24
+ expect(screen.getByText('test')).toHaveAttribute('id', 'id');
25
+ });
@@ -1,162 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Description List 1 col on all breakpoints 1`] = `
4
- <DocumentFragment>
5
- <dl
6
- class="pf-v5-c-description-list pf-m-1-col pf-m-1-col-on-md pf-m-1-col-on-lg pf-m-1-col-on-xl pf-m-1-col-on-2xl"
7
- />
8
- </DocumentFragment>
9
- `;
10
-
11
- exports[`Description List 2 col on all breakpoints 1`] = `
12
- <DocumentFragment>
13
- <dl
14
- class="pf-v5-c-description-list pf-m-2-col pf-m-2-col-on-md pf-m-2-col-on-lg pf-m-2-col-on-xl pf-m-2-col-on-2xl"
15
- />
16
- </DocumentFragment>
17
- `;
18
-
19
- exports[`Description List 3 col on all breakpoints 1`] = `
20
- <DocumentFragment>
21
- <dl
22
- class="pf-v5-c-description-list pf-m-3-col pf-m-3-col-on-md pf-m-3-col-on-lg pf-m-3-col-on-xl pf-m-3-col-on-2xl"
23
- />
24
- </DocumentFragment>
25
- `;
26
-
27
- exports[`Description List Auto Column Widths Description List 1`] = `
28
- <DocumentFragment>
29
- <dl
30
- class="pf-v5-c-description-list pf-m-auto-column-widths"
31
- />
32
- </DocumentFragment>
33
- `;
34
-
35
- exports[`Description List Auto fit Description List 1`] = `
36
- <DocumentFragment>
37
- <dl
38
- class="pf-v5-c-description-list pf-m-auto-fit"
39
- />
40
- </DocumentFragment>
41
- `;
42
-
43
- exports[`Description List Auto fit with responsive grid Description List 1`] = `
44
- <DocumentFragment>
45
- <dl
46
- class="pf-v5-c-description-list pf-m-auto-fit"
47
- style="--pf-v5-c-description-list--GridTemplateColumns--min-on-md: 100px; --pf-v5-c-description-list--GridTemplateColumns--min-on-lg: 150px; --pf-v5-c-description-list--GridTemplateColumns--min-on-xl: 200px; --pf-v5-c-description-list--GridTemplateColumns--min-on-2xl: 300px;"
48
- />
49
- </DocumentFragment>
50
- `;
51
-
52
- exports[`Description List Compact Description List 1`] = `
53
- <DocumentFragment>
54
- <dl
55
- class="pf-v5-c-description-list pf-m-compact"
56
- />
57
- </DocumentFragment>
58
- `;
59
-
60
- exports[`Description List Compact Horizontal Description List 1`] = `
61
- <DocumentFragment>
62
- <dl
63
- class="pf-v5-c-description-list pf-m-horizontal pf-m-compact"
64
- />
65
- </DocumentFragment>
66
- `;
67
-
68
- exports[`Description List Description 1`] = `
69
- <DocumentFragment>
70
- <dd
71
- aria-labelledby="description-1"
72
- class="pf-v5-c-description-list__description custom-description-list-description"
73
- >
74
- <div
75
- class="pf-v5-c-description-list__text"
76
- >
77
- test
78
- </div>
79
- </dd>
80
- </DocumentFragment>
81
- `;
82
-
83
- exports[`Description List Fluid Horizontal Description List 1`] = `
84
- <DocumentFragment>
85
- <dl
86
- class="pf-v5-c-description-list pf-m-horizontal pf-m-fluid"
87
- />
88
- </DocumentFragment>
89
- `;
90
-
91
- exports[`Description List Group 1`] = `
92
- <DocumentFragment>
93
- <div
94
- aria-labelledby="group-1"
95
- class="pf-v5-c-description-list__group custom-description-list-group"
96
- >
97
- test
98
- </div>
99
- </DocumentFragment>
100
- `;
101
-
102
- exports[`Description List Horizontal Description List 1`] = `
103
- <DocumentFragment>
104
- <dl
105
- class="pf-v5-c-description-list pf-m-horizontal"
106
- />
107
- </DocumentFragment>
108
- `;
109
-
110
- exports[`Description List Inline Grid Description List 1`] = `
111
- <DocumentFragment>
112
- <dl
113
- class="pf-v5-c-description-list pf-m-inline-grid"
114
- />
115
- </DocumentFragment>
116
- `;
117
-
118
- exports[`Description List Term default 1`] = `
119
- <DocumentFragment>
120
- <dt
121
- aria-labelledby="term-1"
122
- class="pf-v5-c-description-list__term"
123
- >
124
- <span
125
- class="pf-v5-c-description-list__text"
126
- >
127
- test
128
- </span>
129
- </dt>
130
- </DocumentFragment>
131
- `;
132
-
133
- exports[`Description List Term helper text 1`] = `
134
- <DocumentFragment>
135
- <dt
136
- aria-labelledby="term-1"
137
- class="pf-v5-c-description-list__term"
138
- >
139
- <span
140
- class="pf-v5-c-description-list__text pf-m-help-text"
141
- role="button"
142
- tabindex="0"
143
- type="button"
144
- >
145
- test
146
- </span>
147
- </dt>
148
- </DocumentFragment>
149
- `;
150
-
151
- exports[`Description List alignment breakpoints 1`] = `
152
- <DocumentFragment>
153
- <dl
154
- class="pf-v5-c-description-list pf-m-horizontal pf-m-horizontal-on-sm pf-m-vertical-on-md pf-m-horizontal-on-lg pf-m-vertical-on-xl pf-m-horizontal-on-2xl"
155
- />
156
- </DocumentFragment>
157
- `;
158
-
159
- exports[`Description List default 1`] = `
3
+ exports[`Renders to match snapshot 1`] = `
160
4
  <DocumentFragment>
161
5
  <dl
162
6
  class="pf-v5-c-description-list"
@@ -0,0 +1,15 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Renders to match snapshot 1`] = `
4
+ <DocumentFragment>
5
+ <dd
6
+ class="pf-v5-c-description-list__description"
7
+ >
8
+ <div
9
+ class="pf-v5-c-description-list__text"
10
+ >
11
+ test
12
+ </div>
13
+ </dd>
14
+ </DocumentFragment>
15
+ `;
@@ -0,0 +1,11 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Renders to match snapshot 1`] = `
4
+ <DocumentFragment>
5
+ <div
6
+ class="pf-v5-c-description-list__group"
7
+ >
8
+ test
9
+ </div>
10
+ </DocumentFragment>
11
+ `;
@@ -0,0 +1,14 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Renders to match snapshot 1`] = `
4
+ <DocumentFragment>
5
+ <span
6
+ class="pf-v5-c-description-list__text pf-m-help-text"
7
+ role="button"
8
+ tabindex="0"
9
+ type="button"
10
+ >
11
+ test
12
+ </span>
13
+ </DocumentFragment>
14
+ `;
@@ -0,0 +1,15 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Renders to match snapshot 1`] = `
4
+ <DocumentFragment>
5
+ <dt
6
+ class="pf-v5-c-description-list__term"
7
+ >
8
+ <span
9
+ class="pf-v5-c-description-list__text"
10
+ >
11
+ test
12
+ </span>
13
+ </dt>
14
+ </DocumentFragment>
15
+ `;
@@ -0,0 +1,11 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Renders to match snapshot 1`] = `
4
+ <DocumentFragment>
5
+ <dt
6
+ class="pf-v5-c-description-list__term"
7
+ >
8
+ test
9
+ </dt>
10
+ </DocumentFragment>
11
+ `;