You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1008 B
34 lines
1008 B
8 years ago
|
import React from 'react';
|
||
|
import { mount } from 'enzyme';
|
||
|
import AutoComplete from '..';
|
||
7 years ago
|
import focusTest from '../../../tests/shared/focusTest';
|
||
8 years ago
|
|
||
|
describe('AutoComplete with Custom Input Element Render', () => {
|
||
7 years ago
|
focusTest(AutoComplete);
|
||
|
|
||
8 years ago
|
it('AutoComplete with custom Input render perfectly', () => {
|
||
|
const wrapper = mount(
|
||
|
<AutoComplete dataSource={['12345', '23456', '34567']}>
|
||
|
<textarea />
|
||
|
</AutoComplete>
|
||
|
);
|
||
|
|
||
|
expect(wrapper.find('textarea').length).toBe(1);
|
||
|
wrapper.find('textarea').simulate('change', { target: { value: '123' } });
|
||
7 years ago
|
const dropdownWrapper = mount(wrapper.find('Trigger').instance().getComponent());
|
||
8 years ago
|
|
||
8 years ago
|
// should not filter data source defaultly
|
||
8 years ago
|
expect(dropdownWrapper.find('MenuItem').length).toBe(3);
|
||
8 years ago
|
});
|
||
7 years ago
|
|
||
|
it('child.ref should work', () => {
|
||
|
const mockRef = jest.fn();
|
||
|
mount(
|
||
|
<AutoComplete dataSource={[]}>
|
||
|
<input ref={mockRef} />
|
||
|
</AutoComplete>
|
||
|
);
|
||
|
expect(mockRef).toHaveBeenCalled();
|
||
|
});
|
||
8 years ago
|
});
|