blob: 0089c06a4c22552720af13b51d97a5a970152ce9 (
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 storageKey="ackee-tracking" 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="ackee-tracking" 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');
});
});
|