File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ class FormGroup extends React.Component {
55 render ( ) {
66 let classes = {
77 'form-group' : ! this . props . standalone ,
8+ 'form-group-lg' : ! this . props . standalone && this . props . bsSize === 'large' ,
9+ 'form-group-sm' : ! this . props . standalone && this . props . bsSize === 'small' ,
810 'has-feedback' : this . props . hasFeedback ,
911 'has-success' : this . props . bsStyle === 'success' ,
1012 'has-warning' : this . props . bsStyle === 'warning' ,
@@ -26,6 +28,7 @@ FormGroup.defaultProps = {
2628FormGroup . propTypes = {
2729 standalone : React . PropTypes . bool ,
2830 hasFeedback : React . PropTypes . bool ,
31+ bsSize : React . PropTypes . oneOf ( [ 'small' , 'medium' , 'large' ] ) ,
2932 bsStyle : React . PropTypes . oneOf ( [ 'success' , 'warning' , 'error' ] ) ,
3033 groupClassName : React . PropTypes . string
3134} ;
Original file line number Diff line number Diff line change @@ -25,6 +25,26 @@ describe('FormGroup', function() {
2525 assert . ok ( ReactTestUtils . findRenderedDOMComponentWithClass ( instance , 'form-group' ) ) ;
2626 } ) ;
2727
28+ it ( 'renders form-group with sm or lg class when bsSize is small or large' , function ( ) {
29+ let instance = ReactTestUtils . renderIntoDocument (
30+ < FormGroup bsSize = "small" >
31+ < span />
32+ </ FormGroup >
33+ ) ;
34+
35+ assert . ok ( ReactTestUtils . findRenderedDOMComponentWithClass ( instance , 'form-group' ) ) ;
36+ assert . ok ( ReactTestUtils . findRenderedDOMComponentWithClass ( instance , 'form-group-sm' ) ) ;
37+
38+ instance = ReactTestUtils . renderIntoDocument (
39+ < FormGroup bsSize = "large" >
40+ < span />
41+ </ FormGroup >
42+ ) ;
43+
44+ assert . ok ( ReactTestUtils . findRenderedDOMComponentWithClass ( instance , 'form-group' ) ) ;
45+ assert . ok ( ReactTestUtils . findRenderedDOMComponentWithClass ( instance , 'form-group-lg' ) ) ;
46+ } ) ;
47+
2848 it ( 'renders no form-group class when standalone' , function ( ) {
2949 let instance = ReactTestUtils . renderIntoDocument (
3050 < FormGroup standalone >
Original file line number Diff line number Diff line change @@ -127,6 +127,22 @@ describe('Input', function () {
127127 assert . ok ( ReactTestUtils . findRenderedDOMComponentWithClass ( instance , 'input-group-addon' ) ) ;
128128 } ) ;
129129
130+ it ( 'renders form-group with sm or lg class when bsSize is small or large' , function ( ) {
131+ let instance = ReactTestUtils . renderIntoDocument (
132+ < Input bsSize = "small" />
133+ ) ;
134+
135+ assert . ok ( ReactTestUtils . findRenderedDOMComponentWithClass ( instance , 'form-group' ) ) ;
136+ assert . ok ( ReactTestUtils . findRenderedDOMComponentWithClass ( instance , 'form-group-sm' ) ) ;
137+
138+ instance = ReactTestUtils . renderIntoDocument (
139+ < Input bsSize = "large" />
140+ ) ;
141+
142+ assert . ok ( ReactTestUtils . findRenderedDOMComponentWithClass ( instance , 'form-group' ) ) ;
143+ assert . ok ( ReactTestUtils . findRenderedDOMComponentWithClass ( instance , 'form-group-lg' ) ) ;
144+ } ) ;
145+
130146 it ( 'renders input-group with sm or lg class name when bsSize is small or large' , function ( ) {
131147 let instance = ReactTestUtils . renderIntoDocument (
132148 < Input addonBefore = "$" bsSize = "small" />
You can’t perform that action at this time.
0 commit comments