-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCarouselCaptionSpec.js
38 lines (31 loc) · 1.21 KB
/
CarouselCaptionSpec.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
import React from 'react';
import ReactDOM from 'react-dom';
import ReactTestUtils from 'react-dom/test-utils';
import Carousel from '../src/Carousel';
describe('<Carousel.Caption>', () => {
it('uses "div" by default', () => {
let instance = ReactTestUtils.renderIntoDocument(<Carousel.Caption />);
assert.equal(ReactDOM.findDOMNode(instance).nodeName, 'DIV');
});
it('has "carousel-caption" class', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Carousel.Caption>Carousel.Caption content</Carousel.Caption>
);
assert.equal(ReactDOM.findDOMNode(instance).className, 'carousel-caption');
});
it('Should merge additional classes passed in', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Carousel.Caption className="bob" />
);
assert.ok(ReactDOM.findDOMNode(instance).className.match(/\bbob\b/));
assert.ok(
ReactDOM.findDOMNode(instance).className.match(/\bcarousel-caption\b/)
);
});
it('allows custom elements instead of "div"', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Carousel.Caption componentClass="section" />
);
assert.equal(ReactDOM.findDOMNode(instance).nodeName, 'SECTION');
});
});