From 035e5538c951ac1688d81477b8504cba3702358a Mon Sep 17 00:00:00 2001 From: jquense Date: Mon, 16 Nov 2015 16:30:23 -0500 Subject: [PATCH] [fixed] navbar-default not added for custom styles --- src/Navbar.js | 10 +++++----- test/NavbarSpec.js | 12 ++++++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Navbar.js b/src/Navbar.js index 62192753e0..2f0bebbd8d 100644 --- a/src/Navbar.js +++ b/src/Navbar.js @@ -152,16 +152,16 @@ let Navbar = React.createClass({ props.role = 'navigation'; } - const classes = tbsUtils.getClassSet(this.props); + if (inverse) { + props.bsStyle = INVERSE; + } + + const classes = tbsUtils.getClassSet(props); classes[tbsUtils.prefix(this.props, 'fixed-top')] = fixedTop; classes[tbsUtils.prefix(this.props, 'fixed-bottom')] = fixedBottom; classes[tbsUtils.prefix(this.props, 'static-top')] = staticTop; - // handle built-in styles manually to provide the convenience `inverse` prop - classes[tbsUtils.prefix(this.props, INVERSE)] = inverse; - classes[tbsUtils.prefix(this.props, DEFAULT)] = !inverse; - return ( diff --git a/test/NavbarSpec.js b/test/NavbarSpec.js index 8eacd68ec7..51c7b4a22f 100644 --- a/test/NavbarSpec.js +++ b/test/NavbarSpec.js @@ -6,6 +6,7 @@ import Nav from '../src/Nav'; import Navbar from '../src/Navbar'; import { getOne, shouldWarn } from './helpers'; +import utils from '../src/utils/bootstrapUtils'; describe('Navbar', () => { @@ -56,6 +57,17 @@ describe('Navbar', () => { assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-inverse')); }); + it('Should not add default class along with custom styles', () => { + utils.addStyle(Navbar, ['custom']); + + let instance = ReactTestUtils.renderIntoDocument( + + ); + + expect(() => ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-default')) + .to.throw(); + }); + it('Should add fluid variation class', () => { let instance = ReactTestUtils.renderIntoDocument(