-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModalBodySpec.js
48 lines (38 loc) · 1.38 KB
/
ModalBodySpec.js
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import React from 'react';
import ReactDOM from 'react-dom';
import ReactTestUtils from 'react-dom/test-utils';
import Modal from '../src/Modal';
describe('Modal.Body', () => {
it('uses "div" by default', () => {
const instance = ReactTestUtils.renderIntoDocument(<Modal.Body />);
assert.equal(ReactDOM.findDOMNode(instance).nodeName, 'DIV');
});
it('has "modal-body" class', () => {
const instance = ReactTestUtils.renderIntoDocument(<Modal.Body />);
assert.include(ReactDOM.findDOMNode(instance).className, 'modal-body');
});
it('should merge additional classes passed in', () => {
const instance = ReactTestUtils.renderIntoDocument(
<Modal.Body className="custom-class" />
);
const classes = ReactDOM.findDOMNode(instance).className;
assert.include(classes, 'modal-body');
assert.include(classes, 'custom-class');
});
it('should allow custom elements instead of "div"', () => {
const instance = ReactTestUtils.renderIntoDocument(
<Modal.Body componentClass="section" />
);
assert.equal(ReactDOM.findDOMNode(instance).nodeName, 'SECTION');
});
it('should render children', () => {
const instance = ReactTestUtils.renderIntoDocument(
<Modal.Body>
<strong>Content</strong>
</Modal.Body>
);
assert.ok(
ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'strong')
);
});
});