aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/molecules/buttons/heading-button.test.tsx
blob: be3865a964232867d802b312eab6ed56ab06d12e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { render, screen } from '@test-utils';
import HeadingButton from './heading-button';

describe('HeadingButton', () => {
  it('renders a button to collapse.', () => {
    render(
      <HeadingButton
        level={2}
        title="The accordion title"
        expanded={true}
        setExpanded={() => null}
      />
    );
    expect(
      screen.getByRole('button', { name: 'Collapse The accordion title' })
    ).toBeInTheDocument();
  });

  it('renders a button to expand.', () => {
    render(
      <HeadingButton
        level={2}
        title="The accordion title"
        expanded={false}
        setExpanded={() => null}
      />
    );
    expect(
      screen.getByRole('button', { name: 'Expand The accordion title' })
    ).toBeInTheDocument();
  });
});