forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThumbnailSpec.js
49 lines (43 loc) · 1.6 KB
/
ThumbnailSpec.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
49
import React from 'react';
import ReactTestUtils from 'react/lib/ReactTestUtils';
import ReactDOM from 'react-dom';
import Thumbnail from '../src/Thumbnail';
describe('Thumbnail', () => {
it('Should have a thumbnail class and be an anchor', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Thumbnail href="#" src="#" alt="test" />
);
assert.ok(ReactDOM.findDOMNode(instance).className.match(/\bthumbnail\b/));
assert.ok(ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'a'));
});
it('Should have an image', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Thumbnail href="#" src="#" alt="test" />
);
assert.ok(ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'img'));
});
it('Should have a thumbnail class and be a div', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Thumbnail src="#" alt="test" />
);
assert.ok(ReactDOM.findDOMNode(instance).className.match(/\bthumbnail\b/));
assert.equal(ReactDOM.findDOMNode(instance).nodeName, 'DIV');
});
it('Should have an image', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Thumbnail src="#" alt="test" />
);
assert.ok(ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'img'));
});
it('Should have an inner div with class caption', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Thumbnail src="#" alt="test">
Test
<div>
Test child element
</div>
</Thumbnail>
);
assert.ok(ReactDOM.findDOMNode(instance).lastChild.className.match(/\bcaption\b/));
});
});