aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/atoms/forms/fields/radio/radio.test.tsx
blob: ba8d68f51b14494bcf4d7628df6589b184ca3d1f (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
import { describe, expect, it } from '@jest/globals';
import { render, screen } from '../../../../../../tests/utils';
import { Radio } from './radio';

const doNothing = () => {
  // Do nothing
};

describe('Radio', () => {
  it('renders an unchecked radio', () => {
    render(
      <Radio id="radio" name="radio" onChange={doNothing} value="radio" />
    );
    expect(screen.getByRole('radio')).not.toBeChecked();
  });

  it('renders a checked radio', () => {
    render(
      <Radio
        id="radio"
        isChecked
        name="radio"
        onChange={doNothing}
        value="radio"
      />
    );
    expect(screen.getByRole('radio')).toBeChecked();
  });
});