File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -7,19 +7,22 @@ const Glyphicon = React.createClass({
77 mixins : [ BootstrapMixin ] ,
88
99 propTypes : {
10- glyph : React . PropTypes . oneOf ( styleMaps . GLYPHS ) . isRequired
10+ glyph : React . PropTypes . oneOf ( styleMaps . GLYPHS ) . isRequired ,
11+ formControlFeedback : React . PropTypes . bool
1112 } ,
1213
1314 getDefaultProps ( ) {
1415 return {
15- bsClass : 'glyphicon'
16+ bsClass : 'glyphicon' ,
17+ formControlFeedback : false
1618 } ;
1719 } ,
1820
1921 render ( ) {
2022 let classes = this . getBsClassSet ( ) ;
2123
2224 classes [ 'glyphicon-' + this . props . glyph ] = true ;
25+ classes [ 'form-control-feedback' ] = this . props . formControlFeedback ;
2326
2427 return (
2528 < span { ...this . props } className = { classNames ( this . props . className , classes ) } >
Original file line number Diff line number Diff line change @@ -10,4 +10,22 @@ describe('Glyphicon', function () {
1010 assert . ok ( React . findDOMNode ( instance ) . className . match ( / \b g l y p h i c o n \b / ) ) ;
1111 assert . ok ( React . findDOMNode ( instance ) . className . match ( / \b g l y p h i c o n - s t a r \b / ) ) ;
1212 } ) ;
13+
14+ it ( 'renders without the .form-control-feedback class' , function ( ) {
15+ let instance = ReactTestUtils . renderIntoDocument (
16+ < Glyphicon glyph = 'star' />
17+ ) ;
18+
19+ assert . notOk ( React . findDOMNode ( instance ) . className . match ( / \b f o r m - c o n t r o l - f e e d b a c k \b / ) ) ;
20+ } ) ;
21+
22+ context ( 'when setting the formControlFeedback prop' , function ( ) {
23+ it ( 'should have the .form-control-feedback class set' , function ( ) {
24+ let instance = ReactTestUtils . renderIntoDocument (
25+ < Glyphicon formControlFeedback glyph = 'star' />
26+ ) ;
27+
28+ assert . ok ( React . findDOMNode ( instance ) . className . match ( / \b f o r m - c o n t r o l - f e e d b a c k \b / ) ) ;
29+ } ) ;
30+ } ) ;
1331} ) ;
You can’t perform that action at this time.
0 commit comments