import React, { useState } from 'react'; import { cleanup } from '@testing-library/react'; import { render } from '../../../utils/theme-render-wrapper'; import type { DropDownMenuProps } from '../../dropdown-menu'; import { Select } from './select'; afterEach(cleanup); const listItems = [{ name: 'Ini' }, { name: 'Mini' }, { name: 'Miny' }, { name: 'Mo' }]; describe(' () => setSelectValue(name.toString()), listItems }} /> ); }; const { queryByTestId, queryByText } = render(); const selectEl = queryByTestId('select'); selectEl?.click(); const itemEl = queryByText(listItems[0].name); itemEl?.click(); }); it(`Should render Select with multiple choice`, () => { const Wrapper = () => { const [multipleSelectValues, setMultipleSelectValues] = useState([]); const handleMultipleValuesChange: NonNullable = newValue => () => { const index = multipleSelectValues.findIndex(item => item === newValue); setMultipleSelectValues( index === -1 ? multipleSelectValues.concat(newValue.toString()) : multipleSelectValues .slice(0, index) .concat(multipleSelectValues.slice(index + 1, multipleSelectValues.length)) ); }; return ( ); const el = queryByText(name); expect(el).toBeTruthy(); }); it(`Should render Select with single choice and value`, () => { const name = 'name'; const value = 'value'; const { queryByText } = render( () => setSelectValue(name.toString()), listItems }} /> ); }; render(); }); it(`Should activate callback function`, () => { const handleSelectClickCB = jest.fn(); const { queryByTestId } = render(