import * as React from 'react'; import { renderHook } from '@testing-library/react-hooks'; import { Select } from '../Select'; import render from '../../utils/_tests/render'; import { Size } from '../../types'; describe('props', () => { it('should render correctly', () => { const { container } = render( ); expect(ref.current).toMatchSnapshot(); }); it('should assign a ref via selectRef', () => { const ref = React.createRef(); render( ); expect(container.firstChild).toMatchSnapshot(); }); it('should render correctly with a default value', () => { const { container } = render( ); expect(container.firstChild).toMatchSnapshot(); }); it('should render correctly with isLoading', () => { const { container } = render( ); expect(container.firstChild).toMatchSnapshot(); }); it('should render correctly with name', () => { const { container } = render( ); expect(container.firstChild).toMatchSnapshot(); }); }); it('should render placeholder correctly', () => { const { container } = render( ); expect(container.firstChild).toMatchSnapshot(); }); }); }); describe('composition', () => { describe('hook', () => { it('should return with Select props', () => { const { result } = renderHook(() => Select.useProps({ options: [ { label: 'Sunny', value: 'sunny' }, { label: 'Windy', value: 'windy' }, { label: 'Overcast', value: 'overcast' }, ], }) ); expect(result.current).toMatchSnapshot(); }); }); }); describe('overrides', () => { it('Select.base should render correctly', () => { const { container } = render( , { // @ts-ignore theme: { Select: { styles: { base: { backgroundColor: 'red' } } } }, } ); expect(container.firstChild).toMatchSnapshot(); }); }); describe('defaultProps', () => { it('should render correctly for className', () => { const { container } = render(