@@ -4,17 +4,22 @@ import { PageFooter } from '../PageFooter';
44
55test ( 'Renders children' , ( ) => {
66 render ( < PageFooter > Footer content</ PageFooter > ) ;
7- expect ( screen . getByText ( 'Footer content' ) ) . toBeVisible ( ) ;
7+ expect ( screen . getByRole ( 'contentinfo' ) ) . toBeVisible ( ) ;
8+ } ) ;
9+
10+ test ( 'Renders without children' , ( ) => {
11+ render ( < PageFooter data-testid = "footer" /> ) ;
12+ expect ( screen . getByTestId ( 'footer' ) ) . toBeVisible ( ) ;
813} ) ;
914
1015test ( `Renders with class ${ styles . pageFooter } by default` , ( ) => {
1116 render ( < PageFooter > Footer content</ PageFooter > ) ;
12- expect ( screen . getByText ( 'Footer content ') ) . toHaveClass ( styles . pageFooter , { exact : true } ) ;
17+ expect ( screen . getByRole ( 'contentinfo ') ) . toHaveClass ( styles . pageFooter , { exact : true } ) ;
1318} ) ;
1419
1520test ( 'Renders as a footer by default' , ( ) => {
1621 render ( < PageFooter > Footer content</ PageFooter > ) ;
17- expect ( screen . getByText ( 'Footer content ') . tagName ) . toBe ( 'FOOTER' ) ;
22+ expect ( screen . getByRole ( 'contentinfo ') . tagName ) . toBe ( 'FOOTER' ) ;
1823} ) ;
1924
2025test ( 'Renders as a custom component when component is passed' , ( ) => {
@@ -24,10 +29,10 @@ test('Renders as a custom component when component is passed', () => {
2429
2530test ( 'Renders with custom classes when className is passed' , ( ) => {
2631 render ( < PageFooter className = "custom-class" > Footer content</ PageFooter > ) ;
27- expect ( screen . getByText ( 'Footer content ') ) . toHaveClass ( 'custom-class' ) ;
32+ expect ( screen . getByRole ( 'contentinfo ') ) . toHaveClass ( 'custom-class' ) ;
2833} ) ;
2934
3035test ( 'Renders with spread props' , ( ) => {
3136 render ( < PageFooter id = "custom-id" > Footer content</ PageFooter > ) ;
32- expect ( screen . getByText ( 'Footer content ') ) . toHaveAttribute ( 'id' , 'custom-id' ) ;
37+ expect ( screen . getByRole ( 'contentinfo ') ) . toHaveAttribute ( 'id' , 'custom-id' ) ;
3338} ) ;
0 commit comments