blob: d255b00d6107b54a418f4b46298df846a4449d7b (
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
|
import user from '@testing-library/user-event';
import { act, render, screen } from '@test-utils';
import AckeeSelect from './ackee-select';
import { storageKey } from './ackee-select.fixture';
describe('Select', () => {
it('should correctly set default option', () => {
render(<AckeeSelect storageKey={storageKey} 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 storageKey={storageKey} 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');
});
});
|