forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMediaBodySpec.js
More file actions
50 lines (40 loc) · 1.39 KB
/
MediaBodySpec.js
File metadata and controls
50 lines (40 loc) · 1.39 KB
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
49
50
import React from 'react';
import ReactTestUtils from 'react-addons-test-utils';
import ReactDOM from 'react-dom';
import Media from '../src/Media';
describe('<Media.Body>', () => {
it('uses "div" by default', () => {
const instance = ReactTestUtils.renderIntoDocument(
<Media.Body />
);
assert.equal(ReactDOM.findDOMNode(instance).nodeName, 'DIV');
});
it('has "media-body" class', () => {
const instance = ReactTestUtils.renderIntoDocument(
<Media.Body />
);
assert.include(ReactDOM.findDOMNode(instance).className, 'media-body');
});
it('should merge additional classes passed in', () => {
const instance = ReactTestUtils.renderIntoDocument(
<Media.Body className="custom-class" />
);
const classes = ReactDOM.findDOMNode(instance).className;
assert.include(classes, 'media-body');
assert.include(classes, 'custom-class');
});
it('should allow custom elements instead of "div"', () => {
const instance = ReactTestUtils.renderIntoDocument(
<Media.Body componentClass="section" />
);
assert.equal(ReactDOM.findDOMNode(instance).nodeName, 'SECTION');
});
it('should render children', () => {
const instance = ReactTestUtils.renderIntoDocument(
<Media.Body>
<strong>Content</strong>
</Media.Body>
);
assert.ok(ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'strong'));
});
});