import React from 'react'; import { render, mount, CommonWrapper, ReactWrapper } from 'enzyme'; import { renderToJson, mountToJson } from 'enzyme-to-json'; import { Select } from '../src'; import { options } from '../src/Select/options'; describe('Select', function () { it('renders correctly', () => { const wrapper = render( { // noop }} value="one" menuMaxHeight={20} clearable disabled isLoading multi searchable={false} openOuterUp /> ); expect(renderToJson(wrapper)).toMatchSnapshot(); }); it('should select another option', () => { const onChange = jest.fn(); const wrapper = mount( ); const input = wrapper.find('input'); ((input.at(0).instance() as unknown) as HTMLInputElement).value = 'text'; input.first().simulate('change'); expect(mountToJson(wrapper)).toMatchSnapshot(); // 'No results found' input.first().simulate('keyDown', { keyCode: 13 }); expect(onChange).not.toBeCalled(); }); });