@zohodesk/components 1.6.31 → 1.6.34

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 (163) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/assets/Appearance/light/mode/Component_LightMode.module.css +1 -1
  3. package/es/Accordion/__tests__/Accordion.spec.js +117 -3
  4. package/es/Accordion/__tests__/AccordionItem.spec.js +118 -6
  5. package/es/Accordion/__tests__/__snapshots__/Accordion.spec.js.snap +344 -2
  6. package/es/Accordion/__tests__/__snapshots__/AccordionItem.spec.js.snap +155 -3
  7. package/es/Animation/__tests__/Animation.spec.js +28 -4
  8. package/es/Animation/__tests__/__snapshots__/Animation.spec.js.snap +92 -2
  9. package/es/Button/css/Button.module.css +2 -3
  10. package/es/CheckBox/CheckBox.js +1 -1
  11. package/es/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +1 -1
  12. package/es/DateTime/DateTime.module.css +2 -2
  13. package/es/DateTime/__tests__/CalendarView.spec.js +70 -3
  14. package/es/DateTime/__tests__/DateTime.spec.js +89 -6
  15. package/es/DateTime/__tests__/DateTimePopupFooter.spec.js +20 -2
  16. package/es/DateTime/__tests__/DateTimePopupHeader.spec.js +29 -2
  17. package/es/DateTime/__tests__/DateWidget.spec.js +34 -2
  18. package/es/DateTime/__tests__/DaysRow.spec.js +19 -3
  19. package/es/DateTime/__tests__/Time.spec.js +50 -3
  20. package/es/DateTime/__tests__/YearView.spec.js +60 -3
  21. package/es/DateTime/__tests__/__snapshots__/CalendarView.spec.js.snap +2907 -170
  22. package/es/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +4392 -108
  23. package/es/DateTime/__tests__/__snapshots__/DateTimePopupFooter.spec.js.snap +67 -1
  24. package/es/DateTime/__tests__/__snapshots__/DateTimePopupHeader.spec.js.snap +187 -1
  25. package/es/DateTime/__tests__/__snapshots__/DateWidget.spec.js.snap +265 -1
  26. package/es/DateTime/__tests__/__snapshots__/DaysRow.spec.js.snap +155 -2
  27. package/es/DateTime/__tests__/__snapshots__/Time.spec.js.snap +522 -5
  28. package/es/DateTime/__tests__/__snapshots__/YearView.spec.js.snap +540 -0
  29. package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +1 -4
  30. package/es/Heading/Heading.module.css +1 -1
  31. package/es/Heading/__tests__/Heading.spec.js +57 -3
  32. package/es/Heading/__tests__/__snapshots__/Heading.spec.js.snap +87 -14
  33. package/es/ListItem/__tests__/ListContainer.spec.js +228 -1
  34. package/es/ListItem/__tests__/ListItem.spec.js +359 -1
  35. package/es/ListItem/__tests__/ListItemWithAvatar.spec.js +390 -1
  36. package/es/ListItem/__tests__/ListItemWithCheckBox.spec.js +214 -1
  37. package/es/ListItem/__tests__/ListItemWithIcon.spec.js +303 -1
  38. package/es/ListItem/__tests__/ListItemWithRadio.spec.js +230 -1
  39. package/es/ListItem/__tests__/__snapshots__/ListContainer.spec.js.snap +602 -0
  40. package/es/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +1807 -0
  41. package/es/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +2703 -0
  42. package/es/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +2909 -0
  43. package/es/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +2009 -0
  44. package/es/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +3070 -0
  45. package/es/MultiSelect/MultiSelect.module.css +1 -2
  46. package/es/MultiSelect/__tests__/AdvancedGroupMultiSelect.spec.js +671 -1
  47. package/es/MultiSelect/__tests__/AdvancedMultiSelect.spec.js +730 -1
  48. package/es/MultiSelect/__tests__/EmptyState.spec.js +268 -1
  49. package/es/MultiSelect/__tests__/MultiSelect.spec.js +889 -2
  50. package/es/MultiSelect/__tests__/MultiSelectHeader.spec.js +50 -1
  51. package/es/MultiSelect/__tests__/MultiSelectWithAvatar.spec.js +487 -1
  52. package/es/MultiSelect/__tests__/SelectedOptions.spec.js +291 -1
  53. package/es/MultiSelect/__tests__/Suggestions.spec.js +370 -2
  54. package/es/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +11785 -0
  55. package/es/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +12083 -0
  56. package/es/MultiSelect/__tests__/__snapshots__/EmptyState.spec.js.snap +253 -0
  57. package/es/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +14052 -0
  58. package/es/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +136 -0
  59. package/es/MultiSelect/__tests__/__snapshots__/MultiSelectWithAvatar.spec.js.snap +11506 -0
  60. package/es/MultiSelect/__tests__/__snapshots__/SelectedOptions.spec.js.snap +1382 -0
  61. package/es/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +3611 -0
  62. package/es/PopOver/__tests__/PopOver.spec.js +141 -2
  63. package/es/PopOver/__tests__/__snapshots__/PopOver.spec.js.snap +1260 -0
  64. package/es/ResponsiveDropBox/__tests__/ResponsiveDropBox.spec.js +212 -1
  65. package/es/ResponsiveDropBox/__tests__/__snapshots__/ResponsiveDropBox.spec.js.snap +1802 -0
  66. package/es/Tab/Tabs.module.css +1 -2
  67. package/es/Tab/__tests__/Tab.spec.js +249 -1
  68. package/es/Tab/__tests__/TabContent.spec.js +34 -1
  69. package/es/Tab/__tests__/TabContentWrapper.spec.js +72 -1
  70. package/es/Tab/__tests__/TabWrapper.spec.js +163 -1
  71. package/es/Tab/__tests__/Tabs.spec.js +681 -1
  72. package/es/Tab/__tests__/__snapshots__/Tab.spec.js.snap +1049 -0
  73. package/es/Tab/__tests__/__snapshots__/TabContent.spec.js.snap +99 -0
  74. package/es/Tab/__tests__/__snapshots__/TabContentWrapper.spec.js.snap +121 -0
  75. package/es/Tab/__tests__/__snapshots__/TabWrapper.spec.js.snap +2002 -0
  76. package/es/Tab/__tests__/__snapshots__/Tabs.spec.js.snap +11053 -0
  77. package/es/Textarea/Textarea.module.css +1 -1
  78. package/es/Tooltip/Tooltip.module.css +1 -2
  79. package/es/Tooltip/__tests__/Tooltip.spec.js +590 -0
  80. package/es/Tooltip/__tests__/__snapshots__/Tooltip.spec.js.snap +813 -0
  81. package/es/Typography/css/Typography.module.css +8 -7
  82. package/es/common/common.module.css +4 -4
  83. package/lib/Accordion/__tests__/Accordion.spec.js +122 -2
  84. package/lib/Accordion/__tests__/AccordionItem.spec.js +126 -4
  85. package/lib/Accordion/__tests__/__snapshots__/Accordion.spec.js.snap +344 -2
  86. package/lib/Accordion/__tests__/__snapshots__/AccordionItem.spec.js.snap +155 -3
  87. package/lib/Animation/__tests__/Animation.spec.js +31 -5
  88. package/lib/Animation/__tests__/__snapshots__/Animation.spec.js.snap +92 -2
  89. package/lib/Button/css/Button.module.css +2 -3
  90. package/lib/CheckBox/CheckBox.js +1 -1
  91. package/lib/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +1 -1
  92. package/lib/DateTime/DateTime.module.css +2 -2
  93. package/lib/DateTime/__tests__/CalendarView.spec.js +71 -2
  94. package/lib/DateTime/__tests__/DateTime.spec.js +92 -6
  95. package/lib/DateTime/__tests__/DateTimePopupFooter.spec.js +21 -1
  96. package/lib/DateTime/__tests__/DateTimePopupHeader.spec.js +30 -1
  97. package/lib/DateTime/__tests__/DateWidget.spec.js +35 -1
  98. package/lib/DateTime/__tests__/DaysRow.spec.js +20 -2
  99. package/lib/DateTime/__tests__/Time.spec.js +51 -2
  100. package/lib/DateTime/__tests__/YearView.spec.js +61 -2
  101. package/lib/DateTime/__tests__/__snapshots__/CalendarView.spec.js.snap +2907 -170
  102. package/lib/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +4392 -108
  103. package/lib/DateTime/__tests__/__snapshots__/DateTimePopupFooter.spec.js.snap +67 -1
  104. package/lib/DateTime/__tests__/__snapshots__/DateTimePopupHeader.spec.js.snap +187 -1
  105. package/lib/DateTime/__tests__/__snapshots__/DateWidget.spec.js.snap +265 -1
  106. package/lib/DateTime/__tests__/__snapshots__/DaysRow.spec.js.snap +155 -2
  107. package/lib/DateTime/__tests__/__snapshots__/Time.spec.js.snap +522 -5
  108. package/lib/DateTime/__tests__/__snapshots__/YearView.spec.js.snap +540 -0
  109. package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +1 -4
  110. package/lib/Heading/Heading.module.css +1 -1
  111. package/lib/Heading/__tests__/Heading.spec.js +60 -4
  112. package/lib/Heading/__tests__/__snapshots__/Heading.spec.js.snap +87 -14
  113. package/lib/ListItem/__tests__/ListContainer.spec.js +229 -0
  114. package/lib/ListItem/__tests__/ListItem.spec.js +362 -0
  115. package/lib/ListItem/__tests__/ListItemWithAvatar.spec.js +391 -0
  116. package/lib/ListItem/__tests__/ListItemWithCheckBox.spec.js +215 -0
  117. package/lib/ListItem/__tests__/ListItemWithIcon.spec.js +304 -0
  118. package/lib/ListItem/__tests__/ListItemWithRadio.spec.js +231 -0
  119. package/lib/ListItem/__tests__/__snapshots__/ListContainer.spec.js.snap +602 -0
  120. package/lib/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +1807 -0
  121. package/lib/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +2703 -0
  122. package/lib/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +2909 -0
  123. package/lib/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +2009 -0
  124. package/lib/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +3070 -0
  125. package/lib/MultiSelect/MultiSelect.module.css +1 -2
  126. package/lib/MultiSelect/__tests__/AdvancedGroupMultiSelect.spec.js +692 -0
  127. package/lib/MultiSelect/__tests__/AdvancedMultiSelect.spec.js +741 -0
  128. package/lib/MultiSelect/__tests__/EmptyState.spec.js +273 -0
  129. package/lib/MultiSelect/__tests__/MultiSelect.spec.js +910 -0
  130. package/lib/MultiSelect/__tests__/MultiSelectHeader.spec.js +51 -0
  131. package/lib/MultiSelect/__tests__/MultiSelectWithAvatar.spec.js +497 -0
  132. package/lib/MultiSelect/__tests__/SelectedOptions.spec.js +305 -0
  133. package/lib/MultiSelect/__tests__/Suggestions.spec.js +375 -0
  134. package/lib/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +11785 -0
  135. package/lib/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +12083 -0
  136. package/lib/MultiSelect/__tests__/__snapshots__/EmptyState.spec.js.snap +253 -0
  137. package/lib/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +14052 -0
  138. package/lib/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +136 -0
  139. package/lib/MultiSelect/__tests__/__snapshots__/MultiSelectWithAvatar.spec.js.snap +11506 -0
  140. package/lib/MultiSelect/__tests__/__snapshots__/SelectedOptions.spec.js.snap +1382 -0
  141. package/lib/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +3611 -0
  142. package/lib/PopOver/__tests__/PopOver.spec.js +150 -1
  143. package/lib/PopOver/__tests__/__snapshots__/PopOver.spec.js.snap +1260 -0
  144. package/lib/ResponsiveDropBox/__tests__/ResponsiveDropBox.spec.js +213 -0
  145. package/lib/ResponsiveDropBox/__tests__/__snapshots__/ResponsiveDropBox.spec.js.snap +1802 -0
  146. package/lib/Tab/Tabs.module.css +1 -2
  147. package/lib/Tab/__tests__/Tab.spec.js +250 -0
  148. package/lib/Tab/__tests__/TabContent.spec.js +35 -0
  149. package/lib/Tab/__tests__/TabContentWrapper.spec.js +76 -0
  150. package/lib/Tab/__tests__/TabWrapper.spec.js +174 -0
  151. package/lib/Tab/__tests__/Tabs.spec.js +741 -0
  152. package/lib/Tab/__tests__/__snapshots__/Tab.spec.js.snap +1049 -0
  153. package/lib/Tab/__tests__/__snapshots__/TabContent.spec.js.snap +99 -0
  154. package/lib/Tab/__tests__/__snapshots__/TabContentWrapper.spec.js.snap +121 -0
  155. package/lib/Tab/__tests__/__snapshots__/TabWrapper.spec.js.snap +2002 -0
  156. package/lib/Tab/__tests__/__snapshots__/Tabs.spec.js.snap +11053 -0
  157. package/lib/Textarea/Textarea.module.css +1 -1
  158. package/lib/Tooltip/Tooltip.module.css +1 -2
  159. package/lib/Tooltip/__tests__/Tooltip.spec.js +629 -0
  160. package/lib/Tooltip/__tests__/__snapshots__/Tooltip.spec.js.snap +813 -0
  161. package/lib/Typography/css/Typography.module.css +8 -7
  162. package/lib/common/common.module.css +4 -4
  163. package/package.json +6 -5
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
- import { render } from '@testing-library/react';
2
+ import { render, cleanup } from '@testing-library/react';
3
3
  import ListItemWithIcon from "../ListItemWithIcon";
4
4
  describe('ListItemWithIcon', () => {
5
+ afterEach(() => cleanup());
5
6
  test('rendering the defult props', () => {
6
7
  const {
7
8
  asFragment
@@ -60,4 +61,305 @@ describe('ListItemWithIcon', () => {
60
61
  }));
61
62
  expect(asFragment()).toMatchSnapshot();
62
63
  });
64
+ const iconNames = ['ZD-GN-info', 'ZD-GN-agent'];
65
+ const palettes = ['primary', 'secondary', 'dark', 'danger']; // primary and danger add no class until active/highlight/autoHover, so danger would match primary here
66
+
67
+ const inertPalettes = ['primary', 'secondary', 'dark'];
68
+ const sizes = ['small', 'large'];
69
+ test.each(iconNames)('Render with iconName as %s', iconName => {
70
+ const {
71
+ asFragment
72
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
73
+ iconName: iconName
74
+ }));
75
+ expect(asFragment()).toMatchSnapshot();
76
+ }); // lhsAlignContent only reaches the Icon wrapper when iconName is set; the icon-less case is covered by the existing cases
77
+
78
+ test.each(['center', 'end'])('Render with iconName and lhsAlignContent as %s', lhsAlignContent => {
79
+ const {
80
+ asFragment
81
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
82
+ iconName: "ZD-GN-info",
83
+ lhsAlignContent: lhsAlignContent
84
+ }));
85
+ expect(asFragment()).toMatchSnapshot();
86
+ });
87
+ test.each(['start', 'end'])('Render with iconName and lhsJustifyContent as %s', lhsJustifyContent => {
88
+ const {
89
+ asFragment
90
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
91
+ iconName: "ZD-GN-info",
92
+ lhsJustifyContent: lhsJustifyContent
93
+ }));
94
+ expect(asFragment()).toMatchSnapshot();
95
+ });
96
+ test.each(inertPalettes)('Render with palette as %s', palette => {
97
+ const {
98
+ asFragment
99
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
100
+ palette: palette
101
+ }));
102
+ expect(asFragment()).toMatchSnapshot();
103
+ });
104
+ test.each(sizes)('Render with size as %s', size => {
105
+ const {
106
+ asFragment
107
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
108
+ size: size
109
+ }));
110
+ expect(asFragment()).toMatchSnapshot();
111
+ });
112
+ test.each(sizes)('Render with needTick and size as %s', size => {
113
+ const {
114
+ asFragment
115
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
116
+ needTick: true,
117
+ size: size
118
+ }));
119
+ expect(asFragment()).toMatchSnapshot();
120
+ });
121
+ test('Render with iconName and iconSize', () => {
122
+ const {
123
+ asFragment
124
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
125
+ iconName: "ZD-GN-info",
126
+ iconSize: "14"
127
+ }));
128
+ expect(asFragment()).toMatchSnapshot();
129
+ });
130
+ test('Render with iconName and iconClass', () => {
131
+ const {
132
+ asFragment
133
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
134
+ iconName: "ZD-GN-info",
135
+ iconClass: "custom-icon-class"
136
+ }));
137
+ expect(asFragment()).toMatchSnapshot();
138
+ });
139
+ test('Render with iconClass without iconName', () => {
140
+ const {
141
+ asFragment
142
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
143
+ iconClass: "custom-icon-class"
144
+ }));
145
+ expect(asFragment()).toMatchSnapshot();
146
+ });
147
+ test('Render with active', () => {
148
+ const {
149
+ asFragment
150
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
151
+ active: true
152
+ }));
153
+ expect(asFragment()).toMatchSnapshot();
154
+ });
155
+ test('Render with active and needTick', () => {
156
+ const {
157
+ asFragment
158
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
159
+ active: true,
160
+ needTick: true
161
+ }));
162
+ expect(asFragment()).toMatchSnapshot();
163
+ });
164
+ test('Render with needTick', () => {
165
+ const {
166
+ asFragment
167
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
168
+ needTick: true
169
+ }));
170
+ expect(asFragment()).toMatchSnapshot();
171
+ });
172
+ test('Render with highlight', () => {
173
+ const {
174
+ asFragment
175
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
176
+ highlight: true
177
+ }));
178
+ expect(asFragment()).toMatchSnapshot();
179
+ });
180
+ test('Render with autoHover', () => {
181
+ const {
182
+ asFragment
183
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
184
+ autoHover: true
185
+ }));
186
+ expect(asFragment()).toMatchSnapshot();
187
+ });
188
+ test('Render with needBorder=false', () => {
189
+ const {
190
+ asFragment
191
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
192
+ needBorder: false
193
+ }));
194
+ expect(asFragment()).toMatchSnapshot();
195
+ });
196
+ test('Render with title', () => {
197
+ const {
198
+ asFragment
199
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
200
+ title: "List item title"
201
+ }));
202
+ expect(asFragment()).toMatchSnapshot();
203
+ });
204
+ test('Render with isDisabled and title', () => {
205
+ const {
206
+ asFragment
207
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
208
+ isDisabled: true,
209
+ title: "List item title",
210
+ disableTitle: "Disabled title"
211
+ }));
212
+ expect(asFragment()).toMatchSnapshot();
213
+ });
214
+ test('Render with secondaryValue and isDisabled', () => {
215
+ const {
216
+ asFragment
217
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
218
+ secondaryValue: "Secondary value",
219
+ isDisabled: true
220
+ }));
221
+ expect(asFragment()).toMatchSnapshot();
222
+ });
223
+ test('Render with isLink and href', () => {
224
+ const {
225
+ asFragment
226
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
227
+ isLink: true,
228
+ href: "/list-item-with-icon"
229
+ }));
230
+ expect(asFragment()).toMatchSnapshot();
231
+ });
232
+ test('Render with isLink, href and target as self', () => {
233
+ const {
234
+ asFragment
235
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
236
+ isLink: true,
237
+ href: "/list-item-with-icon",
238
+ target: "self"
239
+ }));
240
+ expect(asFragment()).toMatchSnapshot();
241
+ });
242
+ test('Render with needMultiLineText', () => {
243
+ const {
244
+ asFragment
245
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
246
+ needMultiLineText: true
247
+ }));
248
+ expect(asFragment()).toMatchSnapshot();
249
+ });
250
+ test('Render with needMultiLineText and secondaryValue', () => {
251
+ const {
252
+ asFragment
253
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
254
+ needMultiLineText: true,
255
+ secondaryValue: "Secondary value"
256
+ }));
257
+ expect(asFragment()).toMatchSnapshot();
258
+ });
259
+ test('Render with value containing an apostrophe', () => {
260
+ const {
261
+ asFragment
262
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
263
+ value: "Agent's list"
264
+ }));
265
+ expect(asFragment()).toMatchSnapshot();
266
+ });
267
+ test('Render with empty value and dataId', () => {
268
+ const {
269
+ asFragment
270
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
271
+ value: "",
272
+ dataId: "list-item-with-icon-dataId"
273
+ }));
274
+ expect(asFragment()).toMatchSnapshot();
275
+ });
276
+ test('Render with dataId', () => {
277
+ const {
278
+ asFragment
279
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
280
+ dataId: "list-item-with-icon-dataId"
281
+ }));
282
+ expect(asFragment()).toMatchSnapshot();
283
+ });
284
+ test('Render with dataId and iconName', () => {
285
+ const {
286
+ asFragment
287
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
288
+ dataId: "list-item-with-icon-dataId",
289
+ iconName: "ZD-GN-info"
290
+ }));
291
+ expect(asFragment()).toMatchSnapshot();
292
+ });
293
+ test('Render with dataSelectorId', () => {
294
+ const {
295
+ asFragment
296
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
297
+ dataSelectorId: "list-item-with-icon-dataSelectorId"
298
+ }));
299
+ expect(asFragment()).toMatchSnapshot();
300
+ });
301
+ test('Render with customValueRightPlaceholderClass without renderValueRightPlaceholderNode', () => {
302
+ const {
303
+ asFragment
304
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
305
+ customValueRightPlaceholderClass: "customValueRightPlaceholderClass"
306
+ }));
307
+ expect(asFragment()).toMatchSnapshot();
308
+ });
309
+ test('Render with a11y role, ariaSelected and ariaLabel', () => {
310
+ const {
311
+ asFragment
312
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
313
+ a11y: {
314
+ role: 'menuitem',
315
+ ariaSelected: true,
316
+ ariaLabel: 'Item label'
317
+ }
318
+ }));
319
+ expect(asFragment()).toMatchSnapshot();
320
+ });
321
+ test('Render with a11y ariaHidden=false with active and needTick', () => {
322
+ const {
323
+ asFragment
324
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
325
+ active: true,
326
+ needTick: true,
327
+ a11y: {
328
+ ariaHidden: false
329
+ }
330
+ }));
331
+ expect(asFragment()).toMatchSnapshot();
332
+ });
333
+ test('Render with customClass', () => {
334
+ const {
335
+ asFragment
336
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
337
+ customClass: "custom-list-item"
338
+ }));
339
+ expect(asFragment()).toMatchSnapshot();
340
+ });
341
+ test('Render with customProps ListItemProps', () => {
342
+ const {
343
+ asFragment
344
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
345
+ customProps: {
346
+ ListItemProps: {
347
+ 'data-custom-attr': 'true'
348
+ }
349
+ }
350
+ }));
351
+ expect(asFragment()).toMatchSnapshot();
352
+ });
353
+ test('Render with customProps ContainerProps align as baseline', () => {
354
+ const {
355
+ asFragment
356
+ } = render( /*#__PURE__*/React.createElement(ListItemWithIcon, {
357
+ customProps: {
358
+ ContainerProps: {
359
+ align: 'baseline'
360
+ }
361
+ }
362
+ }));
363
+ expect(asFragment()).toMatchSnapshot();
364
+ });
63
365
  });
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
- import { render } from '@testing-library/react';
2
+ import { render, cleanup } from '@testing-library/react';
3
3
  import ListItemWithRadio from "../ListItemWithRadio";
4
4
  describe('ListItemWithRadio', () => {
5
+ afterEach(() => cleanup());
5
6
  test('rendering the defult props', () => {
6
7
  const {
7
8
  asFragment
@@ -62,4 +63,232 @@ describe('ListItemWithRadio', () => {
62
63
  }));
63
64
  expect(asFragment()).toMatchSnapshot();
64
65
  });
66
+ const palettes = ['primary', 'secondary', 'dark', 'danger']; // primary and danger add no class until active/highlight/autoHover, so danger would match primary here
67
+
68
+ const inertPalettes = ['primary', 'secondary', 'dark'];
69
+ const sizes = ['small', 'large'];
70
+ test.each(inertPalettes)('Render with palette as %s', palette => {
71
+ const {
72
+ asFragment
73
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
74
+ palette: palette
75
+ }));
76
+ expect(asFragment()).toMatchSnapshot();
77
+ });
78
+ test.each(sizes)('Render with size as %s', size => {
79
+ const {
80
+ asFragment
81
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
82
+ size: size
83
+ }));
84
+ expect(asFragment()).toMatchSnapshot();
85
+ });
86
+ test.each(['start', 'end'])('Render with lhsJustifyContent as %s', lhsJustifyContent => {
87
+ const {
88
+ asFragment
89
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
90
+ lhsJustifyContent: lhsJustifyContent
91
+ }));
92
+ expect(asFragment()).toMatchSnapshot();
93
+ });
94
+ test.each(palettes)('Render with active and palette as %s', palette => {
95
+ const {
96
+ asFragment
97
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
98
+ active: true,
99
+ palette: palette
100
+ }));
101
+ expect(asFragment()).toMatchSnapshot();
102
+ }); // checked is observable only on the Radio child, so it is paired with the real Radio render
103
+
104
+ test('Render with checked', () => {
105
+ const {
106
+ asFragment
107
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
108
+ checked: true
109
+ }));
110
+ expect(asFragment()).toMatchSnapshot();
111
+ });
112
+ test('Render with checked and active', () => {
113
+ const {
114
+ asFragment
115
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
116
+ checked: true,
117
+ active: true
118
+ }));
119
+ expect(asFragment()).toMatchSnapshot();
120
+ });
121
+ test('Render with id', () => {
122
+ const {
123
+ asFragment
124
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
125
+ id: "list-item-with-radio-id"
126
+ }));
127
+ expect(asFragment()).toMatchSnapshot();
128
+ });
129
+ test('Render with active', () => {
130
+ const {
131
+ asFragment
132
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
133
+ active: true
134
+ }));
135
+ expect(asFragment()).toMatchSnapshot();
136
+ });
137
+ test('Render with highlight', () => {
138
+ const {
139
+ asFragment
140
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
141
+ highlight: true
142
+ }));
143
+ expect(asFragment()).toMatchSnapshot();
144
+ });
145
+ test('Render with autoHover', () => {
146
+ const {
147
+ asFragment
148
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
149
+ autoHover: true
150
+ }));
151
+ expect(asFragment()).toMatchSnapshot();
152
+ });
153
+ test('Render with needBorder=false', () => {
154
+ const {
155
+ asFragment
156
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
157
+ needBorder: false
158
+ }));
159
+ expect(asFragment()).toMatchSnapshot();
160
+ });
161
+ test('Render with title', () => {
162
+ const {
163
+ asFragment
164
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
165
+ title: "List item title"
166
+ }));
167
+ expect(asFragment()).toMatchSnapshot();
168
+ });
169
+ test('Render with title and disableTitle', () => {
170
+ const {
171
+ asFragment
172
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
173
+ title: "List item title",
174
+ disableTitle: "Disabled title"
175
+ }));
176
+ expect(asFragment()).toMatchSnapshot();
177
+ });
178
+ test('Render with isDisabled and disableTitle', () => {
179
+ const {
180
+ asFragment
181
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
182
+ isDisabled: true,
183
+ disableTitle: "Disabled title"
184
+ }));
185
+ expect(asFragment()).toMatchSnapshot();
186
+ });
187
+ test('Render with secondaryValue and isDisabled', () => {
188
+ const {
189
+ asFragment
190
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
191
+ secondaryValue: "Secondary value",
192
+ isDisabled: true
193
+ }));
194
+ expect(asFragment()).toMatchSnapshot();
195
+ });
196
+ test('Render with needMultiLineText', () => {
197
+ const {
198
+ asFragment
199
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
200
+ needMultiLineText: true
201
+ }));
202
+ expect(asFragment()).toMatchSnapshot();
203
+ });
204
+ test('Render with needMultiLineText and secondaryValue', () => {
205
+ const {
206
+ asFragment
207
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
208
+ needMultiLineText: true,
209
+ secondaryValue: "Secondary value"
210
+ }));
211
+ expect(asFragment()).toMatchSnapshot();
212
+ });
213
+ test('Render with empty value', () => {
214
+ const {
215
+ asFragment
216
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
217
+ value: ""
218
+ }));
219
+ expect(asFragment()).toMatchSnapshot();
220
+ });
221
+ test('Render with dataId', () => {
222
+ const {
223
+ asFragment
224
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
225
+ dataId: "list-item-with-radio-dataId"
226
+ }));
227
+ expect(asFragment()).toMatchSnapshot();
228
+ });
229
+ test('Render with dataSelectorId', () => {
230
+ const {
231
+ asFragment
232
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
233
+ dataSelectorId: "list-item-with-radio-dataSelectorId"
234
+ }));
235
+ expect(asFragment()).toMatchSnapshot();
236
+ });
237
+ test('Render with a11y role, ariaSelected and ariaLabel', () => {
238
+ const {
239
+ asFragment
240
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
241
+ a11y: {
242
+ role: 'menuitem',
243
+ ariaSelected: true,
244
+ ariaLabel: 'Item label'
245
+ }
246
+ }));
247
+ expect(asFragment()).toMatchSnapshot();
248
+ });
249
+ test('Render with customClass customListItem', () => {
250
+ const {
251
+ asFragment
252
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
253
+ customClass: {
254
+ customListItem: 'custom-list-item'
255
+ }
256
+ }));
257
+ expect(asFragment()).toMatchSnapshot();
258
+ });
259
+ test('Render with customClass customRadio and customRadioWrap', () => {
260
+ const {
261
+ asFragment
262
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
263
+ customClass: {
264
+ customRadio: 'custom-radio',
265
+ customRadioWrap: 'custom-radio-wrap'
266
+ }
267
+ }));
268
+ expect(asFragment()).toMatchSnapshot();
269
+ });
270
+ test('Render with customProps ListItemProps', () => {
271
+ const {
272
+ asFragment
273
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
274
+ customProps: {
275
+ ListItemProps: {
276
+ 'data-custom-attr': 'true'
277
+ }
278
+ }
279
+ }));
280
+ expect(asFragment()).toMatchSnapshot();
281
+ });
282
+ test('Render with customProps ContainerProps align as baseline', () => {
283
+ const {
284
+ asFragment
285
+ } = render( /*#__PURE__*/React.createElement(ListItemWithRadio, {
286
+ customProps: {
287
+ ContainerProps: {
288
+ align: 'baseline'
289
+ }
290
+ }
291
+ }));
292
+ expect(asFragment()).toMatchSnapshot();
293
+ });
65
294
  });