diff --git a/components/input/__tests__/index.test.js b/components/input/__tests__/index.test.js index 6c56b1f5ee..fa7a3bd8db 100644 --- a/components/input/__tests__/index.test.js +++ b/components/input/__tests__/index.test.js @@ -88,16 +88,30 @@ describe('Input', () => { focusTest(TextArea); 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]; + }, + }), + }); jest.useFakeTimers(); }); afterAll(() => { + Object.defineProperty(window, 'getComputedStyle', { + value: originalGetComputedStyle, + }); jest.useRealTimers(); }); it('should auto calculate height according to content length', () => { - const wrapper = mount(