From aa685bd444c1f6ba33a1be442a6a9eead776c950 Mon Sep 17 00:00:00 2001 From: AlexKVal Date: Fri, 31 Jul 2015 20:58:58 +0300 Subject: [PATCH] Add missing Grid tests --- test/GridSpec.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 test/GridSpec.js diff --git a/test/GridSpec.js b/test/GridSpec.js new file mode 100644 index 0000000000..294800f3af --- /dev/null +++ b/test/GridSpec.js @@ -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( + + ); + + assert.equal(React.findDOMNode(instance).nodeName, 'DIV'); + }); + + it('has "container" class by default', function () { + let instance = ReactTestUtils.renderIntoDocument( + + ); + assert.equal(React.findDOMNode(instance).className, 'container'); + }); + + it('turns grid into "full-width" layout via "fluid" property set', function () { + let instance = ReactTestUtils.renderIntoDocument( + + ); + assert.equal(React.findDOMNode(instance).className, 'container-fluid'); + }); + + it('should merge additional classes passed in', function () { + let instance = ReactTestUtils.renderIntoDocument( + + ); + 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( + + ); + + assert.equal(React.findDOMNode(instance).nodeName, 'SECTION'); + }); +});