Skip to content

Commit aa685bd

Browse files
committed
Add missing Grid tests
1 parent 79949af commit aa685bd

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

test/GridSpec.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import React from 'react';
2+
import ReactTestUtils from 'react/lib/ReactTestUtils';
3+
import Grid from '../src/Grid';
4+
5+
describe('Grid', function () {
6+
it('uses "div" by default', function () {
7+
let instance = ReactTestUtils.renderIntoDocument(
8+
<Grid />
9+
);
10+
11+
assert.equal(React.findDOMNode(instance).nodeName, 'DIV');
12+
});
13+
14+
it('has "container" class by default', function () {
15+
let instance = ReactTestUtils.renderIntoDocument(
16+
<Grid />
17+
);
18+
assert.equal(React.findDOMNode(instance).className, 'container');
19+
});
20+
21+
it('turns grid into "full-width" layout via "fluid" property set', function () {
22+
let instance = ReactTestUtils.renderIntoDocument(
23+
<Grid fluid />
24+
);
25+
assert.equal(React.findDOMNode(instance).className, 'container-fluid');
26+
});
27+
28+
it('should merge additional classes passed in', function () {
29+
let instance = ReactTestUtils.renderIntoDocument(
30+
<Grid className="whatever" fluid />
31+
);
32+
assert.ok(React.findDOMNode(instance).className.match(/\bwhatever\b/));
33+
assert.ok(React.findDOMNode(instance).className.match(/\bcontainer-fluid\b/));
34+
});
35+
36+
it('allows custom elements instead of "div"', function () {
37+
let instance = ReactTestUtils.renderIntoDocument(
38+
<Grid componentClass='section' />
39+
);
40+
41+
assert.equal(React.findDOMNode(instance).nodeName, 'SECTION');
42+
});
43+
});

0 commit comments

Comments
 (0)