@patternfly/react-templates 6.0.0-alpha.9 → 6.0.0-prerelease.1

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 (109) hide show
  1. package/CHANGELOG.md +200 -0
  2. package/README.md +4 -17
  3. package/components/package.json +1 -1
  4. package/dist/dynamic/components/Dropdown/package.json +1 -0
  5. package/dist/dynamic/components/Select/package.json +1 -1
  6. package/dist/dynamic-modules.json +19 -0
  7. package/dist/esm/components/Dropdown/SimpleDropdown.d.ts +48 -0
  8. package/dist/esm/components/Dropdown/SimpleDropdown.d.ts.map +1 -0
  9. package/dist/esm/components/Dropdown/SimpleDropdown.js +33 -0
  10. package/dist/esm/components/Dropdown/SimpleDropdown.js.map +1 -0
  11. package/dist/esm/components/Dropdown/index.d.ts +2 -0
  12. package/dist/esm/components/Dropdown/index.d.ts.map +1 -0
  13. package/dist/esm/components/Dropdown/index.js +2 -0
  14. package/dist/esm/components/Dropdown/index.js.map +1 -0
  15. package/dist/esm/components/Select/CheckboxSelect.d.ts +7 -3
  16. package/dist/esm/components/Select/CheckboxSelect.d.ts.map +1 -1
  17. package/dist/esm/components/Select/CheckboxSelect.js +14 -6
  18. package/dist/esm/components/Select/CheckboxSelect.js.map +1 -1
  19. package/dist/esm/components/Select/MultiTypeaheadSelect.d.ts +33 -0
  20. package/dist/esm/components/Select/MultiTypeaheadSelect.d.ts.map +1 -0
  21. package/dist/esm/components/Select/MultiTypeaheadSelect.js +186 -0
  22. package/dist/esm/components/Select/MultiTypeaheadSelect.js.map +1 -0
  23. package/dist/esm/components/Select/{SelectSimple.d.ts → SimpleSelect.d.ts} +12 -7
  24. package/dist/esm/components/Select/SimpleSelect.d.ts.map +1 -0
  25. package/dist/esm/components/Select/SimpleSelect.js +39 -0
  26. package/dist/esm/components/Select/SimpleSelect.js.map +1 -0
  27. package/dist/esm/components/Select/TypeaheadSelect.d.ts +43 -0
  28. package/dist/esm/components/Select/TypeaheadSelect.d.ts.map +1 -0
  29. package/dist/esm/components/Select/TypeaheadSelect.js +219 -0
  30. package/dist/esm/components/Select/TypeaheadSelect.js.map +1 -0
  31. package/dist/esm/components/Select/index.d.ts +3 -1
  32. package/dist/esm/components/Select/index.d.ts.map +1 -1
  33. package/dist/esm/components/Select/index.js +3 -1
  34. package/dist/esm/components/Select/index.js.map +1 -1
  35. package/dist/esm/components/index.d.ts +1 -0
  36. package/dist/esm/components/index.d.ts.map +1 -1
  37. package/dist/esm/components/index.js +1 -0
  38. package/dist/esm/components/index.js.map +1 -1
  39. package/dist/js/components/Dropdown/SimpleDropdown.d.ts +48 -0
  40. package/dist/js/components/Dropdown/SimpleDropdown.d.ts.map +1 -0
  41. package/dist/js/components/Dropdown/SimpleDropdown.js +36 -0
  42. package/dist/js/components/Dropdown/SimpleDropdown.js.map +1 -0
  43. package/dist/js/components/Dropdown/index.d.ts +2 -0
  44. package/dist/js/components/Dropdown/index.d.ts.map +1 -0
  45. package/dist/js/components/Dropdown/index.js +5 -0
  46. package/dist/js/components/Dropdown/index.js.map +1 -0
  47. package/dist/js/components/Select/CheckboxSelect.d.ts +7 -3
  48. package/dist/js/components/Select/CheckboxSelect.d.ts.map +1 -1
  49. package/dist/js/components/Select/CheckboxSelect.js +14 -6
  50. package/dist/js/components/Select/CheckboxSelect.js.map +1 -1
  51. package/dist/js/components/Select/MultiTypeaheadSelect.d.ts +33 -0
  52. package/dist/js/components/Select/MultiTypeaheadSelect.d.ts.map +1 -0
  53. package/dist/js/components/Select/MultiTypeaheadSelect.js +190 -0
  54. package/dist/js/components/Select/MultiTypeaheadSelect.js.map +1 -0
  55. package/dist/js/components/Select/{SelectSimple.d.ts → SimpleSelect.d.ts} +12 -7
  56. package/dist/js/components/Select/SimpleSelect.d.ts.map +1 -0
  57. package/dist/js/components/Select/SimpleSelect.js +42 -0
  58. package/dist/js/components/Select/SimpleSelect.js.map +1 -0
  59. package/dist/js/components/Select/TypeaheadSelect.d.ts +43 -0
  60. package/dist/js/components/Select/TypeaheadSelect.d.ts.map +1 -0
  61. package/dist/js/components/Select/TypeaheadSelect.js +223 -0
  62. package/dist/js/components/Select/TypeaheadSelect.js.map +1 -0
  63. package/dist/js/components/Select/index.d.ts +3 -1
  64. package/dist/js/components/Select/index.d.ts.map +1 -1
  65. package/dist/js/components/Select/index.js +3 -1
  66. package/dist/js/components/Select/index.js.map +1 -1
  67. package/dist/js/components/index.d.ts +1 -0
  68. package/dist/js/components/index.d.ts.map +1 -1
  69. package/dist/js/components/index.js +1 -0
  70. package/dist/js/components/index.js.map +1 -1
  71. package/dist/umd/assets/output-5R-ggtm5.css +23380 -0
  72. package/dist/umd/react-templates.min.js +1 -1
  73. package/package.json +10 -14
  74. package/rollup.config.mjs +8 -0
  75. package/src/components/Dropdown/SimpleDropdown.tsx +139 -0
  76. package/src/components/Dropdown/__tests__/SimpleDropdown.test.tsx +266 -0
  77. package/src/components/Dropdown/__tests__/__snapshots__/SimpleDropdown.test.tsx.snap +81 -0
  78. package/src/components/Dropdown/examples/DropdownTemplates.md +24 -0
  79. package/src/components/Dropdown/examples/SimpleDropdownExample.tsx +53 -0
  80. package/src/components/Dropdown/index.ts +1 -0
  81. package/src/components/Select/CheckboxSelect.tsx +23 -7
  82. package/src/components/Select/MultiTypeaheadSelect.tsx +348 -0
  83. package/src/components/Select/{SelectSimple.tsx → SimpleSelect.tsx} +39 -18
  84. package/src/components/Select/TypeaheadSelect.tsx +388 -0
  85. package/src/components/Select/{CheckboxSelect.test.tsx → __tests__/CheckboxSelect.test.tsx} +29 -1
  86. package/src/components/Select/{CheckboxSelectSnapshots.test.tsx → __tests__/CheckboxSelectSnapshots.test.tsx} +1 -1
  87. package/src/components/Select/__tests__/MultiTypeaheadSelect.test.tsx +414 -0
  88. package/src/components/Select/__tests__/SimpleSelect.test.tsx +241 -0
  89. package/src/components/Select/__tests__/TypeaheadSelect.test.tsx +408 -0
  90. package/src/components/Select/__tests__/__snapshots__/CheckboxSelectSnapshots.test.tsx.snap +83 -0
  91. package/src/components/Select/__tests__/__snapshots__/MultiTypeaheadSelect.test.tsx.snap +97 -0
  92. package/src/components/Select/__tests__/__snapshots__/SimpleSelect.test.tsx.snap +83 -0
  93. package/src/components/Select/__tests__/__snapshots__/TypeaheadSelect.test.tsx.snap +97 -0
  94. package/src/components/Select/examples/CheckboxSelectDemo.tsx +25 -8
  95. package/src/components/Select/examples/MultiTypeaheadSelectDemo.tsx +35 -0
  96. package/src/components/Select/examples/SelectTemplates.md +17 -4
  97. package/src/components/Select/examples/SimpleSelectDemo.tsx +36 -0
  98. package/src/components/Select/examples/TypeaheadSelectDemo.tsx +65 -0
  99. package/src/components/Select/index.ts +3 -1
  100. package/src/components/index.ts +1 -0
  101. package/dist/esm/components/Select/SelectSimple.d.ts.map +0 -1
  102. package/dist/esm/components/Select/SelectSimple.js +0 -31
  103. package/dist/esm/components/Select/SelectSimple.js.map +0 -1
  104. package/dist/js/components/Select/SelectSimple.d.ts.map +0 -1
  105. package/dist/js/components/Select/SelectSimple.js +0 -34
  106. package/dist/js/components/Select/SelectSimple.js.map +0 -1
  107. package/rollup.config.js +0 -7
  108. package/src/components/Select/__snapshots__/CheckboxSelectSnapshots.test.tsx.snap +0 -212
  109. package/src/components/Select/examples/SelectSimpleDemo.tsx +0 -26
@@ -0,0 +1,408 @@
1
+ import * as React from 'react';
2
+ import { render, screen, waitForElementToBeRemoved } from '@testing-library/react';
3
+ import userEvent from '@testing-library/user-event';
4
+ import { TypeaheadSelect } from '../TypeaheadSelect';
5
+ import styles from '@patternfly/react-styles/css/components/Menu/menu';
6
+
7
+ test('renders typeahead select with options', async () => {
8
+ const initialOptions = [
9
+ { content: 'Option 1', value: 'option1' },
10
+ { content: 'Option 2', value: 'option2' },
11
+ { content: 'Option 3', value: 'option3' }
12
+ ];
13
+
14
+ const user = userEvent.setup();
15
+
16
+ render(<TypeaheadSelect initialOptions={initialOptions} />);
17
+
18
+ const toggle = screen.getByRole('button', { name: 'Typeahead menu toggle' });
19
+
20
+ await user.click(toggle);
21
+
22
+ const option1 = screen.getByText('Option 1');
23
+ const option2 = screen.getByText('Option 2');
24
+ const option3 = screen.getByText('Option 3');
25
+
26
+ expect(option1).toBeInTheDocument();
27
+ expect(option2).toBeInTheDocument();
28
+ expect(option3).toBeInTheDocument();
29
+ });
30
+
31
+ test('selects options when clicked', async () => {
32
+ const initialOptions = [
33
+ { content: 'Option 1', value: 'option1' },
34
+ { content: 'Option 2', value: 'option2' },
35
+ { content: 'Option 3', value: 'option3' }
36
+ ];
37
+
38
+ const user = userEvent.setup();
39
+
40
+ render(<TypeaheadSelect initialOptions={initialOptions} />);
41
+
42
+ const toggle = screen.getByRole('button', { name: 'Typeahead menu toggle' });
43
+
44
+ await user.click(toggle);
45
+
46
+ const option1 = screen.getByRole('option', { name: 'Option 1' });
47
+
48
+ expect(option1).not.toHaveClass(styles.modifiers.selected);
49
+
50
+ await user.click(option1);
51
+
52
+ expect(option1).toHaveClass(styles.modifiers.selected);
53
+ });
54
+
55
+ test('calls the onSelect callback with the selected value when an option is selected', async () => {
56
+ const initialOptions = [
57
+ { content: 'Option 1', value: 'option1' },
58
+ { content: 'Option 2', value: 'option2' },
59
+ { content: 'Option 3', value: 'option3' }
60
+ ];
61
+
62
+ const user = userEvent.setup();
63
+ const onSelectMock = jest.fn();
64
+
65
+ render(<TypeaheadSelect initialOptions={initialOptions} onSelect={onSelectMock} />);
66
+
67
+ const toggle = screen.getByRole('button', { name: 'Typeahead menu toggle' });
68
+
69
+ await user.click(toggle);
70
+
71
+ expect(onSelectMock).not.toHaveBeenCalled();
72
+
73
+ const option1 = screen.getByRole('option', { name: 'Option 1' });
74
+
75
+ await user.click(option1);
76
+
77
+ expect(onSelectMock).toHaveBeenCalledTimes(1);
78
+ expect(onSelectMock).toHaveBeenCalledWith(expect.anything(), 'option1');
79
+ });
80
+
81
+ test('deselects options when clear button is clicked', async () => {
82
+ const initialOptions = [
83
+ { content: 'Option 1', value: 'option1' },
84
+ { content: 'Option 2', value: 'option2' },
85
+ { content: 'Option 3', value: 'option3' }
86
+ ];
87
+
88
+ const user = userEvent.setup();
89
+
90
+ render(<TypeaheadSelect initialOptions={initialOptions} />);
91
+
92
+ const toggle = screen.getByRole('button', { name: 'Typeahead menu toggle' });
93
+
94
+ await user.click(toggle);
95
+
96
+ const option1 = screen.getByRole('option', { name: 'Option 1' });
97
+ await user.click(option1);
98
+ expect(option1).toHaveClass(styles.modifiers.selected);
99
+
100
+ const input = screen.getByRole('combobox');
101
+ expect(input).toHaveValue('Option 1');
102
+
103
+ const clearButton = screen.getByRole('button', { name: 'Clear input value' });
104
+ await user.click(clearButton);
105
+ expect(input).toHaveValue('');
106
+
107
+ await user.click(toggle);
108
+ expect(screen.getByRole('option', { name: 'Option 1' })).not.toHaveClass(styles.modifiers.selected);
109
+ });
110
+
111
+ test('toggles the select menu when the toggle button is clicked', async () => {
112
+ const initialOptions = [
113
+ { content: 'Option 1', value: 'option1' },
114
+ { content: 'Option 2', value: 'option2' },
115
+ { content: 'Option 3', value: 'option3' }
116
+ ];
117
+
118
+ const user = userEvent.setup();
119
+
120
+ render(<TypeaheadSelect initialOptions={initialOptions} />);
121
+
122
+ const toggle = screen.getByRole('button', { name: 'Typeahead menu toggle' });
123
+
124
+ await user.click(toggle);
125
+
126
+ const menu = screen.getByRole('listbox');
127
+ expect(menu).toBeInTheDocument();
128
+
129
+ await user.click(toggle);
130
+
131
+ await waitForElementToBeRemoved(menu);
132
+
133
+ expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
134
+ });
135
+
136
+ test('calls the onToggle callback when the toggle is clicked', async () => {
137
+ const initialOptions = [
138
+ { content: 'Option 1', value: 'option1' },
139
+ { content: 'Option 2', value: 'option2' },
140
+ { content: 'Option 3', value: 'option3' }
141
+ ];
142
+
143
+ const user = userEvent.setup();
144
+ const onToggleMock = jest.fn();
145
+
146
+ render(<TypeaheadSelect initialOptions={initialOptions} onToggle={onToggleMock} />);
147
+
148
+ const toggle = screen.getByRole('button', { name: 'Typeahead menu toggle' });
149
+
150
+ expect(onToggleMock).not.toHaveBeenCalled();
151
+
152
+ await user.click(toggle);
153
+
154
+ expect(onToggleMock).toHaveBeenCalledTimes(1);
155
+ expect(onToggleMock).toHaveBeenCalledWith(true);
156
+
157
+ await user.click(toggle);
158
+
159
+ expect(onToggleMock).toHaveBeenCalledTimes(2);
160
+ expect(onToggleMock).toHaveBeenCalledWith(false);
161
+ });
162
+
163
+ test('Passes toggleWidth', () => {
164
+ const initialOptions = [
165
+ { content: 'Option 1', value: 'option1' },
166
+ { content: 'Option 2', value: 'option2' },
167
+ { content: 'Option 3', value: 'option3' }
168
+ ];
169
+
170
+ render(<TypeaheadSelect initialOptions={initialOptions} toggleWidth="500px" />);
171
+
172
+ const toggle = screen.getByRole('button', { name: 'Typeahead menu toggle' });
173
+ expect(toggle.parentElement).toHaveAttribute('style', 'width: 500px;');
174
+ });
175
+
176
+ test('Passes additional toggleProps', () => {
177
+ const initialOptions = [
178
+ { content: 'Option 1', value: 'option1' },
179
+ { content: 'Option 2', value: 'option2' },
180
+ { content: 'Option 3', value: 'option3' }
181
+ ];
182
+
183
+ render(<TypeaheadSelect initialOptions={initialOptions} toggleProps={{ id: 'toggle' }} />);
184
+
185
+ const toggle = screen.getByRole('button', { name: 'Typeahead menu toggle' });
186
+ expect(toggle.parentElement).toHaveAttribute('id', 'toggle');
187
+ });
188
+
189
+ test('passes custom placeholder text', async () => {
190
+ const initialOptions = [
191
+ { content: 'Option 1', value: 'option1' },
192
+ { content: 'Option 2', value: 'option2' },
193
+ { content: 'Option 3', value: 'option3' }
194
+ ];
195
+
196
+ render(<TypeaheadSelect initialOptions={initialOptions} placeholder="custom" />);
197
+
198
+ const input = screen.getByRole('combobox');
199
+
200
+ expect(input).toHaveAttribute('placeholder', 'custom');
201
+ });
202
+
203
+ test('displays noOptionsFoundMessage when filter returns no results', async () => {
204
+ const initialOptions = [
205
+ { content: 'Option 1', value: 'option1' },
206
+ { content: 'Option 2', value: 'option2' },
207
+ { content: 'Option 3', value: 'option3' }
208
+ ];
209
+ const user = userEvent.setup();
210
+
211
+ render(<TypeaheadSelect initialOptions={initialOptions} />);
212
+
213
+ const toggle = screen.getByRole('button', { name: 'Typeahead menu toggle' });
214
+ const input = screen.getByRole('combobox');
215
+
216
+ expect(input).toHaveAttribute('placeholder', 'Select an option');
217
+
218
+ await user.click(toggle);
219
+
220
+ const option1 = screen.getByRole('option', { name: 'Option 1' });
221
+ const option2 = screen.getByRole('option', { name: 'Option 2' });
222
+ const option3 = screen.getByRole('option', { name: 'Option 3' });
223
+
224
+ expect(option1).toBeInTheDocument();
225
+ expect(option2).toBeInTheDocument();
226
+ expect(option3).toBeInTheDocument();
227
+
228
+ await user.type(input, '9');
229
+ expect(input).toHaveValue('9');
230
+
231
+ expect(option1).not.toBeInTheDocument();
232
+ expect(option2).not.toBeInTheDocument();
233
+ expect(option3).not.toBeInTheDocument();
234
+ expect(screen.getByRole('option', { name: 'No results found for "9"' })).toBeInTheDocument();
235
+ });
236
+
237
+ test('displays custom noOptionsFoundMessage', async () => {
238
+ const initialOptions = [
239
+ { content: 'Option 1', value: 'option1' },
240
+ { content: 'Option 2', value: 'option2' },
241
+ { content: 'Option 3', value: 'option3' }
242
+ ];
243
+ const user = userEvent.setup();
244
+
245
+ render(<TypeaheadSelect initialOptions={initialOptions} noOptionsFoundMessage="custom" />);
246
+
247
+ const toggle = screen.getByRole('button', { name: 'Typeahead menu toggle' });
248
+ const input = screen.getByRole('combobox');
249
+
250
+ expect(input).toHaveAttribute('placeholder', 'Select an option');
251
+
252
+ await user.click(toggle);
253
+
254
+ const option1 = screen.getByRole('option', { name: 'Option 1' });
255
+ const option2 = screen.getByRole('option', { name: 'Option 2' });
256
+ const option3 = screen.getByRole('option', { name: 'Option 3' });
257
+
258
+ expect(option1).toBeInTheDocument();
259
+ expect(option2).toBeInTheDocument();
260
+ expect(option3).toBeInTheDocument();
261
+
262
+ await user.type(input, '9');
263
+ expect(input).toHaveValue('9');
264
+
265
+ expect(option1).not.toBeInTheDocument();
266
+ expect(option2).not.toBeInTheDocument();
267
+ expect(option3).not.toBeInTheDocument();
268
+ expect(screen.getByRole('option', { name: 'custom' })).toBeInTheDocument();
269
+ });
270
+
271
+ test('disables the select when isDisabled prop is true', async () => {
272
+ const initialOptions = [
273
+ { content: 'Option 1', value: 'option1' },
274
+ { content: 'Option 2', value: 'option2' },
275
+ { content: 'Option 3', value: 'option3' }
276
+ ];
277
+
278
+ const user = userEvent.setup();
279
+
280
+ render(<TypeaheadSelect initialOptions={initialOptions} isDisabled={true} />);
281
+
282
+ const toggle = screen.getByRole('button', { name: 'Typeahead menu toggle' });
283
+
284
+ expect(toggle.parentElement).toHaveClass(styles.modifiers.disabled);
285
+
286
+ await user.click(toggle);
287
+
288
+ expect(screen.queryByRole('menu')).not.toBeInTheDocument();
289
+ });
290
+
291
+ test('passes other SelectOption props to the SelectOption component', async () => {
292
+ const initialOptions = [{ content: 'Option 1', value: 'option1', isDisabled: true }];
293
+
294
+ const user = userEvent.setup();
295
+
296
+ render(<TypeaheadSelect initialOptions={initialOptions} />);
297
+
298
+ const toggle = screen.getByRole('button', { name: 'Typeahead menu toggle' });
299
+
300
+ await user.click(toggle);
301
+
302
+ const option1 = screen.getByRole('option', { name: 'Option 1' });
303
+ expect(option1).toBeDisabled();
304
+ });
305
+
306
+ test('displays the option in input when option is selected', async () => {
307
+ const initialOptions = [
308
+ { content: 'Option 1', value: 'option1' },
309
+ { content: 'Option 2', value: 'option2' },
310
+ { content: 'Option 3', value: 'option3' }
311
+ ];
312
+
313
+ const user = userEvent.setup();
314
+
315
+ render(<TypeaheadSelect initialOptions={initialOptions} />);
316
+
317
+ const toggle = screen.getByRole('button', { name: 'Typeahead menu toggle' });
318
+ const input = screen.getByRole('combobox');
319
+
320
+ expect(input).toHaveAttribute('placeholder', 'Select an option');
321
+
322
+ await user.click(toggle);
323
+
324
+ const option1 = screen.getByRole('option', { name: 'Option 1' });
325
+
326
+ await user.click(option1);
327
+
328
+ expect(input).toHaveValue('Option 1');
329
+
330
+ const clearButton = screen.getByRole('button', { name: 'Clear input value' });
331
+ await user.click(clearButton);
332
+
333
+ expect(input).toHaveValue('');
334
+ });
335
+
336
+ test('typing in input filters options', async () => {
337
+ const initialOptions = [
338
+ { content: 'Option 1', value: 'option1' },
339
+ { content: 'Option 2', value: 'option2' },
340
+ { content: 'Option 3', value: 'option3' }
341
+ ];
342
+
343
+ const user = userEvent.setup();
344
+
345
+ render(<TypeaheadSelect initialOptions={initialOptions} />);
346
+
347
+ const toggle = screen.getByRole('button', { name: 'Typeahead menu toggle' });
348
+ const input = screen.getByRole('combobox');
349
+
350
+ expect(input).toHaveAttribute('placeholder', 'Select an option');
351
+
352
+ await user.click(toggle);
353
+
354
+ const option1 = screen.getByRole('option', { name: 'Option 1' });
355
+ const option2 = screen.getByRole('option', { name: 'Option 2' });
356
+ const option3 = screen.getByRole('option', { name: 'Option 3' });
357
+
358
+ expect(option1).toBeInTheDocument();
359
+ expect(option2).toBeInTheDocument();
360
+ expect(option3).toBeInTheDocument();
361
+
362
+ await user.type(input, '1');
363
+ expect(input).toHaveValue('1');
364
+
365
+ expect(option1).toBeInTheDocument();
366
+ expect(option2).not.toBeInTheDocument();
367
+ expect(option3).not.toBeInTheDocument();
368
+ });
369
+
370
+ test('typing in input triggers onInputChange callback', async () => {
371
+ const initialOptions = [
372
+ { content: 'Option 1', value: 'option1' },
373
+ { content: 'Option 2', value: 'option2' },
374
+ { content: 'Option 3', value: 'option3' }
375
+ ];
376
+
377
+ const user = userEvent.setup();
378
+ const onInputChangeMock = jest.fn();
379
+
380
+ render(<TypeaheadSelect initialOptions={initialOptions} onInputChange={onInputChangeMock} />);
381
+
382
+ const input = screen.getByRole('combobox');
383
+
384
+ expect(input).toHaveAttribute('placeholder', 'Select an option');
385
+
386
+ await user.type(input, '1');
387
+
388
+ expect(input).toHaveValue('1');
389
+ expect(onInputChangeMock).toHaveBeenCalledTimes(1);
390
+ expect(onInputChangeMock).toHaveBeenCalledWith('1');
391
+ });
392
+
393
+ test('Matches snapshot', async () => {
394
+ const initialOptions = [
395
+ { content: 'Option 1', value: 'option1' },
396
+ { content: 'Option 2', value: 'option2' },
397
+ { content: 'Option 3', value: 'option3' }
398
+ ];
399
+
400
+ const user = userEvent.setup();
401
+
402
+ const { asFragment } = render(<TypeaheadSelect initialOptions={initialOptions} />);
403
+
404
+ const toggle = screen.getByRole('button', { name: 'Typeahead menu toggle' });
405
+ await user.click(toggle);
406
+
407
+ expect(asFragment()).toMatchSnapshot();
408
+ });
@@ -0,0 +1,83 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`checkbox select with no props snapshot 1`] = `
4
+ <DocumentFragment>
5
+ <button
6
+ aria-expanded="false"
7
+ class="pf-v6-c-menu-toggle"
8
+ data-ouia-component-id="OUIA-Generated-MenuToggle-1"
9
+ data-ouia-component-type="PF6/MenuToggle"
10
+ data-ouia-safe="true"
11
+ style="width: 200px;"
12
+ type="button"
13
+ >
14
+ <span
15
+ class="pf-v6-c-menu-toggle__text"
16
+ >
17
+ Filter by status
18
+ </span>
19
+ <span
20
+ class="pf-v6-c-menu-toggle__controls"
21
+ >
22
+ <span
23
+ class="pf-v6-c-menu-toggle__toggle-icon"
24
+ >
25
+ <svg
26
+ aria-hidden="true"
27
+ class="pf-v6-svg"
28
+ fill="currentColor"
29
+ height="1em"
30
+ role="img"
31
+ viewBox="0 0 320 512"
32
+ width="1em"
33
+ >
34
+ <path
35
+ d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"
36
+ />
37
+ </svg>
38
+ </span>
39
+ </span>
40
+ </button>
41
+ </DocumentFragment>
42
+ `;
43
+
44
+ exports[`opened checkbox select snapshot 1`] = `
45
+ <DocumentFragment>
46
+ <button
47
+ aria-expanded="true"
48
+ class="pf-v6-c-menu-toggle pf-m-expanded"
49
+ data-ouia-component-id="OUIA-Generated-MenuToggle-2"
50
+ data-ouia-component-type="PF6/MenuToggle"
51
+ data-ouia-safe="true"
52
+ style="width: 200px;"
53
+ type="button"
54
+ >
55
+ <span
56
+ class="pf-v6-c-menu-toggle__text"
57
+ >
58
+ Filter by status
59
+ </span>
60
+ <span
61
+ class="pf-v6-c-menu-toggle__controls"
62
+ >
63
+ <span
64
+ class="pf-v6-c-menu-toggle__toggle-icon"
65
+ >
66
+ <svg
67
+ aria-hidden="true"
68
+ class="pf-v6-svg"
69
+ fill="currentColor"
70
+ height="1em"
71
+ role="img"
72
+ viewBox="0 0 320 512"
73
+ width="1em"
74
+ >
75
+ <path
76
+ d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"
77
+ />
78
+ </svg>
79
+ </span>
80
+ </span>
81
+ </button>
82
+ </DocumentFragment>
83
+ `;
@@ -0,0 +1,97 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`MultiTypeaheadSelect Matches snapshot 1`] = `
4
+ <DocumentFragment>
5
+ <div
6
+ class="pf-v6-c-menu-toggle pf-m-expanded pf-m-full-width pf-m-typeahead"
7
+ >
8
+ <div
9
+ class="pf-v6-c-text-input-group pf-m-plain"
10
+ >
11
+ <div
12
+ autocomplete="off"
13
+ class="pf-v6-c-text-input-group__main"
14
+ >
15
+ <span
16
+ class="pf-v6-c-text-input-group__text"
17
+ >
18
+ <input
19
+ aria-controls="select-typeahead-listbox"
20
+ aria-expanded="true"
21
+ aria-label="Type to filter"
22
+ class="pf-v6-c-text-input-group__text-input"
23
+ placeholder="Select an option"
24
+ role="combobox"
25
+ type="text"
26
+ value=""
27
+ />
28
+ </span>
29
+ </div>
30
+ <div
31
+ class="pf-v6-c-text-input-group__utilities"
32
+ style="display: none;"
33
+ >
34
+ <button
35
+ aria-disabled="false"
36
+ aria-label="Clear input value"
37
+ class="pf-v6-c-button pf-m-plain"
38
+ data-ouia-component-id="OUIA-Generated-Button-plain-17"
39
+ data-ouia-component-type="PF6/Button"
40
+ data-ouia-safe="true"
41
+ type="button"
42
+ >
43
+ <span
44
+ class="pf-v6-c-button__text"
45
+ >
46
+ <svg
47
+ aria-hidden="true"
48
+ class="pf-v6-svg"
49
+ fill="currentColor"
50
+ height="1em"
51
+ role="img"
52
+ viewBox="0 0 352 512"
53
+ width="1em"
54
+ >
55
+ <path
56
+ d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"
57
+ />
58
+ </svg>
59
+ </span>
60
+ </button>
61
+ </div>
62
+ </div>
63
+ <button
64
+ aria-expanded="true"
65
+ aria-label="Multi select Typeahead menu toggle"
66
+ class="pf-v6-c-menu-toggle__button"
67
+ data-ouia-component-id="OUIA-Generated-MenuToggle-typeahead-17"
68
+ data-ouia-component-type="PF6/MenuToggle"
69
+ data-ouia-safe="true"
70
+ tabindex="-1"
71
+ type="button"
72
+ >
73
+ <span
74
+ class="pf-v6-c-menu-toggle__controls"
75
+ >
76
+ <span
77
+ class="pf-v6-c-menu-toggle__toggle-icon"
78
+ >
79
+ <svg
80
+ aria-hidden="true"
81
+ class="pf-v6-svg"
82
+ fill="currentColor"
83
+ height="1em"
84
+ role="img"
85
+ viewBox="0 0 320 512"
86
+ width="1em"
87
+ >
88
+ <path
89
+ d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"
90
+ />
91
+ </svg>
92
+ </span>
93
+ </span>
94
+ </button>
95
+ </div>
96
+ </DocumentFragment>
97
+ `;
@@ -0,0 +1,83 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Matches snapshot 1`] = `
4
+ <DocumentFragment>
5
+ <button
6
+ aria-expanded="true"
7
+ class="pf-v6-c-menu-toggle pf-m-expanded"
8
+ data-ouia-component-id="OUIA-Generated-MenuToggle-13"
9
+ data-ouia-component-type="PF6/MenuToggle"
10
+ data-ouia-safe="true"
11
+ style="width: 200px;"
12
+ type="button"
13
+ >
14
+ <span
15
+ class="pf-v6-c-menu-toggle__text"
16
+ >
17
+ Select
18
+ </span>
19
+ <span
20
+ class="pf-v6-c-menu-toggle__controls"
21
+ >
22
+ <span
23
+ class="pf-v6-c-menu-toggle__toggle-icon"
24
+ >
25
+ <svg
26
+ aria-hidden="true"
27
+ class="pf-v6-svg"
28
+ fill="currentColor"
29
+ height="1em"
30
+ role="img"
31
+ viewBox="0 0 320 512"
32
+ width="1em"
33
+ >
34
+ <path
35
+ d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"
36
+ />
37
+ </svg>
38
+ </span>
39
+ </span>
40
+ </button>
41
+ </DocumentFragment>
42
+ `;
43
+
44
+ exports[`checkbox select with no props snapshot 1`] = `
45
+ <DocumentFragment>
46
+ <button
47
+ aria-expanded="false"
48
+ class="pf-v6-c-menu-toggle"
49
+ data-ouia-component-id="OUIA-Generated-MenuToggle-12"
50
+ data-ouia-component-type="PF6/MenuToggle"
51
+ data-ouia-safe="true"
52
+ style="width: 200px;"
53
+ type="button"
54
+ >
55
+ <span
56
+ class="pf-v6-c-menu-toggle__text"
57
+ >
58
+ Select a value
59
+ </span>
60
+ <span
61
+ class="pf-v6-c-menu-toggle__controls"
62
+ >
63
+ <span
64
+ class="pf-v6-c-menu-toggle__toggle-icon"
65
+ >
66
+ <svg
67
+ aria-hidden="true"
68
+ class="pf-v6-svg"
69
+ fill="currentColor"
70
+ height="1em"
71
+ role="img"
72
+ viewBox="0 0 320 512"
73
+ width="1em"
74
+ >
75
+ <path
76
+ d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"
77
+ />
78
+ </svg>
79
+ </span>
80
+ </span>
81
+ </button>
82
+ </DocumentFragment>
83
+ `;