forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGridSpec.js
45 lines (37 loc) · 1.35 KB
/
GridSpec.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
import React from 'react';
import ReactTestUtils from 'react/lib/ReactTestUtils';
import ReactDOM from 'react-dom';
import Grid from '../src/Grid';
describe('Grid', () => {
it('uses "div" by default', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Grid />
);
assert.equal(ReactDOM.findDOMNode(instance).nodeName, 'DIV');
});
it('has "container" class by default', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Grid />
);
assert.equal(ReactDOM.findDOMNode(instance).className, 'container');
});
it('turns grid into "full-width" layout via "fluid" property set', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Grid fluid />
);
assert.equal(ReactDOM.findDOMNode(instance).className, 'container-fluid');
});
it('should merge additional classes passed in', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Grid className="whatever" fluid />
);
assert.ok(ReactDOM.findDOMNode(instance).className.match(/\bwhatever\b/));
assert.ok(ReactDOM.findDOMNode(instance).className.match(/\bcontainer-fluid\b/));
});
it('allows custom elements instead of "div"', () => {
let instance = ReactTestUtils.renderIntoDocument(
<Grid componentClass='section' />
);
assert.equal(ReactDOM.findDOMNode(instance).nodeName, 'SECTION');
});
});