Skip to content

Commit

Permalink
Merge pull request react-bootstrap#1094 from AlexKVal/grid-spec
Browse files Browse the repository at this point in the history
Add missing Grid tests
  • Loading branch information
taion committed Jul 31, 2015
2 parents 4464101 + aa685bd commit baa0350
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions test/GridSpec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import React from 'react';
import ReactTestUtils from 'react/lib/ReactTestUtils';
import Grid from '../src/Grid';

describe('Grid', function () {
it('uses "div" by default', function () {
let instance = ReactTestUtils.renderIntoDocument(
<Grid />
);

assert.equal(React.findDOMNode(instance).nodeName, 'DIV');
});

it('has "container" class by default', function () {
let instance = ReactTestUtils.renderIntoDocument(
<Grid />
);
assert.equal(React.findDOMNode(instance).className, 'container');
});

it('turns grid into "full-width" layout via "fluid" property set', function () {
let instance = ReactTestUtils.renderIntoDocument(
<Grid fluid />
);
assert.equal(React.findDOMNode(instance).className, 'container-fluid');
});

it('should merge additional classes passed in', function () {
let instance = ReactTestUtils.renderIntoDocument(
<Grid className="whatever" fluid />
);
assert.ok(React.findDOMNode(instance).className.match(/\bwhatever\b/));
assert.ok(React.findDOMNode(instance).className.match(/\bcontainer-fluid\b/));
});

it('allows custom elements instead of "div"', function () {
let instance = ReactTestUtils.renderIntoDocument(
<Grid componentClass='section' />
);

assert.equal(React.findDOMNode(instance).nodeName, 'SECTION');
});
});

0 comments on commit baa0350

Please sign in to comment.