import React, { useState } from 'react'; import { mount } from 'enzyme'; import { render } from '@testing-library/react'; import '@testing-library/jest-dom'; import RcTextArea from 'rc-textarea'; import Input from '..'; import focusTest from '../../../tests/shared/focusTest'; import { sleep } 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 = {}) => (