@patternfly/react-core 4.199.5 → 4.200.2

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 (97) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/esm/components/Avatar/Avatar.d.ts +2 -0
  3. package/dist/esm/components/Avatar/Avatar.d.ts.map +1 -1
  4. package/dist/esm/components/Avatar/Avatar.js +2 -2
  5. package/dist/esm/components/Avatar/Avatar.js.map +1 -1
  6. package/dist/esm/components/FormSelect/FormSelect.d.ts +2 -0
  7. package/dist/esm/components/FormSelect/FormSelect.d.ts.map +1 -1
  8. package/dist/esm/components/FormSelect/FormSelect.js +3 -2
  9. package/dist/esm/components/FormSelect/FormSelect.js.map +1 -1
  10. package/dist/esm/components/TextArea/TextArea.d.ts +2 -0
  11. package/dist/esm/components/TextArea/TextArea.d.ts.map +1 -1
  12. package/dist/esm/components/TextArea/TextArea.js +4 -3
  13. package/dist/esm/components/TextArea/TextArea.js.map +1 -1
  14. package/dist/esm/components/TextInput/TextInput.d.ts +2 -0
  15. package/dist/esm/components/TextInput/TextInput.d.ts.map +1 -1
  16. package/dist/esm/components/TextInput/TextInput.js +3 -2
  17. package/dist/esm/components/TextInput/TextInput.js.map +1 -1
  18. package/dist/js/components/Avatar/Avatar.d.ts +2 -0
  19. package/dist/js/components/Avatar/Avatar.d.ts.map +1 -1
  20. package/dist/js/components/Avatar/Avatar.js +2 -2
  21. package/dist/js/components/Avatar/Avatar.js.map +1 -1
  22. package/dist/js/components/FormSelect/FormSelect.d.ts +2 -0
  23. package/dist/js/components/FormSelect/FormSelect.d.ts.map +1 -1
  24. package/dist/js/components/FormSelect/FormSelect.js +3 -2
  25. package/dist/js/components/FormSelect/FormSelect.js.map +1 -1
  26. package/dist/js/components/TextArea/TextArea.d.ts +2 -0
  27. package/dist/js/components/TextArea/TextArea.d.ts.map +1 -1
  28. package/dist/js/components/TextArea/TextArea.js +4 -3
  29. package/dist/js/components/TextArea/TextArea.js.map +1 -1
  30. package/dist/js/components/TextInput/TextInput.d.ts +2 -0
  31. package/dist/js/components/TextInput/TextInput.d.ts.map +1 -1
  32. package/dist/js/components/TextInput/TextInput.js +3 -2
  33. package/dist/js/components/TextInput/TextInput.js.map +1 -1
  34. package/dist/umd/react-core.js +12 -9
  35. package/dist/umd/react-core.min.js +2 -2
  36. package/package.json +5 -5
  37. package/src/components/Avatar/Avatar.tsx +4 -0
  38. package/src/components/Avatar/examples/Avatar.md +33 -4
  39. package/src/components/ChipGroup/__tests__/ChipGroup.test.tsx +14 -9
  40. package/src/components/ClipboardCopy/__tests__/ClipboardCopyToggle.test.tsx +28 -19
  41. package/src/components/ClipboardCopy/__tests__/__snapshots__/ClipboardCopyToggle.test.tsx.snap +1 -1
  42. package/src/components/ContextSelector/__tests__/ContextSelector.test.tsx +21 -14
  43. package/src/components/ContextSelector/__tests__/ContextSelectorToggle.test.tsx +49 -34
  44. package/src/components/ContextSelector/__tests__/__snapshots__/ContextSelector.test.tsx.snap +2 -169
  45. package/src/components/ContextSelector/__tests__/__snapshots__/ContextSelectorToggle.test.tsx.snap +5 -247
  46. package/src/components/DataList/__tests__/DataList.test.tsx +49 -40
  47. package/src/components/DataList/__tests__/__snapshots__/DataList.test.tsx.snap +1 -9
  48. package/src/components/Dropdown/__tests__/Dropdown.test.tsx +54 -42
  49. package/src/components/Dropdown/__tests__/DropdownToggle.test.tsx +179 -177
  50. package/src/components/Dropdown/__tests__/DropdownToggleCheckbox.test.tsx +51 -55
  51. package/src/components/Dropdown/__tests__/Generated/DropdownItem.test.tsx +28 -26
  52. package/src/components/Dropdown/__tests__/Generated/DropdownSeparator.test.tsx +14 -15
  53. package/src/components/Dropdown/__tests__/Generated/InternalDropdownItem.test.tsx +39 -36
  54. package/src/components/Dropdown/__tests__/Generated/__snapshots__/DropdownItem.test.tsx.snap +6 -4
  55. package/src/components/Dropdown/__tests__/Generated/__snapshots__/DropdownSeparator.test.tsx.snap +11 -4
  56. package/src/components/Dropdown/__tests__/Generated/__snapshots__/InternalDropdownItem.test.tsx.snap +7 -4
  57. package/src/components/Dropdown/__tests__/InternalDropdownItem.test.tsx +66 -69
  58. package/src/components/Dropdown/__tests__/__snapshots__/Dropdown.test.tsx.snap +15 -816
  59. package/src/components/Dropdown/__tests__/__snapshots__/DropdownToggle.test.tsx.snap +9 -454
  60. package/src/components/Dropdown/__tests__/__snapshots__/DropdownToggleCheckbox.test.tsx.snap +7 -141
  61. package/src/components/Dropdown/__tests__/__snapshots__/InternalDropdownItem.test.tsx.snap +10 -163
  62. package/src/components/FormSelect/FormSelect.tsx +16 -1
  63. package/src/components/FormSelect/examples/FormSelect.md +58 -0
  64. package/src/components/Nav/__tests__/Generated/NavList.test.tsx +28 -18
  65. package/src/components/Nav/__tests__/Generated/__snapshots__/NavList.test.tsx.snap +8 -4
  66. package/src/components/OptionsMenu/__tests__/Generated/OptionsMenuItem.test.tsx +21 -19
  67. package/src/components/OptionsMenu/__tests__/Generated/__snapshots__/OptionsMenuItem.test.tsx.snap +20 -11
  68. package/src/components/OverflowMenu/__tests__/Generated/OverflowMenuDropdownItem.test.tsx +14 -10
  69. package/src/components/OverflowMenu/__tests__/Generated/__snapshots__/OverflowMenuDropdownItem.test.tsx.snap +18 -4
  70. package/src/components/Select/__tests__/Generated/SelectGroup.test.tsx +22 -10
  71. package/src/components/Select/__tests__/Generated/SelectMenu.test.tsx +22 -26
  72. package/src/components/Select/__tests__/Generated/__snapshots__/SelectGroup.test.tsx.snap +15 -4
  73. package/src/components/Select/__tests__/Generated/__snapshots__/SelectMenu.test.tsx.snap +7 -19
  74. package/src/components/Select/__tests__/SelectGroup.test.tsx +14 -7
  75. package/src/components/Select/__tests__/SelectOption.test.tsx +51 -30
  76. package/src/components/Select/__tests__/__snapshots__/SelectGroup.test.tsx.snap +1 -5
  77. package/src/components/Select/__tests__/__snapshots__/SelectOption.test.tsx.snap +10 -272
  78. package/src/components/TextArea/TextArea.tsx +5 -0
  79. package/src/components/TextArea/__tests__/__snapshots__/TextArea.test.tsx.snap +2 -0
  80. package/src/components/TextArea/examples/TextArea.md +43 -0
  81. package/src/components/TextInput/TextInput.tsx +5 -0
  82. package/src/components/TextInput/__tests__/__snapshots__/TextInput.test.tsx.snap +2 -0
  83. package/src/components/TextInput/examples/TextInput.md +104 -27
  84. package/src/components/Toolbar/__tests__/Generated/ToolbarToggleGroup.test.tsx +25 -11
  85. package/src/components/Toolbar/__tests__/Generated/__snapshots__/ToolbarToggleGroup.test.tsx.snap +26 -4
  86. package/src/components/Toolbar/__tests__/Toolbar.test.tsx +129 -0
  87. package/src/components/Toolbar/__tests__/ToolbarItem.test.tsx +19 -0
  88. package/src/components/Toolbar/__tests__/ToolbarToggleGroup.test.tsx +12 -135
  89. package/src/components/Toolbar/__tests__/__snapshots__/Toolbar.test.tsx.snap +7 -0
  90. package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.test.tsx.snap +3 -0
  91. package/src/components/Tooltip/examples/Tooltip.md +9 -1
  92. package/src/components/Tooltip/examples/TooltipExamples.css +4 -4
  93. package/src/components/Select/__tests__/Generated/SelectOption.test.tsx +0 -29
  94. package/src/components/Select/__tests__/Generated/__snapshots__/SelectOption.test.tsx.snap +0 -7
  95. package/src/components/Toolbar/__tests__/__snapshots__/ToolbarToggleGroup.test.tsx.snap +0 -516
  96. package/src/components/Wizard/__tests__/Generated/Wizard.test.tsx +0 -43
  97. package/src/components/Wizard/__tests__/Generated/__snapshots__/Wizard.test.tsx.snap +0 -69
@@ -1,174 +1,21 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`dropdown items a 1`] = `
4
- <div>
5
- <li
6
- role="none"
7
- >
8
- <a
9
- class=""
10
- >
11
- Something
12
- </a>
13
- </li>
14
- </div>
15
- `;
3
+ exports[`InternalDropdownItem dropdown items a 1`] = `"<a class=\\"\\">Something</a>"`;
16
4
 
17
- exports[`dropdown items aria-disabled a 1`] = `
18
- <div>
19
- <li
20
- role="none"
21
- >
22
- <a
23
- aria-disabled="true"
24
- class="pf-m-aria-disabled"
25
- >
26
- Something
27
- </a>
28
- </li>
29
- </div>
30
- `;
5
+ exports[`InternalDropdownItem dropdown items aria-disabled a 1`] = `"<a aria-disabled=\\"true\\" class=\\"pf-m-aria-disabled\\">Something</a>"`;
31
6
 
32
- exports[`dropdown items aria-disabled button 1`] = `
33
- <div>
34
- <li
35
- role="none"
36
- >
37
- <button
38
- aria-disabled="true"
39
- class="pf-m-aria-disabled"
40
- type="button"
41
- >
42
- Something
43
- </button>
44
- </li>
45
- </div>
46
- `;
7
+ exports[`InternalDropdownItem dropdown items aria-disabled button 1`] = `"<button aria-disabled=\\"true\\" type=\\"button\\" class=\\"pf-m-aria-disabled\\">Something</button>"`;
47
8
 
48
- exports[`dropdown items button 1`] = `
49
- <div>
50
- <li
51
- role="none"
52
- >
53
- <button
54
- class=""
55
- type="button"
56
- >
57
- Something
58
- </button>
59
- </li>
60
- </div>
61
- `;
9
+ exports[`InternalDropdownItem dropdown items button 1`] = `"<button type=\\"button\\" class=\\"\\">Something</button>"`;
62
10
 
63
- exports[`dropdown items description a 1`] = `
64
- <div>
65
- <li
66
- role="none"
67
- >
68
- <a
69
- class="pf-m-description"
70
- >
71
- <div
72
- class="pf-c-dropdown__menu-item-main"
73
- >
74
- Something
75
- </div>
76
- <div
77
- class="pf-c-dropdown__menu-item-description"
78
- >
79
- Something's link description
80
- </div>
81
- </a>
82
- </li>
83
- </div>
84
- `;
11
+ exports[`InternalDropdownItem dropdown items description a 1`] = `"<div class=\\"pf-c-dropdown__menu-item-description\\">Something's link description</div>"`;
85
12
 
86
- exports[`dropdown items description button 1`] = `
87
- <div>
88
- <li
89
- role="none"
90
- >
91
- <button
92
- class="pf-m-description"
93
- type="button"
94
- >
95
- <div
96
- class="pf-c-dropdown__menu-item-main"
97
- >
98
- Something
99
- </div>
100
- <div
101
- class="pf-c-dropdown__menu-item-description"
102
- >
103
- Something's button description
104
- </div>
105
- </button>
106
- </li>
107
- </div>
108
- `;
13
+ exports[`InternalDropdownItem dropdown items description button 1`] = `"<div class=\\"pf-c-dropdown__menu-item-description\\">Something's button description</div>"`;
109
14
 
110
- exports[`dropdown items disabled a 1`] = `
111
- <div>
112
- <li
113
- role="none"
114
- >
115
- <a
116
- aria-disabled="true"
117
- class=""
118
- >
119
- Something
120
- </a>
121
- </li>
122
- </div>
123
- `;
15
+ exports[`InternalDropdownItem dropdown items disabled a 1`] = `"<a aria-disabled=\\"true\\" class=\\"\\">Something</a>"`;
124
16
 
125
- exports[`dropdown items disabled button 1`] = `
126
- <div>
127
- <li
128
- role="none"
129
- >
130
- <button
131
- aria-disabled="true"
132
- class=""
133
- type="button"
134
- >
135
- Something
136
- </button>
137
- </li>
138
- </div>
139
- `;
17
+ exports[`InternalDropdownItem dropdown items disabled button 1`] = `"<button aria-disabled=\\"true\\" type=\\"button\\" class=\\"\\">Something</button>"`;
140
18
 
141
- exports[`dropdown items hover a 1`] = `
142
- <div>
143
- <li
144
- role="none"
145
- >
146
- <a
147
- class=""
148
- >
149
- Something
150
- </a>
151
- </li>
152
- </div>
153
- `;
19
+ exports[`InternalDropdownItem dropdown items hover a 1`] = `"<a class=\\"\\">Something</a>"`;
154
20
 
155
- exports[`dropdown items hover button 1`] = `
156
- <div>
157
- <li
158
- role="none"
159
- >
160
- <button
161
- class=""
162
- type="button"
163
- >
164
- Something
165
- </button>
166
- </li>
167
- </div>
168
- `;
169
-
170
- exports[`dropdown items separator 1`] = `
171
- <ContextConsumer>
172
- <Component />
173
- </ContextConsumer>
174
- `;
21
+ exports[`InternalDropdownItem dropdown items hover button 1`] = `"<button type=\\"button\\" class=\\"\\">Something</button>"`;
@@ -23,6 +23,8 @@ export interface FormSelectProps
23
23
  isDisabled?: boolean;
24
24
  /** Sets the FormSelect required. */
25
25
  isRequired?: boolean;
26
+ /** Use the external file instead of a data URI */
27
+ isIconSprite?: boolean;
26
28
  /** Optional callback for updating when selection loses focus */
27
29
  onBlur?: (event: React.FormEvent<HTMLSelectElement>) => void;
28
30
  /** Optional callback for updating when selection gets focus */
@@ -52,6 +54,7 @@ export class FormSelect extends React.Component<FormSelectProps, { ouiaStateId:
52
54
  validated: 'default',
53
55
  isDisabled: false,
54
56
  isRequired: false,
57
+ isIconSprite: false,
55
58
  onBlur: (): any => undefined,
56
59
  onFocus: (): any => undefined,
57
60
  onChange: (): any => undefined,
@@ -63,7 +66,18 @@ export class FormSelect extends React.Component<FormSelectProps, { ouiaStateId:
63
66
  };
64
67
 
65
68
  render() {
66
- const { children, className, value, validated, isDisabled, isRequired, ouiaId, ouiaSafe, ...props } = this.props;
69
+ const {
70
+ children,
71
+ className,
72
+ value,
73
+ validated,
74
+ isDisabled,
75
+ isRequired,
76
+ isIconSprite,
77
+ ouiaId,
78
+ ouiaSafe,
79
+ ...props
80
+ } = this.props;
67
81
  /* find selected option and get placeholder flag */
68
82
  const selectedOption = React.Children.toArray(children).find((option: any) => option.props.value === value) as any;
69
83
  const isSelectedPlaceholder = selectedOption && selectedOption.props.isPlaceholder;
@@ -72,6 +86,7 @@ export class FormSelect extends React.Component<FormSelectProps, { ouiaStateId:
72
86
  {...props}
73
87
  className={css(
74
88
  styles.formControl,
89
+ isIconSprite && styles.modifiers.iconSprite,
75
90
  className,
76
91
  validated === ValidatedOptions.success && styles.modifiers.success,
77
92
  validated === ValidatedOptions.warning && styles.modifiers.warning,
@@ -258,3 +258,61 @@ class FormSelectInputGrouped extends React.Component {
258
258
  }
259
259
  }
260
260
  ```
261
+
262
+ ### Icon sprite variant
263
+
264
+ **Note:** The dropdown toggle icon is applied as a background image to the form element. By default, the image URLs for these icons are data URIs. However, there may be cases where data URIs are not ideal, such as in an application with a content security policy that disallows data URIs for security reasons. The `isIconSprite` variation changes the icon source to an external SVG file that serves as a sprite for all of the supported icons.
265
+
266
+ ```js isBeta
267
+ import React from 'react';
268
+ import { FormSelect, FormSelectOption, FormSelectOptionGroup } from '@patternfly/react-core';
269
+
270
+ class FormSelectIconSpriteInput extends React.Component {
271
+ constructor(props) {
272
+ super(props);
273
+ this.state = {
274
+ value: '',
275
+ validated: ValidatedOptions.default
276
+ };
277
+
278
+ this.onChange = (value, event) => {
279
+ if (value === '3') {
280
+ this.setState({ value, validated: ValidatedOptions.success, helperText: 'You chose wisely' });
281
+ } else if (value === '') {
282
+ this.setState({ value, validated: ValidatedOptions.warning, helperText: 'You must select a value' });
283
+ } else {
284
+ this.setState({
285
+ value,
286
+ validated: ValidatedOptions.error,
287
+ invalidText: 'You must chose Three (thought that was obvious)'
288
+ });
289
+ }
290
+ };
291
+
292
+ this.options = [
293
+ { value: '', label: 'Select a number', disabled: false, isPlaceholder: true },
294
+ { value: '1', label: 'One', disabled: false, isPlaceholder: false },
295
+ { value: '2', label: 'Two', disabled: false, isPlaceholder: false },
296
+ { value: '3', label: 'Three - the only valid option', disabled: false, isPlaceholder: false }
297
+ ];
298
+ }
299
+
300
+ render() {
301
+ const { value, validated, helperText, invalidText } = this.state;
302
+
303
+ return (
304
+ <FormSelect
305
+ validated={validated}
306
+ isIconSprite
307
+ value={value}
308
+ onChange={this.onChange}
309
+ aria-label="FormSelect Input"
310
+ >
311
+ {this.options.map((option, index) => (
312
+ <FormSelectOption isDisabled={option.disabled} key={index} value={option.value} label={option.label} />
313
+ ))}
314
+ </FormSelect>
315
+ );
316
+ }
317
+ }
318
+ ```
@@ -1,21 +1,31 @@
1
- /**
2
- * This test was generated
3
- */
4
- import * as React from 'react';
5
- import { shallow } from 'enzyme';
1
+ import React from 'react';
2
+
3
+ import { render } from '@testing-library/react';
4
+ import * as ReactCoreUtils from '@patternfly/react-core/src/helpers/util';
5
+
6
6
  import { NavList } from '../../NavList';
7
- // any missing imports can usually be resolved by adding them here
8
- import {} from '../..';
7
+ import { NavContext } from '../../Nav';
8
+
9
+ describe('NavList', () => {
10
+ beforeAll(() => {
11
+ jest.spyOn(ReactCoreUtils, 'isElementInView').mockReturnValue(true);
12
+ });
9
13
 
10
- it('NavList should match snapshot (auto-generated)', () => {
11
- const view = shallow(
12
- <NavList
13
- children={<>ReactNode</>}
14
- className={"''"}
15
- variant={'default'}
16
- ariaLeftScroll={"'Scroll left'"}
17
- ariaRightScroll={"'Scroll right'"}
18
- />
19
- );
20
- expect(view).toMatchSnapshot();
14
+ it('should match snapshot', () => {
15
+ const view = render(
16
+ <NavContext.Provider
17
+ value={{
18
+ onSelect: jest.fn(),
19
+ onToggle: jest.fn(),
20
+ updateIsScrollable: jest.fn(),
21
+ isHorizontal: false,
22
+ flyoutRef: undefined,
23
+ setFlyoutRef: jest.fn()
24
+ }}
25
+ >
26
+ <NavList children={<>ReactNode</>} className="" ariaLeftScroll="Scroll left" ariaRightScroll="Scroll right" />
27
+ </NavContext.Provider>
28
+ );
29
+ expect(view.container).toMatchSnapshot();
30
+ });
21
31
  });
@@ -1,7 +1,11 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`NavList should match snapshot (auto-generated) 1`] = `
4
- <ContextConsumer>
5
- <Component />
6
- </ContextConsumer>
3
+ exports[`NavList should match snapshot 1`] = `
4
+ <div>
5
+ <ul
6
+ class="pf-c-nav__list"
7
+ >
8
+ ReactNode
9
+ </ul>
10
+ </div>
7
11
  `;
@@ -1,22 +1,24 @@
1
- /**
2
- * This test was generated
3
- */
4
- import * as React from 'react';
5
- import { shallow } from 'enzyme';
1
+ import React from 'react';
2
+
3
+ import { render } from '@testing-library/react';
4
+
6
5
  import { OptionsMenuItem } from '../../OptionsMenuItem';
7
- // any missing imports can usually be resolved by adding them here
8
- import {} from '../..';
6
+ import { DropdownArrowContext } from '../../../Dropdown';
9
7
 
10
- it('OptionsMenuItem should match snapshot (auto-generated)', () => {
11
- const view = shallow(
12
- <OptionsMenuItem
13
- children={<>ReactNode</>}
14
- className={'string'}
15
- isSelected={false}
16
- isDisabled={true}
17
- onSelect={() => null as any}
18
- id={"''"}
19
- />
20
- );
21
- expect(view).toMatchSnapshot();
8
+ describe('OptionsMenuItem', () => {
9
+ it('should match snapshot', () => {
10
+ const view = render(
11
+ <DropdownArrowContext.Provider value={{ sendRef: jest.fn(), keyHandler: undefined }}>
12
+ <OptionsMenuItem
13
+ children={<>ReactNode</>}
14
+ className={'string'}
15
+ isSelected={false}
16
+ isDisabled={true}
17
+ onSelect={() => null as any}
18
+ id={"''"}
19
+ />{' '}
20
+ </DropdownArrowContext.Provider>
21
+ );
22
+ expect(view.container).toMatchSnapshot();
23
+ });
22
24
  });
@@ -1,14 +1,23 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`OptionsMenuItem should match snapshot (auto-generated) 1`] = `
4
- <DropdownItem
5
- aria-disabled={true}
6
- className="string"
7
- component="button"
8
- id="''"
9
- isDisabled={true}
10
- onClick={[Function]}
11
- >
12
- ReactNode
13
- </DropdownItem>
3
+ exports[`OptionsMenuItem should match snapshot 1`] = `
4
+ <div>
5
+ <li
6
+ id="''"
7
+ role="menuitem"
8
+ >
9
+ <button
10
+ aria-disabled="true"
11
+ class="string"
12
+ data-ouia-component-id="OUIA-Generated-DropdownItem-1"
13
+ data-ouia-component-type="PF4/DropdownItem"
14
+ data-ouia-safe="true"
15
+ tabindex="-1"
16
+ type="button"
17
+ >
18
+ ReactNode
19
+ </button>
20
+ </li>
21
+
22
+ </div>
14
23
  `;
@@ -1,13 +1,17 @@
1
- /**
2
- * This test was generated
3
- */
4
- import * as React from 'react';
5
- import { shallow } from 'enzyme';
1
+ import React from 'react';
2
+
3
+ import { render } from '@testing-library/react';
4
+
6
5
  import { OverflowMenuDropdownItem } from '../../OverflowMenuDropdownItem';
7
- // any missing imports can usually be resolved by adding them here
8
- import {} from '../..';
6
+ import { DropdownArrowContext } from '../../../Dropdown';
9
7
 
10
- it('OverflowMenuDropdownItem should match snapshot (auto-generated)', () => {
11
- const view = shallow(<OverflowMenuDropdownItem children={'any'} isShared={false} />);
12
- expect(view).toMatchSnapshot();
8
+ describe('OverflowMenuDropdownItem', () => {
9
+ it('should match snapshot', () => {
10
+ const view = render(
11
+ <DropdownArrowContext.Provider value={{ sendRef: jest.fn(), keyHandler: undefined }}>
12
+ <OverflowMenuDropdownItem children={'any'} isShared={false} />
13
+ </DropdownArrowContext.Provider>
14
+ );
15
+ expect(view.container).toMatchSnapshot();
16
+ });
13
17
  });
@@ -1,7 +1,21 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`OverflowMenuDropdownItem should match snapshot (auto-generated) 1`] = `
4
- <ContextConsumer>
5
- <Component />
6
- </ContextConsumer>
3
+ exports[`OverflowMenuDropdownItem should match snapshot 1`] = `
4
+ <div>
5
+ <li
6
+ role="menuitem"
7
+ >
8
+ <button
9
+ aria-disabled="false"
10
+ class=""
11
+ data-ouia-component-id="OUIA-Generated-DropdownItem-1"
12
+ data-ouia-component-type="PF4/DropdownItem"
13
+ data-ouia-safe="true"
14
+ tabindex="-1"
15
+ type="button"
16
+ >
17
+ any
18
+ </button>
19
+ </li>
20
+ </div>
7
21
  `;
@@ -1,13 +1,25 @@
1
- /**
2
- * This test was generated
3
- */
4
- import * as React from 'react';
5
- import { shallow } from 'enzyme';
1
+ import React from 'react';
2
+
3
+ import { render } from '@testing-library/react';
4
+
6
5
  import { SelectGroup } from '../../SelectGroup';
7
- // any missing imports can usually be resolved by adding them here
8
- import {} from '../..';
6
+ import { SelectContext } from '../..';
9
7
 
10
- it('SelectGroup should match snapshot (auto-generated)', () => {
11
- const view = shallow(<SelectGroup children={[]} className={"''"} label={"''"} titleId={"''"} />);
12
- expect(view).toMatchSnapshot();
8
+ describe('SelectGroup', () => {
9
+ it('should match snapshot', () => {
10
+ const view = render(
11
+ <SelectContext.Provider
12
+ value={{
13
+ onSelect: jest.fn(),
14
+ onClose: jest.fn(),
15
+ onFavorite: jest.fn(),
16
+ variant: 'default',
17
+ inputIdPrefix: 'something'
18
+ }}
19
+ >
20
+ <SelectGroup children={[]} className="" label="" titleId="" />
21
+ </SelectContext.Provider>
22
+ );
23
+ expect(view.container).toMatchSnapshot();
24
+ });
13
25
  });
@@ -1,29 +1,25 @@
1
- /**
2
- * This test was generated
3
- */
4
- import * as React from 'react';
5
- import { shallow } from 'enzyme';
1
+ import React from 'react';
2
+
3
+ import { render } from '@testing-library/react';
4
+
6
5
  import { SelectMenu } from '../../SelectMenu';
7
- // any missing imports can usually be resolved by adding them here
8
- import {} from '../..';
6
+ import { SelectContext } from '../..';
9
7
 
10
- it('SelectMenu should match snapshot (auto-generated)', () => {
11
- const view = shallow(
12
- <SelectMenu
13
- children={[undefined as React.ReactElement]}
14
- isCustomContent={false}
15
- className={"''"}
16
- isExpanded={false}
17
- isGrouped={false}
18
- selected={''}
19
- checked={[]}
20
- openedOnEnter={false}
21
- maxHeight={''}
22
- noResultsFoundText={'string'}
23
- createText={'string'}
24
- sendRef={() => {}}
25
- keyHandler={() => {}}
26
- />
27
- );
28
- expect(view).toMatchSnapshot();
8
+ describe('SelectMenu', () => {
9
+ it('should match snapshot', () => {
10
+ const view = render(
11
+ <SelectContext.Provider
12
+ value={{
13
+ onSelect: jest.fn(),
14
+ onClose: jest.fn(),
15
+ onFavorite: jest.fn(),
16
+ variant: 'default',
17
+ inputIdPrefix: 'something'
18
+ }}
19
+ >
20
+ <SelectMenu />
21
+ </SelectContext.Provider>
22
+ );
23
+ expect(view.container).toMatchSnapshot();
24
+ });
29
25
  });
@@ -1,7 +1,18 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`SelectGroup should match snapshot (auto-generated) 1`] = `
4
- <ContextConsumer>
5
- <Component />
6
- </ContextConsumer>
3
+ exports[`SelectGroup should match snapshot 1`] = `
4
+ <div>
5
+ <div
6
+ class="pf-c-select__menu-group"
7
+ >
8
+ <div
9
+ aria-hidden="true"
10
+ class="pf-c-select__menu-group-title"
11
+ id=""
12
+ />
13
+ <ul
14
+ role="listbox"
15
+ />
16
+ </div>
17
+ </div>
7
18
  `;
@@ -1,22 +1,10 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`SelectMenu should match snapshot (auto-generated) 1`] = `
4
- <SelectMenu
5
- checked={Array []}
6
- className="''"
7
- createText="string"
8
- hasInlineFilter={false}
9
- innerRef={null}
10
- isCustomContent={false}
11
- isExpanded={false}
12
- isGrouped={false}
13
- isLastOptionBeforeFooter={[Function]}
14
- keyHandler={[Function]}
15
- maxHeight=""
16
- noResultsFoundText="string"
17
- openedOnEnter={false}
18
- position="left"
19
- selected=""
20
- sendRef={[Function]}
21
- />
3
+ exports[`SelectMenu should match snapshot 1`] = `
4
+ <div>
5
+ <ul
6
+ class="pf-c-select__menu"
7
+ role="listbox"
8
+ />
9
+ </div>
22
10
  `;
@@ -1,14 +1,21 @@
1
1
  import React from 'react';
2
- import { shallow } from 'enzyme';
2
+
3
+ import { render, screen } from '@testing-library/react';
4
+
3
5
  import { SelectGroup } from '../SelectGroup';
6
+ import { SelectProvider } from '../selectConstants';
4
7
 
5
- describe('select group', () => {
8
+ describe('SelectGroup', () => {
6
9
  test('renders with children successfully', () => {
7
- const view = shallow(
8
- <SelectGroup label="test">
9
- <div>child</div>
10
- </SelectGroup>
10
+ render(
11
+ <SelectProvider
12
+ value={{ onSelect: () => {}, onFavorite: () => {}, onClose: () => {}, variant: 'single', inputIdPrefix: '' }}
13
+ >
14
+ <SelectGroup label="test" data-testid="test-id">
15
+ <div>child</div>
16
+ </SelectGroup>
17
+ </SelectProvider>
11
18
  );
12
- expect(view).toMatchSnapshot();
19
+ expect(screen.getByTestId('test-id').outerHTML).toMatchSnapshot();
13
20
  });
14
21
  });