File tree Expand file tree Collapse file tree
packages/react-core/src/components/Page Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export interface PageHeaderProps extends React.HTMLProps<HTMLElement> {
1313export const PageHeader : React . FunctionComponent < PageHeaderProps > = ( {
1414 className,
1515 children,
16- component = 'div ' ,
16+ component = 'header ' ,
1717 ...props
1818} : PageHeaderProps ) => {
1919 const Component = component as any ;
Original file line number Diff line number Diff line change @@ -9,17 +9,17 @@ test('Renders children', () => {
99
1010test ( `Renders with class ${ styles . pageHeader } by default` , ( ) => {
1111 render ( < PageHeader > Header content</ PageHeader > ) ;
12- expect ( screen . getByText ( 'Header content' ) ) . toHaveClass ( styles . pageHeader ) ;
12+ expect ( screen . getByText ( 'Header content' ) ) . toHaveClass ( styles . pageHeader , { exact : true } ) ;
1313} ) ;
1414
1515test ( 'Renders as a div by default' , ( ) => {
1616 render ( < PageHeader > Header content</ PageHeader > ) ;
17- expect ( screen . getByText ( 'Header content' ) . tagName ) . toBe ( 'DIV ' ) ;
17+ expect ( screen . getByText ( 'Header content' ) . tagName ) . toBe ( 'HEADER ' ) ;
1818} ) ;
1919
2020test ( 'Renders as a custom component when component is passed' , ( ) => {
21- render ( < PageHeader component = "header " > Header content</ PageHeader > ) ;
22- expect ( screen . getByText ( 'Header content' ) . tagName ) . toBe ( 'HEADER ' ) ;
21+ render ( < PageHeader component = "div " > Header content</ PageHeader > ) ;
22+ expect ( screen . getByText ( 'Header content' ) . tagName ) . toBe ( 'DIV ' ) ;
2323} ) ;
2424
2525test ( 'Renders with custom classes when className is passed' , ( ) => {
Original file line number Diff line number Diff line change 1- import {
2- Page ,
3- PageHeader ,
4- Masthead ,
5- MastheadMain ,
6- MastheadBrand ,
7- MastheadLogo ,
8- MastheadContent ,
9- PageSection ,
10- Toolbar ,
11- ToolbarContent ,
12- ToolbarItem
13- } from '@patternfly/react-core' ;
1+ import { Page , PageHeader , PageSection } from '@patternfly/react-core' ;
142
153export const PageHeaderContent : React . FunctionComponent = ( ) => {
16- const headerToolbar = (
17- < Toolbar id = "page-header-content-toolbar" >
18- < ToolbarContent >
19- < ToolbarItem > header-tools</ ToolbarItem >
20- </ ToolbarContent >
21- </ Toolbar >
22- ) ;
23-
24- const pageHeader = (
25- < PageHeader >
26- < Masthead >
27- < MastheadMain >
28- < MastheadBrand >
29- < MastheadLogo href = "https://patternfly.org" target = "_blank" >
30- Logo
31- </ MastheadLogo >
32- </ MastheadBrand >
33- </ MastheadMain >
34- < MastheadContent > { headerToolbar } </ MastheadContent >
35- </ Masthead >
36- </ PageHeader >
37- ) ;
4+ const pageHeader = < PageHeader > Page header</ PageHeader > ;
385
396 return (
407 < Page masthead = { pageHeader } >
41- < PageSection aria-labelledby = "section-1" >
42- < h2 id = "section-1" > Page header example section 1</ h2 >
8+ < PageSection aria-labelledby = "header-example- section-1" >
9+ < h2 id = "header-example- section-1" > Page header example section 1</ h2 >
4310 </ PageSection >
44- < PageSection variant = "secondary" aria-labelledby = "section-2" >
45- < h2 id = "section-2" > Page header example section 2 with secondary variant styling</ h2 >
11+ < PageSection variant = "secondary" aria-labelledby = "header-example- section-2" >
12+ < h2 id = "header-example- section-2" > Page header example section 2 with secondary variant styling</ h2 >
4613 </ PageSection >
47- < PageSection aria-labelledby = "section-3" >
48- < h2 id = "section-3" > Page header example section 3</ h2 >
14+ < PageSection aria-labelledby = "header-example- section-3" >
15+ < h2 id = "header-example- section-3" > Page header example section 3</ h2 >
4916 </ PageSection >
5017 </ Page >
5118 ) ;
You can’t perform that action at this time.
0 commit comments