@patternfly/react-core 4.202.17 → 4.202.18

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 (51) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +5 -5
  3. package/src/components/ContextSelector/examples/ContextSelector.md +3 -279
  4. package/src/components/ContextSelector/examples/ContextSelectorBasic.tsx +84 -0
  5. package/src/components/ContextSelector/examples/ContextSelectorPlainText.tsx +85 -0
  6. package/src/components/ContextSelector/examples/ContextSelectorWithFooter.tsx +91 -0
  7. package/src/components/Divider/examples/Divider.md +15 -68
  8. package/src/components/Divider/examples/DividerInsetMedium.tsx +4 -0
  9. package/src/components/Divider/examples/DividerInsetVariousBreakpoints.tsx +13 -0
  10. package/src/components/Divider/examples/DividerUsingDiv.tsx +4 -0
  11. package/src/components/Divider/examples/DividerUsingHr.tsx +4 -0
  12. package/src/components/Divider/examples/DividerUsingLi.tsx +10 -0
  13. package/src/components/Divider/examples/DividerVerticalFlex.tsx +10 -0
  14. package/src/components/Divider/examples/DividerVerticalFlexInsetMedium.tsx +10 -0
  15. package/src/components/Divider/examples/DividerVerticalFlexInsetVariousBreakpoints.tsx +18 -0
  16. package/src/components/FormSelect/__tests__/FormSelect.test.tsx +0 -1
  17. package/src/components/List/__tests__/List.test.tsx +33 -33
  18. package/src/components/List/__tests__/__snapshots__/List.test.tsx.snap +33 -64
  19. package/src/components/Menu/__tests__/Menu.test.tsx +37 -33
  20. package/src/components/Menu/__tests__/__snapshots__/Menu.test.tsx.snap +3 -36
  21. package/src/components/Modal/__tests__/Modal.test.tsx +65 -67
  22. package/src/components/Modal/__tests__/ModalBoxCloseButton.test.tsx +13 -10
  23. package/src/components/Nav/__tests__/Nav.test.tsx +185 -214
  24. package/src/components/Nav/__tests__/__snapshots__/Nav.test.tsx.snap +877 -1729
  25. package/src/components/NotificationDrawer/__tests__/NotificationDrawer.test.tsx +13 -15
  26. package/src/components/NotificationDrawer/__tests__/NotificationDrawerBody.test.tsx +13 -15
  27. package/src/components/NotificationDrawer/__tests__/NotificationDrawerGroup.test.tsx +21 -27
  28. package/src/components/NotificationDrawer/__tests__/NotificationDrawerGroupList.test.tsx +13 -15
  29. package/src/components/NotificationDrawer/__tests__/NotificationDrawerHeader.test.tsx +25 -27
  30. package/src/components/NotificationDrawer/__tests__/NotificationDrawerList.test.tsx +17 -19
  31. package/src/components/NotificationDrawer/__tests__/NotificationDrawerListItem.test.tsx +20 -27
  32. package/src/components/NotificationDrawer/__tests__/NotificationDrawerListItemBody.test.tsx +17 -13
  33. package/src/components/NotificationDrawer/__tests__/NotificationDrawerListItemHeader.test.tsx +30 -25
  34. package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawer.test.tsx.snap +3 -5
  35. package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawerBody.test.tsx.snap +3 -5
  36. package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawerGroup.test.tsx.snap +9 -11
  37. package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawerGroupList.test.tsx.snap +3 -5
  38. package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawerHeader.test.tsx.snap +16 -18
  39. package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawerList.test.tsx.snap +7 -8
  40. package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawerListItem.test.tsx.snap +3 -5
  41. package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawerListItemBody.test.tsx.snap +6 -8
  42. package/src/components/NotificationDrawer/__tests__/__snapshots__/NotificationDrawerListItemHeader.test.tsx.snap +12 -14
  43. package/src/components/OverflowMenu/__tests__/OverflowMenu.test.tsx +15 -12
  44. package/src/components/OverflowMenu/__tests__/OverflowMenuControl.test.tsx +9 -8
  45. package/src/components/OverflowMenu/__tests__/OverflowMenuGroup.test.tsx +17 -18
  46. package/src/components/OverflowMenu/__tests__/OverflowMenuItem.test.tsx +10 -9
  47. package/src/components/OverflowMenu/__tests__/__snapshots__/OverflowMenu.test.tsx.snap +6 -16
  48. package/src/components/OverflowMenu/__tests__/__snapshots__/OverflowMenuControl.test.tsx.snap +3 -15
  49. package/src/components/OverflowMenu/__tests__/__snapshots__/OverflowMenuItem.test.tsx.snap +3 -17
  50. package/src/components/Modal/__tests__/__snapshots__/ModalBoxCloseButton.test.tsx.snap +0 -16
  51. package/src/components/OverflowMenu/__tests__/__snapshots__/OverflowMenuGroup.test.tsx.snap +0 -33
@@ -1,19 +1,18 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`className is added to the root element 1`] = `"pf-c-notification-drawer__list extra-class"`;
4
-
5
- exports[`drawer list with hidden applied 1`] = `
6
- <div>
3
+ exports[`NotificationDrawerList drawer list with hidden applied 1`] = `
4
+ <DocumentFragment>
7
5
  <ul
8
6
  class="pf-c-notification-drawer__list"
7
+ hidden=""
9
8
  />
10
- </div>
9
+ </DocumentFragment>
11
10
  `;
12
11
 
13
- exports[`renders with PatternFly Core styles 1`] = `
14
- <div>
12
+ exports[`NotificationDrawerList renders with PatternFly Core styles 1`] = `
13
+ <DocumentFragment>
15
14
  <ul
16
15
  class="pf-c-notification-drawer__list"
17
16
  />
18
- </div>
17
+ </DocumentFragment>
19
18
  `;
@@ -1,12 +1,10 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`className is added to the root element 1`] = `"pf-c-notification-drawer__list-item pf-m-hoverable pf-m-default extra-class"`;
4
-
5
- exports[`renders with PatternFly Core styles 1`] = `
6
- <div>
3
+ exports[`NotificationDrawerListItem renders with PatternFly Core styles 1`] = `
4
+ <DocumentFragment>
7
5
  <li
8
6
  class="pf-c-notification-drawer__list-item pf-m-hoverable pf-m-default"
9
7
  tabindex="0"
10
8
  />
11
- </div>
9
+ </DocumentFragment>
12
10
  `;
@@ -1,9 +1,7 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`className is added to the root element 1`] = `undefined`;
4
-
5
- exports[`list item body with timestamp property applied 1`] = `
6
- <div>
3
+ exports[`NotificationDrawerListItemBody list item body with timestamp property applied 1`] = `
4
+ <DocumentFragment>
7
5
  <div
8
6
  class="pf-c-notification-drawer__list-item-description"
9
7
  />
@@ -12,13 +10,13 @@ exports[`list item body with timestamp property applied 1`] = `
12
10
  >
13
11
  5 minutes ago
14
12
  </div>
15
- </div>
13
+ </DocumentFragment>
16
14
  `;
17
15
 
18
- exports[`renders with PatternFly Core styles 1`] = `
19
- <div>
16
+ exports[`NotificationDrawerListItemBody renders with PatternFly Core styles 1`] = `
17
+ <DocumentFragment>
20
18
  <div
21
19
  class="pf-c-notification-drawer__list-item-description"
22
20
  />
23
- </div>
21
+ </DocumentFragment>
24
22
  `;
@@ -1,9 +1,7 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`className is added to the root element 1`] = `"extra-class"`;
4
-
5
- exports[`list item header with custom icon applied 1`] = `
6
- <div>
3
+ exports[`NotificationDrawerListItemHeader list item header with custom icon applied 1`] = `
4
+ <DocumentFragment>
7
5
  <div
8
6
  class="pf-c-notification-drawer__list-item-header"
9
7
  >
@@ -30,11 +28,11 @@ exports[`list item header with custom icon applied 1`] = `
30
28
  Pod quit unexpectedly
31
29
  </h2>
32
30
  </div>
33
- </div>
31
+ </DocumentFragment>
34
32
  `;
35
33
 
36
- exports[`list item header with srTitle applied 1`] = `
37
- <div>
34
+ exports[`NotificationDrawerListItemHeader list item header with srTitle applied 1`] = `
35
+ <DocumentFragment>
38
36
  <div
39
37
  class="pf-c-notification-drawer__list-item-header"
40
38
  >
@@ -66,11 +64,11 @@ exports[`list item header with srTitle applied 1`] = `
66
64
  Pod quit unexpectedly
67
65
  </h2>
68
66
  </div>
69
- </div>
67
+ </DocumentFragment>
70
68
  `;
71
69
 
72
- exports[`list item header with variant applied 1`] = `
73
- <div>
70
+ exports[`NotificationDrawerListItemHeader list item header with variant applied 1`] = `
71
+ <DocumentFragment>
74
72
  <div
75
73
  class="pf-c-notification-drawer__list-item-header"
76
74
  >
@@ -97,11 +95,11 @@ exports[`list item header with variant applied 1`] = `
97
95
  Pod quit unexpectedly
98
96
  </h2>
99
97
  </div>
100
- </div>
98
+ </DocumentFragment>
101
99
  `;
102
100
 
103
- exports[`renders with PatternFly Core styles 1`] = `
104
- <div>
101
+ exports[`NotificationDrawerListItemHeader renders with PatternFly Core styles 1`] = `
102
+ <DocumentFragment>
105
103
  <div
106
104
  class="pf-c-notification-drawer__list-item-header"
107
105
  >
@@ -128,5 +126,5 @@ exports[`renders with PatternFly Core styles 1`] = `
128
126
  Pod quit unexpectedly
129
127
  </h2>
130
128
  </div>
131
- </div>
129
+ </DocumentFragment>
132
130
  `;
@@ -1,43 +1,46 @@
1
1
  import * as React from 'react';
2
- import { render } from '@testing-library/react';
3
- import { mount } from 'enzyme';
2
+
3
+ import { render, screen } from '@testing-library/react';
4
+ import '@testing-library/jest-dom';
5
+
4
6
  import styles from '@patternfly/react-styles/css/components/OverflowMenu/overflow-menu';
5
7
  import { OverflowMenu } from '../OverflowMenu';
6
8
 
7
9
  describe('OverflowMenu', () => {
8
10
  test('md', () => {
9
- const view = mount(<OverflowMenu breakpoint="md" />);
10
- expect(view.find(`.${styles.overflowMenu}`).length).toBe(1);
11
- expect(view).toMatchSnapshot();
11
+ render(<OverflowMenu breakpoint="md" data-testid='test-id' />);
12
+ expect(screen.getByTestId('test-id')).toHaveClass(styles.overflowMenu);
12
13
  });
13
14
 
14
15
  test('lg', () => {
15
- const view = render(<OverflowMenu breakpoint="lg" />);
16
- expect(view.container).toMatchSnapshot();
16
+ const { asFragment } = render(<OverflowMenu breakpoint="lg" />);
17
+ expect(asFragment()).toMatchSnapshot();
17
18
  });
18
19
 
19
20
  test('xl', () => {
20
- const view = render(<OverflowMenu breakpoint="xl" />);
21
- expect(view.container).toMatchSnapshot();
21
+ const { asFragment } = render(<OverflowMenu breakpoint="xl" />);
22
+ expect(asFragment()).toMatchSnapshot();
22
23
  });
23
24
 
24
25
  test('basic', () => {
25
- const view = render(
26
+ const { asFragment } = render(
26
27
  <OverflowMenu breakpoint="md">
27
28
  <div>BASIC</div>
28
29
  </OverflowMenu>
29
30
  );
30
- expect(view.container).toMatchSnapshot();
31
+ expect(asFragment()).toMatchSnapshot();
31
32
  });
32
33
 
33
34
  test('should warn on bad props', () => {
34
35
  const myMock = jest.fn() as any;
35
36
  global.console = { error: myMock } as any;
37
+
36
38
  render(
37
- <OverflowMenu breakpoint={undefined as "md"}>
39
+ <OverflowMenu breakpoint={undefined as 'md'}>
38
40
  <div>BASIC</div>
39
41
  </OverflowMenu>
40
42
  );
43
+
41
44
  expect(myMock).toBeCalled();
42
45
  });
43
46
  });
@@ -1,23 +1,24 @@
1
1
  import * as React from 'react';
2
- import { render } from '@testing-library/react';
3
- import { mount } from 'enzyme';
2
+
3
+ import { render, screen } from '@testing-library/react';
4
+ import '@testing-library/jest-dom';
5
+
4
6
  import styles from '@patternfly/react-styles/css/components/OverflowMenu/overflow-menu';
5
7
  import { OverflowMenuControl } from '../OverflowMenuControl';
6
8
  import { OverflowMenuContext } from '../OverflowMenuContext';
7
9
 
8
10
  describe('OverflowMenuControl', () => {
9
11
  test('basic', () => {
10
- const view = mount(
12
+ render(
11
13
  <OverflowMenuContext.Provider value={{ isBelowBreakpoint: true }}>
12
- <OverflowMenuControl />
14
+ <OverflowMenuControl data-testid="test-id" />
13
15
  </OverflowMenuContext.Provider>
14
16
  );
15
- expect(view.find(`.${styles.overflowMenuControl}`).length).toBe(1);
16
- expect(view).toMatchSnapshot();
17
+ expect(screen.getByTestId('test-id')).toHaveClass(styles.overflowMenuControl);
17
18
  });
18
19
 
19
20
  test('Additional Options', () => {
20
- const view = render(<OverflowMenuControl hasAdditionalOptions />);
21
- expect(view.container).toMatchSnapshot();
21
+ const { asFragment } = render(<OverflowMenuControl hasAdditionalOptions />);
22
+ expect(asFragment()).toMatchSnapshot();
22
23
  });
23
24
  });
@@ -1,47 +1,46 @@
1
- import * as React from 'react';
2
- import { mount } from 'enzyme';
1
+ import React from 'react';
2
+
3
+ import { render, screen } from '@testing-library/react';
4
+ import '@testing-library/jest-dom';
5
+
3
6
  import styles from '@patternfly/react-styles/css/components/OverflowMenu/overflow-menu';
4
7
  import { OverflowMenuGroup } from '../OverflowMenuGroup';
5
8
  import { OverflowMenuContext } from '../OverflowMenuContext';
6
9
 
7
10
  describe('OverflowMenuGroup', () => {
8
11
  test('isPersistent and below breakpoint should still show', () => {
9
- const view = mount(
12
+ render(
10
13
  <OverflowMenuContext.Provider value={{ isBelowBreakpoint: true }}>
11
- <OverflowMenuGroup isPersistent />
14
+ <OverflowMenuGroup isPersistent data-testid="test-id" />
12
15
  </OverflowMenuContext.Provider>
13
16
  );
14
- expect(view.find(`.${styles.overflowMenuGroup}`).length).toBe(1);
15
- expect(view).toMatchSnapshot();
17
+ expect(screen.getByTestId('test-id')).toHaveClass(styles.overflowMenuGroup);
16
18
  });
17
19
 
18
20
  test('Below breakpoint but not isPersistent should not show', () => {
19
- const view = mount(
21
+ render(
20
22
  <OverflowMenuContext.Provider value={{ isBelowBreakpoint: true }}>
21
- <OverflowMenuGroup />
23
+ <OverflowMenuGroup data-testid="test-id" />
22
24
  </OverflowMenuContext.Provider>
23
25
  );
24
- expect(view.find(`.${styles.overflowMenuGroup}`).length).toBe(0);
25
- expect(view).toMatchSnapshot();
26
+ expect(screen.queryByTestId('test-id')).toBeNull();
26
27
  });
27
28
 
28
29
  test('Button group', () => {
29
- const view = mount(
30
+ render(
30
31
  <OverflowMenuContext.Provider value={{ isBelowBreakpoint: false }}>
31
- <OverflowMenuGroup groupType="button" />
32
+ <OverflowMenuGroup groupType="button" data-testid="test-id" />
32
33
  </OverflowMenuContext.Provider>
33
34
  );
34
- expect(view.find(`.${styles.modifiers.buttonGroup}`).length).toBe(1);
35
- expect(view).toMatchSnapshot();
35
+ expect(screen.getByTestId('test-id')).toHaveClass(styles.modifiers.buttonGroup);
36
36
  });
37
37
 
38
38
  test('Icon group', () => {
39
- const view = mount(
39
+ render(
40
40
  <OverflowMenuContext.Provider value={{ isBelowBreakpoint: false }}>
41
- <OverflowMenuGroup groupType="icon" />
41
+ <OverflowMenuGroup groupType="icon" data-testid="test-id" />
42
42
  </OverflowMenuContext.Provider>
43
43
  );
44
- expect(view.find(`.${styles.modifiers.iconButtonGroup}`).length).toBe(1);
45
- expect(view).toMatchSnapshot();
44
+ expect(screen.getByTestId('test-id')).toHaveClass(styles.modifiers.iconButtonGroup);
46
45
  });
47
46
  });
@@ -1,27 +1,28 @@
1
1
  import * as React from 'react';
2
- import { render } from '@testing-library/react';
3
- import { mount } from 'enzyme';
2
+
3
+ import { render, screen } from '@testing-library/react';
4
+ import '@testing-library/jest-dom';
5
+
4
6
  import styles from '@patternfly/react-styles/css/components/OverflowMenu/overflow-menu';
5
7
  import { OverflowMenuItem } from '../OverflowMenuItem';
6
8
  import { OverflowMenuContext } from '../OverflowMenuContext';
7
9
 
8
10
  describe('OverflowMenuItem', () => {
9
11
  test('isPersistent and below breakpoint should still show', () => {
10
- const view = mount(
12
+ render(
11
13
  <OverflowMenuContext.Provider value={{ isBelowBreakpoint: false }}>
12
- <OverflowMenuItem isPersistent />
14
+ <OverflowMenuItem isPersistent>Some item value</OverflowMenuItem>
13
15
  </OverflowMenuContext.Provider>
14
16
  );
15
- expect(view.find(`.${styles.overflowMenuItem}`).length).toBe(1);
16
- expect(view).toMatchSnapshot();
17
+ expect(screen.getByText('Some item value')).toHaveClass(styles.overflowMenuItem);
17
18
  });
18
19
 
19
20
  test('Below breakpoint and not isPersistent should not show', () => {
20
- const view = render(
21
+ const { asFragment } = render(
21
22
  <OverflowMenuContext.Provider value={{ isBelowBreakpoint: false }}>
22
- <OverflowMenuItem />
23
+ <OverflowMenuItem>Some item value</OverflowMenuItem>
23
24
  </OverflowMenuContext.Provider>
24
25
  );
25
- expect(view.container).toMatchSnapshot();
26
+ expect(asFragment()).toMatchSnapshot();
26
27
  });
27
28
  });
@@ -1,7 +1,7 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`OverflowMenu basic 1`] = `
4
- <div>
4
+ <DocumentFragment>
5
5
  <div
6
6
  class="pf-c-overflow-menu"
7
7
  >
@@ -9,31 +9,21 @@ exports[`OverflowMenu basic 1`] = `
9
9
  BASIC
10
10
  </div>
11
11
  </div>
12
- </div>
12
+ </DocumentFragment>
13
13
  `;
14
14
 
15
15
  exports[`OverflowMenu lg 1`] = `
16
- <div>
16
+ <DocumentFragment>
17
17
  <div
18
18
  class="pf-c-overflow-menu"
19
19
  />
20
- </div>
21
- `;
22
-
23
- exports[`OverflowMenu md 1`] = `
24
- <OverflowMenu
25
- breakpoint="md"
26
- >
27
- <div
28
- className="pf-c-overflow-menu"
29
- />
30
- </OverflowMenu>
20
+ </DocumentFragment>
31
21
  `;
32
22
 
33
23
  exports[`OverflowMenu xl 1`] = `
34
- <div>
24
+ <DocumentFragment>
35
25
  <div
36
26
  class="pf-c-overflow-menu"
37
27
  />
38
- </div>
28
+ </DocumentFragment>
39
29
  `;
@@ -1,23 +1,11 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`OverflowMenuControl Additional Options 1`] = `
4
- <div>
4
+ <DocumentFragment>
5
5
  <div
6
6
  class="pf-c-overflow-menu__control"
7
7
  >
8
-
9
-
8
+
10
9
  </div>
11
- </div>
12
- `;
13
-
14
- exports[`OverflowMenuControl basic 1`] = `
15
- <OverflowMenuControl>
16
- <div
17
- className="pf-c-overflow-menu__control"
18
- >
19
-
20
-
21
- </div>
22
- </OverflowMenuControl>
10
+ </DocumentFragment>
23
11
  `;
@@ -1,25 +1,11 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`OverflowMenuItem Below breakpoint and not isPersistent should not show 1`] = `
4
- <div>
4
+ <DocumentFragment>
5
5
  <div
6
6
  class="pf-c-overflow-menu__item"
7
7
  >
8
-
9
-
8
+ Some item value
10
9
  </div>
11
- </div>
12
- `;
13
-
14
- exports[`OverflowMenuItem isPersistent and below breakpoint should still show 1`] = `
15
- <OverflowMenuItem
16
- isPersistent={true}
17
- >
18
- <div
19
- className="pf-c-overflow-menu__item"
20
- >
21
-
22
-
23
- </div>
24
- </OverflowMenuItem>
10
+ </DocumentFragment>
25
11
  `;
@@ -1,16 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`ModalBoxCloseButton Test 1`] = `
4
- <Button
5
- aria-label="Close"
6
- className="test-box-close-button-class"
7
- onClick={[MockFunction]}
8
- variant="plain"
9
- >
10
- <TimesIcon
11
- color="currentColor"
12
- noVerticalAlign={false}
13
- size="sm"
14
- />
15
- </Button>
16
- `;
@@ -1,33 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`OverflowMenuGroup Below breakpoint but not isPersistent should not show 1`] = `<OverflowMenuGroup />`;
4
-
5
- exports[`OverflowMenuGroup Button group 1`] = `
6
- <OverflowMenuGroup
7
- groupType="button"
8
- >
9
- <div
10
- className="pf-c-overflow-menu__group pf-m-button-group"
11
- />
12
- </OverflowMenuGroup>
13
- `;
14
-
15
- exports[`OverflowMenuGroup Icon group 1`] = `
16
- <OverflowMenuGroup
17
- groupType="icon"
18
- >
19
- <div
20
- className="pf-c-overflow-menu__group pf-m-icon-button-group"
21
- />
22
- </OverflowMenuGroup>
23
- `;
24
-
25
- exports[`OverflowMenuGroup isPersistent and below breakpoint should still show 1`] = `
26
- <OverflowMenuGroup
27
- isPersistent={true}
28
- >
29
- <div
30
- className="pf-c-overflow-menu__group"
31
- />
32
- </OverflowMenuGroup>
33
- `;