File tree 2 files changed +17
-5
lines changed
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({
152
152
props . role = 'navigation' ;
153
153
}
154
154
155
- const classes = tbsUtils . getClassSet ( this . props ) ;
155
+ if ( inverse ) {
156
+ props . bsStyle = INVERSE ;
157
+ }
158
+
159
+ const classes = tbsUtils . getClassSet ( props ) ;
156
160
157
161
classes [ tbsUtils . prefix ( this . props , 'fixed-top' ) ] = fixedTop ;
158
162
classes [ tbsUtils . prefix ( this . props , 'fixed-bottom' ) ] = fixedBottom ;
159
163
classes [ tbsUtils . prefix ( this . props , 'static-top' ) ] = staticTop ;
160
164
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
-
165
165
return (
166
166
< ComponentClass { ...props } className = { classNames ( className , classes ) } >
167
167
< Grid fluid = { fluid } >
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import Nav from '../src/Nav';
6
6
import Navbar from '../src/Navbar' ;
7
7
8
8
import { getOne , shouldWarn } from './helpers' ;
9
+ import utils from '../src/utils/bootstrapUtils' ;
9
10
10
11
describe ( 'Navbar' , ( ) => {
11
12
@@ -56,6 +57,17 @@ describe('Navbar', () => {
56
57
assert . ok ( ReactTestUtils . findRenderedDOMComponentWithClass ( instance , 'navbar-inverse' ) ) ;
57
58
} ) ;
58
59
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
+
59
71
it ( 'Should add fluid variation class' , ( ) => {
60
72
let instance = ReactTestUtils . renderIntoDocument (
61
73
< Navbar fluid />
You can’t perform that action at this time.
0 commit comments