@patternfly/react-core 4.200.0 → 4.201.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts +1 -1
  3. package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
  4. package/dist/esm/components/CalendarMonth/CalendarMonth.js +13 -8
  5. package/dist/esm/components/CalendarMonth/CalendarMonth.js.map +1 -1
  6. package/dist/js/components/CalendarMonth/CalendarMonth.d.ts +1 -1
  7. package/dist/js/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
  8. package/dist/js/components/CalendarMonth/CalendarMonth.js +13 -8
  9. package/dist/js/components/CalendarMonth/CalendarMonth.js.map +1 -1
  10. package/dist/umd/react-core.css +804 -804
  11. package/dist/umd/react-core.js +13 -8
  12. package/dist/umd/react-core.min.js +1 -1
  13. package/package.json +5 -5
  14. package/src/components/CalendarMonth/CalendarMonth.tsx +15 -9
  15. package/src/components/ChipGroup/__tests__/ChipGroup.test.tsx +14 -9
  16. package/src/components/ClipboardCopy/__tests__/ClipboardCopyToggle.test.tsx +28 -19
  17. package/src/components/ClipboardCopy/__tests__/__snapshots__/ClipboardCopyToggle.test.tsx.snap +1 -1
  18. package/src/components/ContextSelector/__tests__/ContextSelector.test.tsx +21 -14
  19. package/src/components/ContextSelector/__tests__/ContextSelectorToggle.test.tsx +49 -34
  20. package/src/components/ContextSelector/__tests__/__snapshots__/ContextSelector.test.tsx.snap +2 -169
  21. package/src/components/ContextSelector/__tests__/__snapshots__/ContextSelectorToggle.test.tsx.snap +5 -247
  22. package/src/components/DataList/__tests__/DataList.test.tsx +49 -40
  23. package/src/components/DataList/__tests__/__snapshots__/DataList.test.tsx.snap +1 -9
  24. package/src/components/Dropdown/__tests__/Dropdown.test.tsx +54 -42
  25. package/src/components/Dropdown/__tests__/DropdownToggle.test.tsx +179 -177
  26. package/src/components/Dropdown/__tests__/DropdownToggleCheckbox.test.tsx +51 -55
  27. package/src/components/Dropdown/__tests__/Generated/DropdownItem.test.tsx +28 -26
  28. package/src/components/Dropdown/__tests__/Generated/DropdownSeparator.test.tsx +14 -15
  29. package/src/components/Dropdown/__tests__/Generated/InternalDropdownItem.test.tsx +39 -36
  30. package/src/components/Dropdown/__tests__/Generated/__snapshots__/DropdownItem.test.tsx.snap +6 -4
  31. package/src/components/Dropdown/__tests__/Generated/__snapshots__/DropdownSeparator.test.tsx.snap +11 -4
  32. package/src/components/Dropdown/__tests__/Generated/__snapshots__/InternalDropdownItem.test.tsx.snap +7 -4
  33. package/src/components/Dropdown/__tests__/InternalDropdownItem.test.tsx +66 -69
  34. package/src/components/Dropdown/__tests__/__snapshots__/Dropdown.test.tsx.snap +15 -816
  35. package/src/components/Dropdown/__tests__/__snapshots__/DropdownToggle.test.tsx.snap +9 -454
  36. package/src/components/Dropdown/__tests__/__snapshots__/DropdownToggleCheckbox.test.tsx.snap +7 -141
  37. package/src/components/Dropdown/__tests__/__snapshots__/InternalDropdownItem.test.tsx.snap +10 -163
  38. package/src/components/Nav/__tests__/Generated/NavList.test.tsx +28 -18
  39. package/src/components/Nav/__tests__/Generated/__snapshots__/NavList.test.tsx.snap +8 -4
  40. package/src/components/OptionsMenu/__tests__/Generated/OptionsMenuItem.test.tsx +21 -19
  41. package/src/components/OptionsMenu/__tests__/Generated/__snapshots__/OptionsMenuItem.test.tsx.snap +20 -11
  42. package/src/components/OverflowMenu/__tests__/Generated/OverflowMenuDropdownItem.test.tsx +14 -10
  43. package/src/components/OverflowMenu/__tests__/Generated/__snapshots__/OverflowMenuDropdownItem.test.tsx.snap +18 -4
  44. package/src/components/Select/__tests__/Generated/SelectGroup.test.tsx +22 -10
  45. package/src/components/Select/__tests__/Generated/SelectMenu.test.tsx +22 -26
  46. package/src/components/Select/__tests__/Generated/__snapshots__/SelectGroup.test.tsx.snap +15 -4
  47. package/src/components/Select/__tests__/Generated/__snapshots__/SelectMenu.test.tsx.snap +7 -19
  48. package/src/components/Select/__tests__/SelectGroup.test.tsx +14 -7
  49. package/src/components/Select/__tests__/SelectOption.test.tsx +51 -30
  50. package/src/components/Select/__tests__/__snapshots__/SelectGroup.test.tsx.snap +1 -5
  51. package/src/components/Select/__tests__/__snapshots__/SelectOption.test.tsx.snap +10 -272
  52. package/src/components/Toolbar/__tests__/Generated/ToolbarToggleGroup.test.tsx +25 -11
  53. package/src/components/Toolbar/__tests__/Generated/__snapshots__/ToolbarToggleGroup.test.tsx.snap +26 -4
  54. package/src/components/Toolbar/__tests__/Toolbar.test.tsx +129 -0
  55. package/src/components/Toolbar/__tests__/ToolbarItem.test.tsx +19 -0
  56. package/src/components/Toolbar/__tests__/ToolbarToggleGroup.test.tsx +12 -135
  57. package/src/components/Toolbar/__tests__/__snapshots__/Toolbar.test.tsx.snap +7 -0
  58. package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.test.tsx.snap +3 -0
  59. package/src/components/Tooltip/examples/Tooltip.md +9 -1
  60. package/src/components/Tooltip/examples/TooltipExamples.css +4 -4
  61. package/src/components/Select/__tests__/Generated/SelectOption.test.tsx +0 -29
  62. package/src/components/Select/__tests__/Generated/__snapshots__/SelectOption.test.tsx.snap +0 -7
  63. package/src/components/Toolbar/__tests__/__snapshots__/ToolbarToggleGroup.test.tsx.snap +0 -516
  64. package/src/components/Wizard/__tests__/Generated/Wizard.test.tsx +0 -43
  65. 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>"`;
@@ -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
  });