File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed
Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -152,16 +152,16 @@ let Navbar = React.createClass({
152152 props . role = 'navigation' ;
153153 }
154154
155- const classes = tbsUtils . getClassSet ( this . props ) ;
155+ if ( inverse ) {
156+ props . bsStyle = INVERSE ;
157+ }
158+
159+ const classes = tbsUtils . getClassSet ( props ) ;
156160
157161 classes [ tbsUtils . prefix ( this . props , 'fixed-top' ) ] = fixedTop ;
158162 classes [ tbsUtils . prefix ( this . props , 'fixed-bottom' ) ] = fixedBottom ;
159163 classes [ tbsUtils . prefix ( this . props , 'static-top' ) ] = staticTop ;
160164
161- // handle built-in styles manually to provide the convenience `inverse` prop
162- classes [ tbsUtils . prefix ( this . props , INVERSE ) ] = inverse ;
163- classes [ tbsUtils . prefix ( this . props , DEFAULT ) ] = ! inverse ;
164-
165165 return (
166166 < ComponentClass { ...props } className = { classNames ( className , classes ) } >
167167 < Grid fluid = { fluid } >
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import Nav from '../src/Nav';
66import Navbar from '../src/Navbar' ;
77
88import { getOne , shouldWarn } from './helpers' ;
9+ import utils from '../src/utils/bootstrapUtils' ;
910
1011describe ( 'Navbar' , ( ) => {
1112
@@ -56,6 +57,17 @@ describe('Navbar', () => {
5657 assert . ok ( ReactTestUtils . findRenderedDOMComponentWithClass ( instance , 'navbar-inverse' ) ) ;
5758 } ) ;
5859
60+ it ( 'Should not add default class along with custom styles' , ( ) => {
61+ utils . addStyle ( Navbar , [ 'custom' ] ) ;
62+
63+ let instance = ReactTestUtils . renderIntoDocument (
64+ < Navbar bsStyle = 'custom' />
65+ ) ;
66+
67+ expect ( ( ) => ReactTestUtils . findRenderedDOMComponentWithClass ( instance , 'navbar-default' ) )
68+ . to . throw ( ) ;
69+ } ) ;
70+
5971 it ( 'Should add fluid variation class' , ( ) => {
6072 let instance = ReactTestUtils . renderIntoDocument (
6173 < Navbar fluid />
You can’t perform that action at this time.
0 commit comments