Skip to content

Commit

Permalink
Merge pull request #107 from scottwoodall/tranferPropsToNavUl
Browse files Browse the repository at this point in the history
Pass Nav props to ul so css classes can be applied
  • Loading branch information
pieterv committed Jun 15, 2014
2 parents e2bd6d1 + aeeb9b8 commit fb3bd3f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var Nav = React.createClass({
classes['navbar-collapse'] = this.props.isCollapsable;

if (this.props.navbar && !this.props.isCollapsable) {
return this.renderUl();
return this.transferPropsTo(this.renderUl());
}

return this.transferPropsTo(
Expand Down Expand Up @@ -104,4 +104,4 @@ var Nav = React.createClass({
}
});

export default = Nav;
export default = Nav;
10 changes: 10 additions & 0 deletions test/NavbarSpec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,14 @@ describe('Nav', function () {

assert.ok(instance.refs.nav.props.navbar);
});

it('Should pass nav prop to ul', function () {
var instance = ReactTestUtils.renderIntoDocument(
<Nav className="pull-right" />
);

assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'pull-right'));
instance.setProps({navbar: true});
assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'pull-right'));
});
});

0 comments on commit fb3bd3f

Please sign in to comment.