import React from 'react'; import TestUtils from 'react-dom/test-utils'; import expect from 'expect'; import TextareaAutosize from '../../lib'; const renderTextarea = () => { const component = ; const textarea = TestUtils.renderIntoDocument(component); return textarea; }; describe('TextareaAutosize', () => { it('should be displayed', () => { const textarea = renderTextarea(); const txt = TestUtils.scryRenderedDOMComponentsWithClass(textarea, 'textarea-autosize'); expect(txt.length).toBe(1, 'textarea is not displayed'); }); it('should display initial value', () => { const initialValue = 'Initial Value'; const component = ( ); const textarea = TestUtils.renderIntoDocument(component); const txt = TestUtils.findRenderedDOMComponentWithClass(textarea, 'textarea-autosize'); const value = txt.innerHTML; expect(value).toBe(initialValue, 'intial value is not displayed correctly'); }); });