|
|
|
@ -52,4 +52,25 @@ describe('AutoComplete children could be focus', () => {
|
|
|
|
|
jest.runAllTimers();
|
|
|
|
|
expect(handleBlur).toHaveBeenCalled();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('child.ref should work', () => {
|
|
|
|
|
const mockRef = jest.fn();
|
|
|
|
|
mount(
|
|
|
|
|
<AutoComplete dataSource={[]}>
|
|
|
|
|
<input ref={mockRef} />
|
|
|
|
|
</AutoComplete>,
|
|
|
|
|
);
|
|
|
|
|
expect(mockRef).toHaveBeenCalled();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('child.ref instance should support be focused and blured', () => {
|
|
|
|
|
let inputRef;
|
|
|
|
|
mount(
|
|
|
|
|
<AutoComplete dataSource={[]}>
|
|
|
|
|
<input ref={node => { inputRef = node; }} />
|
|
|
|
|
</AutoComplete>,
|
|
|
|
|
);
|
|
|
|
|
expect(typeof inputRef.focus).toBe('function');
|
|
|
|
|
expect(typeof inputRef.blur).toBe('function');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|