File tree 3 files changed +39
-0
lines changed
3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ class FormGroup extends React.Component {
5
5
render ( ) {
6
6
let classes = {
7
7
'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' ,
8
10
'has-feedback' : this . props . hasFeedback ,
9
11
'has-success' : this . props . bsStyle === 'success' ,
10
12
'has-warning' : this . props . bsStyle === 'warning' ,
@@ -26,6 +28,7 @@ FormGroup.defaultProps = {
26
28
FormGroup . propTypes = {
27
29
standalone : React . PropTypes . bool ,
28
30
hasFeedback : React . PropTypes . bool ,
31
+ bsSize : React . PropTypes . oneOf ( [ 'small' , 'medium' , 'large' ] ) ,
29
32
bsStyle : React . PropTypes . oneOf ( [ 'success' , 'warning' , 'error' ] ) ,
30
33
groupClassName : React . PropTypes . string
31
34
} ;
Original file line number Diff line number Diff line change @@ -25,6 +25,26 @@ describe('FormGroup', function() {
25
25
assert . ok ( ReactTestUtils . findRenderedDOMComponentWithClass ( instance , 'form-group' ) ) ;
26
26
} ) ;
27
27
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
+
28
48
it ( 'renders no form-group class when standalone' , function ( ) {
29
49
let instance = ReactTestUtils . renderIntoDocument (
30
50
< FormGroup standalone >
Original file line number Diff line number Diff line change @@ -127,6 +127,22 @@ describe('Input', function () {
127
127
assert . ok ( ReactTestUtils . findRenderedDOMComponentWithClass ( instance , 'input-group-addon' ) ) ;
128
128
} ) ;
129
129
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
+
130
146
it ( 'renders input-group with sm or lg class name when bsSize is small or large' , function ( ) {
131
147
let instance = ReactTestUtils . renderIntoDocument (
132
148
< Input addonBefore = "$" bsSize = "small" />
You can’t perform that action at this time.
0 commit comments