forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request react-bootstrap#1094 from AlexKVal/grid-spec
Add missing Grid tests
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); | ||
}); |