blob: ff1113d433d6e3513097cad214d47e82d82a4bc0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import React from 'react';
import TestUtils from 'react-dom/test-utils';
import expect from 'expect';
import TextareaAutosize from '../../lib';
const renderTextarea = () => {
const component = <TextareaAutosize className='textarea-autosize' />;
const textarea = TestUtils.renderIntoDocument(component);
return textarea;
};
describe('TextareaAutosize', function() {
it('should be displayed', function() {
const textarea = renderTextarea();
const txt = TestUtils.scryRenderedDOMComponentsWithClass(textarea, 'textarea-autosize');
expect(txt.length).toBe(1, 'textarea is not displayed');
});
it('should display initial value', function() {
const initialValue = 'Initial Value'
const component = <TextareaAutosize className='textarea-autosize' defaultValue={initialValue} />;
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');
});
});
|