From 1a4ae1d1b9b5dd8512255f56d2c82c739a5dd64e Mon Sep 17 00:00:00 2001 From: teloo Date: Thu, 26 Feb 2015 21:55:31 +0900 Subject: [PATCH] [fixed] Fix rendering Navbar header when toggleNavKey is 0 Fixes #415 --- src/Navbar.jsx | 2 +- test/NavbarSpec.jsx | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/Navbar.jsx b/src/Navbar.jsx index a6539dedcf..0bb2f749d3 100644 --- a/src/Navbar.jsx +++ b/src/Navbar.jsx @@ -75,7 +75,7 @@ var Navbar = React.createClass({ return (
- {(this.props.brand || this.props.toggleButton || this.props.toggleNavKey) ? this.renderHeader() : null} + {(this.props.brand || this.props.toggleButton || this.props.toggleNavKey != null) ? this.renderHeader() : null} {ValidComponentChildren.map(this.props.children, this.renderChild)}
diff --git a/test/NavbarSpec.jsx b/test/NavbarSpec.jsx index 3fd34df4f7..b21ce34fe4 100644 --- a/test/NavbarSpec.jsx +++ b/test/NavbarSpec.jsx @@ -124,4 +124,30 @@ describe('Nav', function () { assert.equal(navNode.nodeName, 'UL'); assert.equal(navNode.parentNode.nodeName, 'DIV'); }); + + it('Should add header when toggleNavKey is 0', function () { + var instance = ReactTestUtils.renderIntoDocument( + + + + ); + + var header = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-header'); + + assert.ok(header); + }); + + it('Should add header when toggleNavKey is 1', function () { + var instance = ReactTestUtils.renderIntoDocument( + + + + ); + + var header = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-header'); + + assert.ok(header); + }); });