@@ -2,92 +2,102 @@ import { render, screen } from '@testing-library/react';
22import { PageGroup } from '../PageGroup' ;
33import styles from '@patternfly/react-styles/css/components/Page/page' ;
44
5- describe ( 'page group' , ( ) => {
6- test ( 'Verify basic render' , ( ) => {
7- const { asFragment } = render ( < PageGroup > test</ PageGroup > ) ;
8- expect ( asFragment ( ) ) . toMatchSnapshot ( ) ;
9- } ) ;
10- test ( 'Verify top sticky' , ( ) => {
11- const { asFragment } = render ( < PageGroup stickyOnBreakpoint = { { default : 'top' } } > test</ PageGroup > ) ;
12- expect ( asFragment ( ) ) . toMatchSnapshot ( ) ;
13- } ) ;
14- test ( 'Verify bottom sticky' , ( ) => {
15- const { asFragment } = render ( < PageGroup stickyOnBreakpoint = { { default : 'bottom' } } > test</ PageGroup > ) ;
16- expect ( asFragment ( ) ) . toMatchSnapshot ( ) ;
17- } ) ;
18- test ( 'Verify top shadow' , ( ) => {
19- const { asFragment } = render ( < PageGroup hasShadowTop > test</ PageGroup > ) ;
20- expect ( asFragment ( ) ) . toMatchSnapshot ( ) ;
21- } ) ;
22- test ( 'Verify bottom shadow' , ( ) => {
23- const { asFragment } = render ( < PageGroup hasShadowBottom > test</ PageGroup > ) ;
24- expect ( asFragment ( ) ) . toMatchSnapshot ( ) ;
25- } ) ;
26- test ( 'Verify overflow scroll' , ( ) => {
27- const { asFragment } = render ( < PageGroup hasOverflowScroll > test</ PageGroup > ) ;
28- expect ( asFragment ( ) ) . toMatchSnapshot ( ) ;
29- } ) ;
30-
31- test ( 'Renders without an aria-label by default' , ( ) => {
32- render ( < PageGroup > test</ PageGroup > ) ;
33-
34- expect ( screen . getByText ( 'test' ) ) . not . toHaveAccessibleName ( 'Test label' ) ;
35- } ) ;
36-
37- test ( 'Renders with the passed aria-label applied' , ( ) => {
38- render (
39- < PageGroup aria-label = "Test label" hasOverflowScroll >
40- test
41- </ PageGroup >
42- ) ;
43-
44- expect ( screen . getByText ( 'test' ) ) . toHaveAccessibleName ( 'Test label' ) ;
45- } ) ;
46-
47- test ( 'Does not log a warning in the console by default' , ( ) => {
48- const consoleWarning = jest . spyOn ( console , 'warn' ) . mockImplementation ( ) ;
49-
50- render ( < PageGroup > test</ PageGroup > ) ;
51-
52- expect ( consoleWarning ) . not . toHaveBeenCalled ( ) ;
53- } ) ;
54-
55- test ( 'Does not log a warning in the console when an aria-label is included with hasOverflowScroll' , ( ) => {
56- const consoleWarning = jest . spyOn ( console , 'warn' ) . mockImplementation ( ) ;
57-
58- render (
59- < PageGroup hasOverflowScroll aria-label = "Test label" >
60- test
61- </ PageGroup >
62- ) ;
63-
64- expect ( consoleWarning ) . not . toHaveBeenCalled ( ) ;
65- } ) ;
66-
67- test ( 'Logs a warning in the console when an aria-label is not included with hasOverflowScroll' , ( ) => {
68- const consoleWarning = jest . spyOn ( console , 'warn' ) . mockImplementation ( ) ;
69-
70- render ( < PageGroup hasOverflowScroll > test</ PageGroup > ) ;
71-
72- expect ( consoleWarning ) . toHaveBeenCalled ( ) ;
73- } ) ;
74-
75- test ( `Does not render with ${ styles . modifiers . fill } or ${ styles . modifiers . noFill } if isFilled is not passed` , ( ) => {
76- render ( < PageGroup > test</ PageGroup > ) ;
77-
78- expect ( screen . getByText ( 'test' ) ) . not . toHaveClass ( styles . modifiers . fill ) ;
79- expect ( screen . getByText ( 'test' ) ) . not . toHaveClass ( styles . modifiers . noFill ) ;
80- } ) ;
81-
82- test ( `Renders with ${ styles . modifiers . fill } if isFilled={true} is passed` , ( ) => {
83- render ( < PageGroup isFilled = { true } > test</ PageGroup > ) ;
84-
85- expect ( screen . getByText ( 'test' ) ) . toHaveClass ( styles . modifiers . fill ) ;
86- } ) ;
87-
88- test ( `Renders with ${ styles . modifiers . noFill } if isFilled={false} is passed` , ( ) => {
89- render ( < PageGroup isFilled = { false } > test</ PageGroup > ) ;
90-
91- expect ( screen . getByText ( 'test' ) ) . toHaveClass ( styles . modifiers . noFill ) ;
92- } ) ;
5+ test ( 'Verify basic render' , ( ) => {
6+ const { asFragment } = render ( < PageGroup > test</ PageGroup > ) ;
7+ expect ( asFragment ( ) ) . toMatchSnapshot ( ) ;
8+ } ) ;
9+ test ( 'Verify top sticky' , ( ) => {
10+ const { asFragment } = render ( < PageGroup stickyOnBreakpoint = { { default : 'top' } } > test</ PageGroup > ) ;
11+ expect ( asFragment ( ) ) . toMatchSnapshot ( ) ;
12+ } ) ;
13+ test ( 'Verify bottom sticky' , ( ) => {
14+ const { asFragment } = render ( < PageGroup stickyOnBreakpoint = { { default : 'bottom' } } > test</ PageGroup > ) ;
15+ expect ( asFragment ( ) ) . toMatchSnapshot ( ) ;
16+ } ) ;
17+ test ( 'Verify top shadow' , ( ) => {
18+ const { asFragment } = render ( < PageGroup hasShadowTop > test</ PageGroup > ) ;
19+ expect ( asFragment ( ) ) . toMatchSnapshot ( ) ;
20+ } ) ;
21+ test ( 'Verify bottom shadow' , ( ) => {
22+ const { asFragment } = render ( < PageGroup hasShadowBottom > test</ PageGroup > ) ;
23+ expect ( asFragment ( ) ) . toMatchSnapshot ( ) ;
24+ } ) ;
25+ test ( 'Verify overflow scroll' , ( ) => {
26+ const { asFragment } = render ( < PageGroup hasOverflowScroll > test</ PageGroup > ) ;
27+ expect ( asFragment ( ) ) . toMatchSnapshot ( ) ;
28+ } ) ;
29+
30+ test ( 'Renders without an aria-label by default' , ( ) => {
31+ render ( < PageGroup > test</ PageGroup > ) ;
32+
33+ expect ( screen . getByText ( 'test' ) ) . not . toHaveAccessibleName ( 'Test label' ) ;
34+ } ) ;
35+
36+ test ( 'Renders with the passed aria-label applied' , ( ) => {
37+ render (
38+ < PageGroup aria-label = "Test label" hasOverflowScroll >
39+ test
40+ </ PageGroup >
41+ ) ;
42+
43+ expect ( screen . getByText ( 'test' ) ) . toHaveAccessibleName ( 'Test label' ) ;
44+ } ) ;
45+
46+ test ( 'Does not log a warning in the console by default' , ( ) => {
47+ const consoleWarning = jest . spyOn ( console , 'warn' ) . mockImplementation ( ) ;
48+
49+ render ( < PageGroup > test</ PageGroup > ) ;
50+
51+ expect ( consoleWarning ) . not . toHaveBeenCalled ( ) ;
52+ } ) ;
53+
54+ test ( 'Does not log a warning in the console when an aria-label is included with hasOverflowScroll' , ( ) => {
55+ const consoleWarning = jest . spyOn ( console , 'warn' ) . mockImplementation ( ) ;
56+
57+ render (
58+ < PageGroup hasOverflowScroll aria-label = "Test label" >
59+ test
60+ </ PageGroup >
61+ ) ;
62+
63+ expect ( consoleWarning ) . not . toHaveBeenCalled ( ) ;
64+ } ) ;
65+
66+ test ( 'Logs a warning in the console when an aria-label is not included with hasOverflowScroll' , ( ) => {
67+ const consoleWarning = jest . spyOn ( console , 'warn' ) . mockImplementation ( ) ;
68+
69+ render ( < PageGroup hasOverflowScroll > test</ PageGroup > ) ;
70+
71+ expect ( consoleWarning ) . toHaveBeenCalled ( ) ;
72+ } ) ;
73+
74+ test ( `Does not render with ${ styles . modifiers . fill } or ${ styles . modifiers . noFill } if isFilled is not passed` , ( ) => {
75+ render ( < PageGroup > test</ PageGroup > ) ;
76+
77+ expect ( screen . getByText ( 'test' ) ) . not . toHaveClass ( styles . modifiers . fill ) ;
78+ expect ( screen . getByText ( 'test' ) ) . not . toHaveClass ( styles . modifiers . noFill ) ;
79+ } ) ;
80+
81+ test ( `Renders with ${ styles . modifiers . fill } if isFilled={true} is passed` , ( ) => {
82+ render ( < PageGroup isFilled = { true } > test</ PageGroup > ) ;
83+
84+ expect ( screen . getByText ( 'test' ) ) . toHaveClass ( styles . modifiers . fill ) ;
85+ } ) ;
86+
87+ test ( `Renders with ${ styles . modifiers . noFill } if isFilled={false} is passed` , ( ) => {
88+ render ( < PageGroup isFilled = { false } > test</ PageGroup > ) ;
89+
90+ expect ( screen . getByText ( 'test' ) ) . toHaveClass ( styles . modifiers . noFill ) ;
91+ } ) ;
92+
93+ test ( `Renders with ${ styles . modifiers . plain } class when isPlain is true` , ( ) => {
94+ render ( < PageGroup isPlain > test</ PageGroup > ) ;
95+
96+ expect ( screen . getByText ( 'test' ) ) . toHaveClass ( styles . modifiers . plain ) ;
97+ } ) ;
98+
99+ test ( `Renders with ${ styles . modifiers . noPlainOnGlass } class when isNoPlainOnGlass is true` , ( ) => {
100+ render ( < PageGroup isNoPlainOnGlass > test</ PageGroup > ) ;
101+
102+ expect ( screen . getByText ( 'test' ) ) . toHaveClass ( styles . modifiers . noPlainOnGlass ) ;
93103} ) ;
0 commit comments