@patternfly/react-core 4.202.28 → 4.202.31

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 (105) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/esm/components/JumpLinks/JumpLinksItem.d.ts.map +1 -1
  3. package/dist/esm/components/JumpLinks/JumpLinksItem.js +1 -1
  4. package/dist/esm/components/JumpLinks/JumpLinksItem.js.map +1 -1
  5. package/dist/esm/components/ProgressStepper/ProgressStep.d.ts +3 -0
  6. package/dist/esm/components/ProgressStepper/ProgressStep.d.ts.map +1 -1
  7. package/dist/esm/components/ProgressStepper/ProgressStep.js +2 -2
  8. package/dist/esm/components/ProgressStepper/ProgressStep.js.map +1 -1
  9. package/dist/esm/components/Tabs/Tab.d.ts.map +1 -1
  10. package/dist/esm/components/Tabs/Tab.js +2 -2
  11. package/dist/esm/components/Tabs/Tab.js.map +1 -1
  12. package/dist/esm/components/Tabs/Tabs.d.ts +1 -1
  13. package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
  14. package/dist/esm/components/Tabs/Tabs.js +1 -1
  15. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  16. package/dist/esm/helpers/Popper/Popper.d.ts.map +1 -1
  17. package/dist/esm/helpers/Popper/Popper.js +1 -7
  18. package/dist/esm/helpers/Popper/Popper.js.map +1 -1
  19. package/dist/js/components/JumpLinks/JumpLinksItem.d.ts.map +1 -1
  20. package/dist/js/components/JumpLinks/JumpLinksItem.js +1 -1
  21. package/dist/js/components/JumpLinks/JumpLinksItem.js.map +1 -1
  22. package/dist/js/components/ProgressStepper/ProgressStep.d.ts +3 -0
  23. package/dist/js/components/ProgressStepper/ProgressStep.d.ts.map +1 -1
  24. package/dist/js/components/ProgressStepper/ProgressStep.js +2 -2
  25. package/dist/js/components/ProgressStepper/ProgressStep.js.map +1 -1
  26. package/dist/js/components/Tabs/Tab.d.ts.map +1 -1
  27. package/dist/js/components/Tabs/Tab.js +2 -2
  28. package/dist/js/components/Tabs/Tab.js.map +1 -1
  29. package/dist/js/components/Tabs/Tabs.d.ts +1 -1
  30. package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
  31. package/dist/js/components/Tabs/Tabs.js +1 -1
  32. package/dist/js/components/Tabs/Tabs.js.map +1 -1
  33. package/dist/js/helpers/Popper/Popper.d.ts.map +1 -1
  34. package/dist/js/helpers/Popper/Popper.js +1 -7
  35. package/dist/js/helpers/Popper/Popper.js.map +1 -1
  36. package/dist/umd/react-core.js +7 -13
  37. package/dist/umd/react-core.min.js +1 -1
  38. package/package.json +5 -5
  39. package/src/components/Dropdown/__tests__/DropdownToggleCheckbox.test.tsx +1 -1
  40. package/src/components/ExpandableSection/examples/ExpandableSection.md +1 -1
  41. package/src/components/JumpLinks/JumpLinksItem.tsx +5 -1
  42. package/src/components/JumpLinks/__tests__/__snapshots__/JumpLinks.test.tsx.snap +5 -0
  43. package/src/components/Page/__tests__/Page.test.tsx +225 -205
  44. package/src/components/Page/__tests__/__snapshots__/Page.test.tsx.snap +1088 -2059
  45. package/src/components/Pagination/__tests__/Pagination.test.tsx +235 -283
  46. package/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +143 -577
  47. package/src/components/ProgressStepper/ProgressStep.tsx +6 -0
  48. package/src/components/ProgressStepper/__tests__/__snapshots__/ProgressStepper.test.tsx.snap +1 -0
  49. package/src/components/ProgressStepper/examples/ProgressStepper.md +9 -9
  50. package/src/components/Radio/__tests__/Radio.test.tsx +38 -44
  51. package/src/components/Radio/__tests__/__snapshots__/Radio.test.tsx.snap +30 -30
  52. package/src/components/SearchInput/__tests__/SearchInput.test.tsx +87 -68
  53. package/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +230 -137
  54. package/src/components/Select/__tests__/Select.test.tsx +238 -195
  55. package/src/components/Select/__tests__/SelectToggle.test.tsx +68 -130
  56. package/src/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +978 -2149
  57. package/src/components/Select/__tests__/__snapshots__/SelectToggle.test.tsx.snap +3 -3
  58. package/src/components/SimpleList/__tests__/SimpleList.test.tsx +29 -32
  59. package/src/components/SimpleList/__tests__/__snapshots__/SimpleList.test.tsx.snap +4 -366
  60. package/src/components/Switch/__tests__/Switch.test.tsx +85 -75
  61. package/src/components/Switch/__tests__/__snapshots__/Switch.test.tsx.snap +30 -40
  62. package/src/components/Tabs/Tab.tsx +6 -1
  63. package/src/components/Tabs/Tabs.tsx +2 -2
  64. package/src/components/Tabs/__tests__/Generated/__snapshots__/Tabs.test.tsx.snap +1 -0
  65. package/src/components/Tabs/__tests__/__snapshots__/Tab.test.tsx.snap +3 -0
  66. package/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +135 -0
  67. package/src/components/Tabs/examples/Tabs.md +32 -26
  68. package/src/components/TextArea/__tests__/TextArea.test.tsx +98 -103
  69. package/src/components/TextArea/__tests__/__snapshots__/TextArea.test.tsx.snap +24 -103
  70. package/src/components/TextInput/__tests__/TextInput.test.tsx +71 -70
  71. package/src/components/TextInput/__tests__/__snapshots__/TextInput.test.tsx.snap +15 -103
  72. package/src/components/TextInputGroup/__tests__/TextInputGroup.test.tsx +65 -39
  73. package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroup.test.tsx.snap +53 -14
  74. package/src/components/TimePicker/__tests__/TimePicker.test.tsx +113 -110
  75. package/src/components/Title/__tests__/Title.test.tsx +21 -20
  76. package/src/components/Title/__tests__/__snapshots__/Title.test.tsx.snap +24 -30
  77. package/src/components/ToggleGroup/__tests__/ToggleGroup.test.tsx +43 -39
  78. package/src/components/ToggleGroup/__tests__/__snapshots__/ToggleGroup.test.tsx.snap +20 -19
  79. package/src/components/Wizard/__tests__/Wizard.test.tsx +195 -189
  80. package/src/components/Wizard/__tests__/__snapshots__/Wizard.test.tsx.snap +131 -10
  81. package/src/helpers/Popper/Popper.tsx +5 -7
  82. package/src/helpers/__tests__/util.test.ts +113 -0
  83. package/src/layouts/Bullseye/__tests__/Bullseye.test.tsx +25 -25
  84. package/src/layouts/Bullseye/__tests__/__snapshots__/Bullseye.test.tsx.snap +3 -5
  85. package/src/layouts/Flex/__tests__/Flex.test.tsx +159 -96
  86. package/src/layouts/Flex/__tests__/__snapshots__/Flex.test.tsx.snap +9 -17
  87. package/src/components/Page/__tests__/Generated/Page.test.tsx +0 -28
  88. package/src/components/Page/__tests__/Generated/__snapshots__/Page.test.tsx.snap +0 -19
  89. package/src/components/Pagination/__tests__/Generated/Pagination.test.tsx +0 -58
  90. package/src/components/Pagination/__tests__/Generated/__snapshots__/Pagination.test.tsx.snap +0 -205
  91. package/src/components/Radio/__tests__/Generated/Radio.test.tsx +0 -29
  92. package/src/components/Radio/__tests__/Generated/__snapshots__/Radio.test.tsx.snap +0 -36
  93. package/src/components/Select/__tests__/Generated/Select.test.tsx +0 -49
  94. package/src/components/Select/__tests__/Generated/SelectToggle.test.tsx +0 -34
  95. package/src/components/Select/__tests__/Generated/__snapshots__/Select.test.tsx.snap +0 -48
  96. package/src/components/Select/__tests__/Generated/__snapshots__/SelectToggle.test.tsx.snap +0 -36
  97. package/src/components/SimpleList/__tests__/Generated/SimpleList.test.tsx +0 -22
  98. package/src/components/SimpleList/__tests__/Generated/__snapshots__/SimpleList.test.tsx.snap +0 -13
  99. package/src/components/Switch/__tests__/Generated/Switch.test.tsx +0 -24
  100. package/src/components/Switch/__tests__/Generated/__snapshots__/Switch.test.tsx.snap +0 -36
  101. package/src/components/TextArea/__tests__/Generated/TextArea.test.tsx +0 -23
  102. package/src/components/TextArea/__tests__/Generated/__snapshots__/TextArea.test.tsx.snap +0 -13
  103. package/src/components/Title/__tests__/Generated/Title.test.tsx +0 -13
  104. package/src/components/Title/__tests__/Generated/__snapshots__/Title.test.tsx.snap +0 -12
  105. package/src/helpers/__tests__/util.test.js +0 -235
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.202.28",
3
+ "version": "4.202.31",
4
4
  "description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -34,9 +34,9 @@
34
34
  "generate": "node scripts/copyStyles.js"
35
35
  },
36
36
  "dependencies": {
37
- "@patternfly/react-icons": "^4.53.28",
38
- "@patternfly/react-styles": "^4.52.28",
39
- "@patternfly/react-tokens": "^4.54.28",
37
+ "@patternfly/react-icons": "^4.53.31",
38
+ "@patternfly/react-styles": "^4.52.31",
39
+ "@patternfly/react-tokens": "^4.54.31",
40
40
  "focus-trap": "6.2.2",
41
41
  "react-dropzone": "9.0.0",
42
42
  "tippy.js": "5.1.2",
@@ -60,5 +60,5 @@
60
60
  "react": "^16.8.0 || ^17.0.0",
61
61
  "react-dom": "^16.8.0 || ^17.0.0"
62
62
  },
63
- "gitHead": "fc8f50299dd98fc0901fcece0cd391d94db26898"
63
+ "gitHead": "b4d39ebb37217775bd0e652d2c7e1428a3d0370a"
64
64
  }
@@ -54,6 +54,6 @@ describe('DropdownToggleCheckbox', () => {
54
54
  render(<DropdownToggleCheckbox id="check" {...props} aria-label="check" />);
55
55
 
56
56
  userEvent.click(screen.getByRole('checkbox'));
57
- expect(props.onChange.mock.calls[0][0]).toBe(true);
57
+ expect(props.onChange).toHaveBeenCalledWith(true, expect.any(Object));
58
58
  });
59
59
  });
@@ -177,4 +177,4 @@ class SimpleExpandableSection extends React.Component {
177
177
  );
178
178
  }
179
179
  }
180
- ```
180
+ ```
@@ -33,7 +33,11 @@ export const JumpLinksItem: React.FunctionComponent<JumpLinksItemProps> = ({
33
33
  children = childrenArr.filter(child => child.type !== JumpLinksList);
34
34
 
35
35
  return (
36
- <li className={css(styles.jumpLinksItem, isActive && styles.modifiers.current, className)} {...props}>
36
+ <li
37
+ className={css(styles.jumpLinksItem, isActive && styles.modifiers.current, className)}
38
+ {...(isActive && { 'aria-current': 'location' })}
39
+ {...props}
40
+ >
37
41
  <a className={styles.jumpLinksLink} href={href} onClick={onClick}>
38
42
  <span className={styles.jumpLinksLinkText}>{children}</span>
39
43
  </a>
@@ -89,6 +89,7 @@ exports[`expandable vertical with subsection 1`] = `
89
89
  class="pf-c-jump-links__list"
90
90
  >
91
91
  <li
92
+ aria-current="location"
92
93
  class="pf-c-jump-links__item pf-m-current"
93
94
  >
94
95
  <a
@@ -189,6 +190,7 @@ exports[`jumplinks centered 1`] = `
189
190
  </a>
190
191
  </li>
191
192
  <li
193
+ aria-current="location"
192
194
  class="pf-c-jump-links__item pf-m-current"
193
195
  >
194
196
  <a
@@ -255,6 +257,7 @@ exports[`jumplinks with label 1`] = `
255
257
  </a>
256
258
  </li>
257
259
  <li
260
+ aria-current="location"
258
261
  class="pf-c-jump-links__item pf-m-current"
259
262
  >
260
263
  <a
@@ -314,6 +317,7 @@ exports[`simple jumplinks 1`] = `
314
317
  </a>
315
318
  </li>
316
319
  <li
320
+ aria-current="location"
317
321
  class="pf-c-jump-links__item pf-m-current"
318
322
  >
319
323
  <a
@@ -380,6 +384,7 @@ exports[`vertical with label 1`] = `
380
384
  </a>
381
385
  </li>
382
386
  <li
387
+ aria-current="location"
383
388
  class="pf-c-jump-links__item pf-m-current"
384
389
  >
385
390
  <a
@@ -1,6 +1,8 @@
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 { Page } from '../Page';
5
7
  import { PageHeader } from '../PageHeader';
6
8
  import { PageSidebar } from '../PageSidebar';
@@ -18,135 +20,88 @@ const props = {
18
20
  className: 'my-page-class'
19
21
  };
20
22
 
21
- test('Check page vertical layout example against snapshot', () => {
22
- const Header = <PageHeader logo="Logo" headerTools="PageHeaderTools | Avatar" onNavToggle={() => undefined} />;
23
- const Sidebar = <PageSidebar nav="Navigation" isNavOpen />;
24
- const view = render(
25
- <Page {...props} header={Header} sidebar={Sidebar}>
26
- <PageSection variant="default">Section with default background</PageSection>
27
- <PageSection variant="light">Section with light background</PageSection>
28
- <PageSection variant="dark">Section with dark background</PageSection>
29
- <PageSection variant="darker">Section with darker background</PageSection>
30
- </Page>
31
- );
32
- expect(view.container).toMatchSnapshot();
33
- });
23
+ describe('Page', () => {
24
+ test('Check page vertical layout example against snapshot', () => {
25
+ const Header = <PageHeader logo="Logo" headerTools="PageHeaderTools | Avatar" onNavToggle={() => undefined} />;
26
+ const Sidebar = <PageSidebar nav="Navigation" isNavOpen />;
34
27
 
35
- test('Check dark page against snapshot', () => {
36
- const Header = <PageHeader logo="Logo" headerTools="PageHeaderTools | Avatar" onNavToggle={() => undefined} />;
37
- const Sidebar = <PageSidebar nav="Navigation" isNavOpen theme="dark" />;
38
- const view = render(
39
- <Page {...props} header={Header} sidebar={Sidebar}>
40
- <PageSection variant="default">Section with default background</PageSection>
41
- <PageSection variant="light">Section with light background</PageSection>
42
- <PageSection variant="dark">Section with dark background</PageSection>
43
- <PageSection variant="darker">Section with darker background</PageSection>
44
- </Page>
45
- );
46
- expect(view.container).toMatchSnapshot();
47
- });
28
+ const { asFragment } = render(
29
+ <Page {...props} header={Header} sidebar={Sidebar}>
30
+ <PageSection variant="default">Section with default background</PageSection>
31
+ <PageSection variant="light">Section with light background</PageSection>
32
+ <PageSection variant="dark">Section with dark background</PageSection>
33
+ <PageSection variant="darker">Section with darker background</PageSection>
34
+ </Page>
35
+ );
48
36
 
49
- test('Check page horizontal layout example against snapshot', () => {
50
- const Header = <PageHeader logo="Logo" headerTools="PageHeaderTools | Avatar" topNav="Navigation" />;
51
- const Sidebar = <PageSidebar isNavOpen />;
52
- const view = render(
53
- <Page {...props} header={Header} sidebar={Sidebar}>
54
- <PageSection variant="default">Section with default background</PageSection>
55
- <PageSection variant="light">Section with light background</PageSection>
56
- <PageSection variant="dark">Section with dark background</PageSection>
57
- <PageSection variant="darker">Section with darker background</PageSection>
58
- </Page>
59
- );
60
- expect(view.container).toMatchSnapshot();
61
- });
37
+ expect(asFragment()).toMatchSnapshot();
38
+ });
62
39
 
63
- test('Check page to verify breadcrumb is created', () => {
64
- const Header = <PageHeader logo="Logo" headerTools="PageHeaderTools | Avatar" topNav="Navigation" />;
65
- const Sidebar = <PageSidebar isNavOpen />;
66
- const PageBreadcrumb = () => (
67
- <Breadcrumb>
68
- <BreadcrumbItem>Section Home</BreadcrumbItem>
69
- <BreadcrumbItem to="#">Section Title</BreadcrumbItem>
70
- <BreadcrumbItem to="#">Section Title</BreadcrumbItem>
71
- <BreadcrumbItem to="#" isActive>
72
- Section Landing
73
- </BreadcrumbItem>
74
- </Breadcrumb>
75
- );
76
- const view = mount(
77
- <Page {...props} header={Header} sidebar={Sidebar} breadcrumb={<PageBreadcrumb />}>
78
- <PageSection variant="default">Section with default background</PageSection>
79
- <PageSection variant="light">Section with light background</PageSection>
80
- <PageSection variant="dark">Section with dark background</PageSection>
81
- <PageSection variant="darker">Section with darker background</PageSection>
82
- </Page>
83
- );
84
- expect(view).toMatchSnapshot();
85
- expect(view.find('.pf-c-page__main').getDOMNode().id).toBe('');
86
- });
40
+ test('Check dark page against snapshot', () => {
41
+ const Header = <PageHeader logo="Logo" headerTools="PageHeaderTools | Avatar" onNavToggle={() => undefined} />;
42
+ const Sidebar = <PageSidebar nav="Navigation" isNavOpen theme="dark" />;
87
43
 
88
- test('Check page to verify breadcrumb is created - PageBreadcrumb syntax', () => {
89
- const Header = <PageHeader logo="Logo" headerTools="PageHeaderTools | Avatar" topNav="Navigation" />;
90
- const Sidebar = <PageSidebar isNavOpen />;
44
+ const { asFragment } = render(
45
+ <Page {...props} header={Header} sidebar={Sidebar}>
46
+ <PageSection variant="default">Section with default background</PageSection>
47
+ <PageSection variant="light">Section with light background</PageSection>
48
+ <PageSection variant="dark">Section with dark background</PageSection>
49
+ <PageSection variant="darker">Section with darker background</PageSection>
50
+ </Page>
51
+ );
91
52
 
92
- const view = mount(
93
- <Page {...props} header={Header} sidebar={Sidebar}>
94
- <PageBreadcrumb>
95
- <Breadcrumb>
96
- <BreadcrumbItem>Section Home</BreadcrumbItem>
97
- <BreadcrumbItem to="#">Section Title</BreadcrumbItem>
98
- <BreadcrumbItem to="#">Section Title</BreadcrumbItem>
99
- <BreadcrumbItem to="#" isActive>
100
- Section Landing
101
- </BreadcrumbItem>
102
- </Breadcrumb>
103
- </PageBreadcrumb>
104
- <PageSection variant="default">Section with default background</PageSection>
105
- <PageSection variant="light">Section with light background</PageSection>
106
- <PageSection variant="dark">Section with dark background</PageSection>
107
- <PageSection variant="darker">Section with darker background</PageSection>
108
- </Page>
109
- );
110
- expect(view).toMatchSnapshot();
111
- expect(view.find('.pf-c-page__main').getDOMNode().id).toBe('');
112
- });
53
+ expect(asFragment()).toMatchSnapshot();
54
+ });
113
55
 
114
- test('Check page to verify nav is created - PageNavigation syntax', () => {
115
- const Header = <PageHeader logo="Logo" headerTools="PageHeaderTools | Avatar" topNav="Navigation" />;
116
- const Sidebar = <PageSidebar isNavOpen />;
56
+ test('Check page horizontal layout example against snapshot', () => {
57
+ const Header = <PageHeader logo="Logo" headerTools="PageHeaderTools | Avatar" topNav="Navigation" />;
58
+ const Sidebar = <PageSidebar isNavOpen />;
117
59
 
118
- const view = mount(
119
- <Page {...props} header={Header} sidebar={Sidebar}>
120
- <PageNavigation>
121
- <Nav aria-label="Nav" variant="tertiary">
122
- <NavList>
123
- <NavItem itemId={0} isActive>
124
- System Panel
125
- </NavItem>
126
- <NavItem itemId={1}>Policy</NavItem>
127
- <NavItem itemId={2}>Authentication</NavItem>
128
- <NavItem itemId={3}>Network Services</NavItem>
129
- <NavItem itemId={4}>Server</NavItem>
130
- </NavList>
131
- </Nav>
132
- </PageNavigation>
133
- <PageSection variant="default">Section with default background</PageSection>
134
- <PageSection variant="light">Section with light background</PageSection>
135
- <PageSection variant="dark">Section with dark background</PageSection>
136
- <PageSection variant="darker">Section with darker background</PageSection>
137
- </Page>
138
- );
139
- expect(view).toMatchSnapshot();
140
- expect(view.find('.pf-c-page__main').getDOMNode().id).toBe('');
141
- });
60
+ const { asFragment } = render(
61
+ <Page {...props} header={Header} sidebar={Sidebar}>
62
+ <PageSection variant="default">Section with default background</PageSection>
63
+ <PageSection variant="light">Section with light background</PageSection>
64
+ <PageSection variant="dark">Section with dark background</PageSection>
65
+ <PageSection variant="darker">Section with darker background</PageSection>
66
+ </Page>
67
+ );
142
68
 
143
- test('Check page to verify grouped nav and breadcrumb - new components syntax', () => {
144
- const Header = <PageHeader logo="Logo" headerTools="PageHeaderTools | Avatar" topNav="Navigation" />;
145
- const Sidebar = <PageSidebar isNavOpen />;
69
+ expect(asFragment()).toMatchSnapshot();
70
+ });
71
+
72
+ test('Check page to verify breadcrumb is created', () => {
73
+ const Header = <PageHeader logo="Logo" headerTools="PageHeaderTools | Avatar" topNav="Navigation" />;
74
+ const Sidebar = <PageSidebar isNavOpen />;
75
+ const PageBreadcrumb = () => (
76
+ <Breadcrumb>
77
+ <BreadcrumbItem>Section Home</BreadcrumbItem>
78
+ <BreadcrumbItem to="#">Section Title</BreadcrumbItem>
79
+ <BreadcrumbItem to="#">Section Title</BreadcrumbItem>
80
+ <BreadcrumbItem to="#" isActive>
81
+ Section Landing
82
+ </BreadcrumbItem>
83
+ </Breadcrumb>
84
+ );
146
85
 
147
- const view = mount(
148
- <Page {...props} header={Header} sidebar={Sidebar}>
149
- <PageGroup sticky="bottom">
86
+ const { asFragment } = render(
87
+ <Page {...props} header={Header} sidebar={Sidebar} breadcrumb={<PageBreadcrumb />}>
88
+ <PageSection variant="default">Section with default background</PageSection>
89
+ <PageSection variant="light">Section with light background</PageSection>
90
+ <PageSection variant="dark">Section with dark background</PageSection>
91
+ <PageSection variant="darker">Section with darker background</PageSection>
92
+ </Page>
93
+ );
94
+
95
+ expect(screen.getByRole('main')).not.toHaveAttribute('id');
96
+ expect(asFragment()).toMatchSnapshot();
97
+ });
98
+
99
+ test('Check page to verify breadcrumb is created - PageBreadcrumb syntax', () => {
100
+ const Header = <PageHeader logo="Logo" headerTools="PageHeaderTools | Avatar" topNav="Navigation" />;
101
+ const Sidebar = <PageSidebar isNavOpen />;
102
+
103
+ const { asFragment } = render(
104
+ <Page {...props} header={Header} sidebar={Sidebar}>
150
105
  <PageBreadcrumb>
151
106
  <Breadcrumb>
152
107
  <BreadcrumbItem>Section Home</BreadcrumbItem>
@@ -157,6 +112,23 @@ test('Check page to verify grouped nav and breadcrumb - new components syntax',
157
112
  </BreadcrumbItem>
158
113
  </Breadcrumb>
159
114
  </PageBreadcrumb>
115
+ <PageSection variant="default">Section with default background</PageSection>
116
+ <PageSection variant="light">Section with light background</PageSection>
117
+ <PageSection variant="dark">Section with dark background</PageSection>
118
+ <PageSection variant="darker">Section with darker background</PageSection>
119
+ </Page>
120
+ );
121
+
122
+ expect(screen.getByRole('main')).not.toHaveAttribute('id');
123
+ expect(asFragment()).toMatchSnapshot();
124
+ });
125
+
126
+ test('Check page to verify nav is created - PageNavigation syntax', () => {
127
+ const Header = <PageHeader logo="Logo" headerTools="PageHeaderTools | Avatar" topNav="Navigation" />;
128
+ const Sidebar = <PageSidebar isNavOpen />;
129
+
130
+ const { asFragment } = render(
131
+ <Page {...props} header={Header} sidebar={Sidebar}>
160
132
  <PageNavigation>
161
133
  <Nav aria-label="Nav" variant="tertiary">
162
134
  <NavList>
@@ -170,22 +142,114 @@ test('Check page to verify grouped nav and breadcrumb - new components syntax',
170
142
  </NavList>
171
143
  </Nav>
172
144
  </PageNavigation>
173
- </PageGroup>
174
- <PageSection variant="default">Section with default background</PageSection>
175
- <PageSection variant="light">Section with light background</PageSection>
176
- <PageSection variant="dark">Section with dark background</PageSection>
177
- <PageSection variant="darker">Section with darker background</PageSection>
178
- </Page>
179
- );
180
- expect(view).toMatchSnapshot();
181
- expect(view.find('.pf-c-page__main').getDOMNode().id).toBe('');
182
- });
145
+ <PageSection variant="default">Section with default background</PageSection>
146
+ <PageSection variant="light">Section with light background</PageSection>
147
+ <PageSection variant="dark">Section with dark background</PageSection>
148
+ <PageSection variant="darker">Section with darker background</PageSection>
149
+ </Page>
150
+ );
151
+
152
+ expect(screen.getByRole('main')).not.toHaveAttribute('id');
153
+ expect(asFragment()).toMatchSnapshot();
154
+ });
155
+
156
+ test('Check page to verify grouped nav and breadcrumb - new components syntax', () => {
157
+ const Header = <PageHeader logo="Logo" headerTools="PageHeaderTools | Avatar" topNav="Navigation" />;
158
+ const Sidebar = <PageSidebar isNavOpen />;
159
+
160
+ const { asFragment } = render(
161
+ <Page {...props} header={Header} sidebar={Sidebar}>
162
+ <PageGroup sticky="bottom">
163
+ <PageBreadcrumb>
164
+ <Breadcrumb>
165
+ <BreadcrumbItem>Section Home</BreadcrumbItem>
166
+ <BreadcrumbItem to="#">Section Title</BreadcrumbItem>
167
+ <BreadcrumbItem to="#">Section Title</BreadcrumbItem>
168
+ <BreadcrumbItem to="#" isActive>
169
+ Section Landing
170
+ </BreadcrumbItem>
171
+ </Breadcrumb>
172
+ </PageBreadcrumb>
173
+ <PageNavigation>
174
+ <Nav aria-label="Nav" variant="tertiary">
175
+ <NavList>
176
+ <NavItem itemId={0} isActive>
177
+ System Panel
178
+ </NavItem>
179
+ <NavItem itemId={1}>Policy</NavItem>
180
+ <NavItem itemId={2}>Authentication</NavItem>
181
+ <NavItem itemId={3}>Network Services</NavItem>
182
+ <NavItem itemId={4}>Server</NavItem>
183
+ </NavList>
184
+ </Nav>
185
+ </PageNavigation>
186
+ </PageGroup>
187
+ <PageSection variant="default">Section with default background</PageSection>
188
+ <PageSection variant="light">Section with light background</PageSection>
189
+ <PageSection variant="dark">Section with dark background</PageSection>
190
+ <PageSection variant="darker">Section with darker background</PageSection>
191
+ </Page>
192
+ );
193
+
194
+ expect(screen.getByRole('main')).not.toHaveAttribute('id');
195
+ expect(asFragment()).toMatchSnapshot();
196
+ });
197
+
198
+ test('Check page to verify grouped nav and breadcrumb - old / props syntax', () => {
199
+ const Header = <PageHeader logo="Logo" headerTools="PageHeaderTools | Avatar" topNav="Navigation" />;
200
+ const Sidebar = <PageSidebar isNavOpen />;
201
+ const crumb = (
202
+ <PageBreadcrumb>
203
+ <Breadcrumb>
204
+ <BreadcrumbItem>Section Home</BreadcrumbItem>
205
+ <BreadcrumbItem to="#">Section Title</BreadcrumbItem>
206
+ <BreadcrumbItem to="#">Section Title</BreadcrumbItem>
207
+ <BreadcrumbItem to="#" isActive>
208
+ Section Landing
209
+ </BreadcrumbItem>
210
+ </Breadcrumb>
211
+ </PageBreadcrumb>
212
+ );
213
+ const nav = (
214
+ <Nav aria-label="Nav" variant="tertiary">
215
+ <NavList>
216
+ <NavItem itemId={0} isActive>
217
+ System Panel
218
+ </NavItem>
219
+ <NavItem itemId={1}>Policy</NavItem>
220
+ <NavItem itemId={2}>Authentication</NavItem>
221
+ <NavItem itemId={3}>Network Services</NavItem>
222
+ <NavItem itemId={4}>Server</NavItem>
223
+ </NavList>
224
+ </Nav>
225
+ );
226
+
227
+ const { asFragment } = render(
228
+ <Page
229
+ {...props}
230
+ header={Header}
231
+ sidebar={Sidebar}
232
+ breadcrumb={crumb}
233
+ tertiaryNav={nav}
234
+ isBreadcrumbGrouped
235
+ isTertiaryNavGrouped
236
+ groupProps={{ sticky: 'bottom', hasShadowTop: true }}
237
+ >
238
+ <PageSection variant="default">Section with default background</PageSection>
239
+ <PageSection variant="light">Section with light background</PageSection>
240
+ <PageSection variant="dark">Section with dark background</PageSection>
241
+ <PageSection variant="darker">Section with darker background</PageSection>
242
+ </Page>
243
+ );
183
244
 
184
- test('Check page to verify grouped nav and breadcrumb - old / props syntax', () => {
185
- const Header = <PageHeader logo="Logo" headerTools="PageHeaderTools | Avatar" topNav="Navigation" />;
186
- const Sidebar = <PageSidebar isNavOpen />;
187
- const crumb = (
188
- <PageBreadcrumb>
245
+ expect(screen.getByRole('main')).not.toHaveAttribute('id');
246
+ expect(asFragment()).toMatchSnapshot();
247
+ });
248
+
249
+ test('Check page to verify skip to content points to main content region', () => {
250
+ const Header = <PageHeader logo="Logo" headerTools="PageHeaderTools | Avatar" topNav="Navigation" />;
251
+ const Sidebar = <PageSidebar isNavOpen />;
252
+ const PageBreadcrumb = (
189
253
  <Breadcrumb>
190
254
  <BreadcrumbItem>Section Home</BreadcrumbItem>
191
255
  <BreadcrumbItem to="#">Section Title</BreadcrumbItem>
@@ -194,73 +258,29 @@ test('Check page to verify grouped nav and breadcrumb - old / props syntax', ()
194
258
  Section Landing
195
259
  </BreadcrumbItem>
196
260
  </Breadcrumb>
197
- </PageBreadcrumb>
198
- );
199
- const nav = (
200
- <Nav aria-label="Nav" variant="tertiary">
201
- <NavList>
202
- <NavItem itemId={0} isActive>
203
- System Panel
204
- </NavItem>
205
- <NavItem itemId={1}>Policy</NavItem>
206
- <NavItem itemId={2}>Authentication</NavItem>
207
- <NavItem itemId={3}>Network Services</NavItem>
208
- <NavItem itemId={4}>Server</NavItem>
209
- </NavList>
210
- </Nav>
211
- );
212
- const view = mount(
213
- <Page
214
- {...props}
215
- header={Header}
216
- sidebar={Sidebar}
217
- breadcrumb={crumb}
218
- tertiaryNav={nav}
219
- isBreadcrumbGrouped
220
- isTertiaryNavGrouped
221
- groupProps={{ sticky: 'bottom', hasShadowTop: true }}
222
- >
223
- <PageSection variant="default">Section with default background</PageSection>
224
- <PageSection variant="light">Section with light background</PageSection>
225
- <PageSection variant="dark">Section with dark background</PageSection>
226
- <PageSection variant="darker">Section with darker background</PageSection>
227
- </Page>
228
- );
229
- expect(view).toMatchSnapshot();
230
- expect(view.find('.pf-c-page__main').getDOMNode().id).toBe('');
231
- });
261
+ );
262
+ const mainId = 'main-content-page-layout-test-nav';
263
+ const PageSkipToContent = <SkipToContent href={`#${mainId}`}>Skip to Content</SkipToContent>;
264
+
265
+ const { asFragment } = render(
266
+ <Page
267
+ {...props}
268
+ header={Header}
269
+ sidebar={Sidebar}
270
+ breadcrumb={PageBreadcrumb}
271
+ skipToContent={PageSkipToContent}
272
+ mainContainerId={mainId}
273
+ data-testid="page-test-id"
274
+ >
275
+ <PageSection variant="default">Section with default background</PageSection>
276
+ <PageSection variant="light">Section with light background</PageSection>
277
+ <PageSection variant="dark">Section with dark background</PageSection>
278
+ <PageSection variant="darker">Section with darker background</PageSection>
279
+ </Page>
280
+ );
232
281
 
233
- test('Check page to verify skip to content points to main content region', () => {
234
- const Header = <PageHeader logo="Logo" headerTools="PageHeaderTools | Avatar" topNav="Navigation" />;
235
- const Sidebar = <PageSidebar isNavOpen />;
236
- const PageBreadcrumb = (
237
- <Breadcrumb>
238
- <BreadcrumbItem>Section Home</BreadcrumbItem>
239
- <BreadcrumbItem to="#">Section Title</BreadcrumbItem>
240
- <BreadcrumbItem to="#">Section Title</BreadcrumbItem>
241
- <BreadcrumbItem to="#" isActive>
242
- Section Landing
243
- </BreadcrumbItem>
244
- </Breadcrumb>
245
- );
246
- const mainId = 'main-content-page-layout-test-nav';
247
- const PageSkipToContent = <SkipToContent href={`#${mainId}`}>Skip to Content</SkipToContent>;
248
- const view = mount(
249
- <Page
250
- {...props}
251
- header={Header}
252
- sidebar={Sidebar}
253
- breadcrumb={PageBreadcrumb}
254
- skipToContent={PageSkipToContent}
255
- mainContainerId={mainId}
256
- >
257
- <PageSection variant="default">Section with default background</PageSection>
258
- <PageSection variant="light">Section with light background</PageSection>
259
- <PageSection variant="dark">Section with dark background</PageSection>
260
- <PageSection variant="darker">Section with darker background</PageSection>
261
- </Page>
262
- );
263
- expect(view).toMatchSnapshot();
264
- expect(view.find('.pf-c-page').getDOMNode().id).toBe(props.id);
265
- expect(view.find('.pf-c-page__main').getDOMNode().id).toBe(mainId);
282
+ expect(screen.getByRole('main')).toHaveAttribute('id', mainId);
283
+ expect(screen.getByTestId('page-test-id')).toHaveAttribute('id', props.id);
284
+ expect(asFragment()).toMatchSnapshot();
285
+ });
266
286
  });