aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/atoms/forms/fieldset/fieldset.test.tsx
blob: 2554d592b60121ea019274a0e080f57ebd370a3a (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
33
34
35
36
import { describe, expect, it } from '@jest/globals';
import { render, screen } from '../../../../../tests/utils';
import { Input } from '../fields';
import { Fieldset } from './fieldset';

describe('fieldset', () => {
  it('renders a fieldset', () => {
    render(
      <Fieldset>
        <Input
          aria-label="A field example"
          id="field"
          name="field"
          type="text"
        />
      </Fieldset>
    );
    expect(screen.getByRole('group')).toBeInTheDocument();
    expect(screen.getByRole('textbox')).not.toBeDisabled();
  });

  it('renders a disabled fieldset', () => {
    render(
      <Fieldset isDisabled>
        <Input
          aria-label="A field example"
          id="field"
          name="field"
          type="text"
        />
      </Fieldset>
    );
    expect(screen.getByRole('group')).toBeInTheDocument();
    expect(screen.getByRole('textbox')).toBeDisabled();
  });
});