diff --git a/src/Glyphicon.js b/src/Glyphicon.js index e406feaa31..9f5a2d69ad 100644 --- a/src/Glyphicon.js +++ b/src/Glyphicon.js @@ -7,12 +7,14 @@ const Glyphicon = React.createClass({ mixins: [BootstrapMixin], propTypes: { - glyph: React.PropTypes.oneOf(styleMaps.GLYPHS).isRequired + glyph: React.PropTypes.oneOf(styleMaps.GLYPHS).isRequired, + formControlFeedback: React.PropTypes.bool }, getDefaultProps() { return { - bsClass: 'glyphicon' + bsClass: 'glyphicon', + formControlFeedback: false }; }, @@ -20,6 +22,7 @@ const Glyphicon = React.createClass({ let classes = this.getBsClassSet(); classes['glyphicon-' + this.props.glyph] = true; + classes['form-control-feedback'] = this.props.formControlFeedback; return ( diff --git a/test/GlyphiconSpec.js b/test/GlyphiconSpec.js index fec68f5c1d..49d8338436 100644 --- a/test/GlyphiconSpec.js +++ b/test/GlyphiconSpec.js @@ -10,4 +10,22 @@ describe('Glyphicon', function () { assert.ok(React.findDOMNode(instance).className.match(/\bglyphicon\b/)); assert.ok(React.findDOMNode(instance).className.match(/\bglyphicon-star\b/)); }); + + it('renders without the .form-control-feedback class', function () { + let instance = ReactTestUtils.renderIntoDocument( + + ); + + assert.notOk(React.findDOMNode(instance).className.match(/\bform-control-feedback\b/)); + }); + + context('when setting the formControlFeedback prop', function () { + it('should have the .form-control-feedback class set', function () { + let instance = ReactTestUtils.renderIntoDocument( + + ); + + assert.ok(React.findDOMNode(instance).className.match(/\bform-control-feedback\b/)); + }); + }); });