import { render, screen } from '@testing-library/react'; import { Select } from './Select'; import styles from './Select.module.scss'; const initOptions = [ { value: '0', label: 'first option' }, { value: '1', label: 'second option' }, { value: '2', label: 'third option' }, { value: '3', label: 'fourth option' }, { value: '4', label: 'fifth option' }, ]; describe('select tests', () => { it('renders select', () => { render(); const select = screen.getByLabelText('random text'); expect(select).toBeInTheDocument(); rerender(); expect(inputWrapper).toHaveStyle('grid-template-columns: 7fr 9fr'); rerender(); const inputWrapper = screen.getByTestId('inputWrapper'); const select = screen.getByRole('combobox'); expect(inputWrapper).toHaveClass('className'); expect(select).not.toHaveClass('className'); }); it('renders disabled select', () => { render(); const select = screen.getByRole('combobox'); expect(select).toHaveClass(styles.light, styles.large); expect(select).not.toHaveClass(styles.dark, styles.normal); }); it('renders textarea with error', () => { render(); const select = screen.getByRole('combobox'); expect(ref.current).toBe(select); }); it('renders block select', () => { render(