import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; import React, { useState } from 'react'; import Input from '..'; import focusTest from '../../../tests/shared/focusTest'; import { fireEvent, render, sleep, triggerResize } from '../../../tests/utils'; const { TextArea } = Input; focusTest(TextArea, { refFocus: true }); describe('TextArea', () => { const originalGetComputedStyle = window.getComputedStyle; beforeAll(() => { Object.defineProperty(window, 'getComputedStyle', { value: node => ({ getPropertyValue: prop => { if (prop === 'box-sizing') { return originalGetComputedStyle(node)[prop] || 'border-box'; } return originalGetComputedStyle(node)[prop]; }, }), }); }); afterAll(() => { Object.defineProperty(window, 'getComputedStyle', { value: originalGetComputedStyle, }); }); it('should auto calculate height according to content length', async () => { const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); const ref = React.createRef(); const genTextArea = (props = {}) => (