import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; import React from 'react'; import Input from '..'; import { fireEvent, render } from '../../../tests/utils'; import type { InputRef } from '../Input'; import type { TextAreaRef } from '../TextArea'; const { TextArea } = Input; describe('Input.Focus', () => { let inputSpy: ReturnType; let textareaSpy: ReturnType; let focus: ReturnType; let setSelectionRange: ReturnType; beforeEach(() => { focus = jest.fn(); setSelectionRange = jest.fn(); inputSpy = spyElementPrototypes(HTMLInputElement, { focus, setSelectionRange, }); textareaSpy = spyElementPrototypes(HTMLTextAreaElement, { focus, setSelectionRange, }); }); afterEach(() => { inputSpy.mockRestore(); textareaSpy.mockRestore(); }); it('start', () => { const ref = React.createRef(); render(