aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/atoms/forms/fields/input/input.test.tsx
blob: 1692c9e595383bfb6a7c2877ca4d5e2684df0b62 (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
import { render, screen } from '../../../../../../tests/utils';
import { Input } from './input';

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

describe('Input', () => {
  it('renders a text input', () => {
    render(
      <Input
        id="text-field"
        name="text-field"
        onChange={doNothing}
        type="text"
        value=""
      />
    );
    expect(screen.getByRole('textbox')).toHaveAttribute('type', 'text');
  });

  it('renders a search input', () => {
    render(
      <Input
        id="search-field"
        name="search-field"
        onChange={doNothing}
        type="search"
        value=""
      />
    );
    expect(screen.getByRole('searchbox')).toHaveAttribute('type', 'search');
  });
});