blob: ec27922e357b476ba2234c49ac29652c3830c481 (
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
|
import user from '@testing-library/user-event';
import { act, render, screen } from '@test-utils';
import AckeeSelect from './ackee-select';
describe('Select', () => {
it('should correctly set default option', () => {
render(<AckeeSelect initialValue="full" />);
expect(screen.getByRole('combobox')).toHaveValue('full');
expect(screen.queryByRole('combobox')).not.toHaveValue('partial');
});
it('should correctly change value when user choose another option', async () => {
render(<AckeeSelect initialValue="full" />);
await act(async () => {
await user.selectOptions(
screen.getByRole('combobox'),
screen.getByRole('option', { name: 'Partial' })
);
});
expect(screen.getByRole('combobox')).toHaveValue('partial');
expect(screen.queryByRole('combobox')).not.toHaveValue('full');
});
});
|