import { render } from '@testing-library/react'; import { ComboboxSelection } from './ComboboxSelection'; import { describe, expect, it } from 'vitest'; const options = [ { label: 'Apple', value: 'apple' }, { label: 'Orange', value: 'orange' }, { label: 'Banana', value: 'banana' }, ]; describe('Selection component', () => { it('should render correctly with default props', () => { const { container } = render(); expect(container.firstChild).toMatchSnapshot(); }); it('should render correctly when it is editable', () => { const { container } = render( ); expect(container.firstChild).toMatchSnapshot(); }); it('should render correctly when it is expanded', () => { const { container } = render( ); expect(container.firstChild).toMatchSnapshot(); }); it('should render correctly when it is disabled', () => { const { container } = render( ); expect(container.firstChild).toMatchSnapshot(); }); it('should render the selected option when there is a selection', () => { const { getByText } = render( ); expect(getByText('apple - Apple')).toBeInTheDocument(); }); it('should not render the input when it is not editable', () => { const { queryByPlaceholderText } = render( ); expect(queryByPlaceholderText('Search fruits')).not.toBeInTheDocument(); }); });