import type { FC } from 'react'; import { useIntl } from 'react-intl'; import { Copyright, Footer, type CopyrightProps } from '../../atoms'; import { BackToTop, type BackToTopProps, NavList, type NavItem, } from '../../molecules'; import styles from './site-footer.module.scss'; export type SiteFooterProps = { /** * Set additional classnames to the back to top button. */ backToTopClassName?: BackToTopProps['className']; /** * Set additional classnames to the footer element. */ className?: string; /** * Set the copyright information. */ copyright: CopyrightProps; /** * The footer nav items. */ navItems?: NavItem[]; /** * An element id (without hashtag) used as anchor for back to top button. */ topId: string; }; /** * SiteFooter component * * Renders a footer with copyright and nav; */ export const SiteFooter: FC = ({ backToTopClassName, className = '', copyright, navItems, topId, }) => { const intl = useIntl(); const ariaLabel = intl.formatMessage({ defaultMessage: 'Footer', description: 'SiteFooter: an accessible name for the footer nav', id: 'pRzkFR', }); const footerClass = `${styles.wrapper} ${className}`; const btnClass = `${styles['back-to-top']} ${backToTopClassName}`; return ( ); }; mponents/atoms/layout/section.test.tsx?h=v2.0.0&id=e305cbbdbc49af575e25957f6ab72ccf944339ec'>commitdiffstats
path: root/src/components/atoms/layout/section.test.tsx
blob: ca5f03a22764dabbdd9a25bf1593cd1afb3bf453 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { render, screen } from '@test-utils';
import Section from './section';

const title = 'Section title';
const content = 'Section content.';

describe('Section', () => {
  it('renders a title (h2)', () => {
    render(<Section title={title} content={content} />);
    expect(screen.getByRole('heading', { level: 2 })).toHaveTextContent(title);
  });

  it('renders a content', () => {
    render(<Section title={title} content={content} />);
    expect(screen.getByText(content)).toBeInTheDocument();
  });
});