Skip to content

Commit

Permalink
Add missing Grid tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKVal committed Jul 31, 2015
1 parent 79949af commit aa685bd
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 aa685bd

Please sign in to comment.