Skip to content

Commit

Permalink
[fixed] Fix rendering Navbar header when toggleNavKey is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
teloo committed Feb 26, 2015
1 parent 1ed8d50 commit 1a4ae1d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ var Navbar = React.createClass({
return (
<ComponentClass {...this.props} className={joinClasses(this.props.className, classSet(classes))}>
<div className={this.props.fluid ? 'container-fluid' : 'container'}>
{(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)}
</div>
</ComponentClass>
Expand Down
26 changes: 26 additions & 0 deletions test/NavbarSpec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<Navbar toggleNavKey={0}>
<Nav eventKey={0}>
</Nav>
</Navbar>
);

var header = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-header');

assert.ok(header);
});

it('Should add header when toggleNavKey is 1', function () {
var instance = ReactTestUtils.renderIntoDocument(
<Navbar toggleNavKey={1}>
<Nav eventKey={1}>
</Nav>
</Navbar>
);

var header = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-header');

assert.ok(header);
});
});

0 comments on commit 1a4ae1d

Please sign in to comment.