@patternfly/react-core 4.202.30 → 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 (56) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +5 -5
  3. package/src/components/Dropdown/__tests__/DropdownToggleCheckbox.test.tsx +1 -1
  4. package/src/components/Page/__tests__/Page.test.tsx +225 -205
  5. package/src/components/Page/__tests__/__snapshots__/Page.test.tsx.snap +1088 -2059
  6. package/src/components/Pagination/__tests__/Pagination.test.tsx +235 -283
  7. package/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +143 -577
  8. package/src/components/Radio/__tests__/Radio.test.tsx +38 -44
  9. package/src/components/Radio/__tests__/__snapshots__/Radio.test.tsx.snap +30 -30
  10. package/src/components/SearchInput/__tests__/SearchInput.test.tsx +87 -68
  11. package/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +230 -137
  12. package/src/components/Select/__tests__/Select.test.tsx +238 -195
  13. package/src/components/Select/__tests__/SelectToggle.test.tsx +68 -130
  14. package/src/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +978 -2149
  15. package/src/components/Select/__tests__/__snapshots__/SelectToggle.test.tsx.snap +3 -3
  16. package/src/components/SimpleList/__tests__/SimpleList.test.tsx +29 -32
  17. package/src/components/SimpleList/__tests__/__snapshots__/SimpleList.test.tsx.snap +4 -366
  18. package/src/components/Switch/__tests__/Switch.test.tsx +85 -75
  19. package/src/components/Switch/__tests__/__snapshots__/Switch.test.tsx.snap +30 -40
  20. package/src/components/TextArea/__tests__/TextArea.test.tsx +98 -103
  21. package/src/components/TextArea/__tests__/__snapshots__/TextArea.test.tsx.snap +24 -103
  22. package/src/components/TextInput/__tests__/TextInput.test.tsx +71 -70
  23. package/src/components/TextInput/__tests__/__snapshots__/TextInput.test.tsx.snap +15 -103
  24. package/src/components/TextInputGroup/__tests__/TextInputGroup.test.tsx +65 -39
  25. package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroup.test.tsx.snap +53 -14
  26. package/src/components/TimePicker/__tests__/TimePicker.test.tsx +113 -110
  27. package/src/components/Title/__tests__/Title.test.tsx +21 -20
  28. package/src/components/Title/__tests__/__snapshots__/Title.test.tsx.snap +24 -30
  29. package/src/components/ToggleGroup/__tests__/ToggleGroup.test.tsx +43 -39
  30. package/src/components/ToggleGroup/__tests__/__snapshots__/ToggleGroup.test.tsx.snap +20 -19
  31. package/src/components/Wizard/__tests__/Wizard.test.tsx +195 -189
  32. package/src/components/Wizard/__tests__/__snapshots__/Wizard.test.tsx.snap +131 -10
  33. package/src/helpers/__tests__/util.test.ts +113 -0
  34. package/src/layouts/Bullseye/__tests__/Bullseye.test.tsx +25 -25
  35. package/src/layouts/Bullseye/__tests__/__snapshots__/Bullseye.test.tsx.snap +3 -5
  36. package/src/layouts/Flex/__tests__/Flex.test.tsx +159 -96
  37. package/src/layouts/Flex/__tests__/__snapshots__/Flex.test.tsx.snap +9 -17
  38. package/src/components/Page/__tests__/Generated/Page.test.tsx +0 -28
  39. package/src/components/Page/__tests__/Generated/__snapshots__/Page.test.tsx.snap +0 -19
  40. package/src/components/Pagination/__tests__/Generated/Pagination.test.tsx +0 -58
  41. package/src/components/Pagination/__tests__/Generated/__snapshots__/Pagination.test.tsx.snap +0 -205
  42. package/src/components/Radio/__tests__/Generated/Radio.test.tsx +0 -29
  43. package/src/components/Radio/__tests__/Generated/__snapshots__/Radio.test.tsx.snap +0 -36
  44. package/src/components/Select/__tests__/Generated/Select.test.tsx +0 -49
  45. package/src/components/Select/__tests__/Generated/SelectToggle.test.tsx +0 -34
  46. package/src/components/Select/__tests__/Generated/__snapshots__/Select.test.tsx.snap +0 -48
  47. package/src/components/Select/__tests__/Generated/__snapshots__/SelectToggle.test.tsx.snap +0 -36
  48. package/src/components/SimpleList/__tests__/Generated/SimpleList.test.tsx +0 -22
  49. package/src/components/SimpleList/__tests__/Generated/__snapshots__/SimpleList.test.tsx.snap +0 -13
  50. package/src/components/Switch/__tests__/Generated/Switch.test.tsx +0 -24
  51. package/src/components/Switch/__tests__/Generated/__snapshots__/Switch.test.tsx.snap +0 -36
  52. package/src/components/TextArea/__tests__/Generated/TextArea.test.tsx +0 -23
  53. package/src/components/TextArea/__tests__/Generated/__snapshots__/TextArea.test.tsx.snap +0 -13
  54. package/src/components/Title/__tests__/Generated/Title.test.tsx +0 -13
  55. package/src/components/Title/__tests__/Generated/__snapshots__/Title.test.tsx.snap +0 -12
  56. package/src/helpers/__tests__/util.test.js +0 -235
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 4.202.31 (2022-04-13)
7
+
8
+ **Note:** Version bump only for package @patternfly/react-core
9
+
10
+
11
+
12
+
13
+
6
14
  ## 4.202.30 (2022-04-13)
7
15
 
8
16
  **Note:** Version bump only for package @patternfly/react-core
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.202.30",
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.30",
38
- "@patternfly/react-styles": "^4.52.30",
39
- "@patternfly/react-tokens": "^4.54.30",
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": "7154950167e076ddf7e1a596583caa434e7c30a9"
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
  });
@@ -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
  });