@@ -9,7 +9,7 @@ import immediate from './utils/immediate';
99
1010export default {
1111
12- 'should return passed and setValue() value when using getValue ()' : function ( test ) {
12+ 'should pass down correct value prop after using setValue ()' : function ( test ) {
1313
1414 const form = TestUtils . renderIntoDocument (
1515 < Formsy >
@@ -33,7 +33,7 @@ export default {
3333 this . props . setValue ( event . target . value , false ) ;
3434 }
3535 render ( ) {
36- return < input type = "text" value = { this . props . getValue ( ) } onChange = { this . updateValue } /> ;
36+ return < input type = "text" value = { this . props . value } onChange = { this . updateValue } /> ;
3737 }
3838 } )
3939 const form = TestUtils . renderIntoDocument (
@@ -60,7 +60,7 @@ export default {
6060 this . props . setValue ( event . target . value , false ) ;
6161 }
6262 render ( ) {
63- return < input type = "text" value = { this . props . getValue ( ) } onChange = { this . updateValue } /> ;
63+ return < input type = "text" value = { this . props . value } onChange = { this . updateValue } /> ;
6464 }
6565 } )
6666 const form = TestUtils . renderIntoDocument (
@@ -105,10 +105,10 @@ export default {
105105
106106 'should return error message passed when calling getErrorMessage()' : function ( test ) {
107107
108- let getErrorMessage = null ;
108+ let errorMessage = null ;
109109 const Input = InputFactory ( {
110110 componentDidMount : function ( ) {
111- getErrorMessage = this . props . getErrorMessage ;
111+ errorMessage = this . props . errorMessage ;
112112 }
113113 } ) ;
114114 TestUtils . renderIntoDocument (
@@ -117,7 +117,7 @@ export default {
117117 </ Formsy >
118118 ) ;
119119
120- test . equal ( getErrorMessage ( ) , 'Has to be email' ) ;
120+ test . equal ( errorMessage , 'Has to be email' ) ;
121121
122122 test . done ( ) ;
123123
@@ -127,8 +127,8 @@ export default {
127127
128128 let isValid = null ;
129129 const Input = InputFactory ( {
130- componentDidMount : function ( ) {
131- isValid = this . props . isValid ;
130+ componentWillReceiveProps : function ( nextProps ) {
131+ isValid = nextProps . isValid ;
132132 }
133133 } ) ;
134134 const form = TestUtils . renderIntoDocument (
@@ -137,10 +137,10 @@ export default {
137137 </ Formsy >
138138 ) ;
139139
140- test . equal ( isValid ( ) , false ) ;
140+ test . equal ( isValid , false ) ;
141141 const input = TestUtils . findRenderedDOMComponentWithTag ( form , 'INPUT' ) ;
142142 TestUtils . Simulate . change ( input , { target : { value : 'foo@foo.com' } } ) ;
143- test . equal ( isValid ( ) , true ) ;
143+ test . equal ( isValid , true ) ;
144144
145145 test . done ( ) ;
146146
@@ -162,9 +162,9 @@ export default {
162162 </ Formsy >
163163 ) ;
164164
165- test . equal ( isRequireds [ 0 ] ( ) , false ) ;
166- test . equal ( isRequireds [ 1 ] ( ) , true ) ;
167- test . equal ( isRequireds [ 2 ] ( ) , true ) ;
165+ test . equal ( isRequireds [ 0 ] , false ) ;
166+ test . equal ( isRequireds [ 1 ] , true ) ;
167+ test . equal ( isRequireds [ 2 ] , true ) ;
168168
169169 test . done ( ) ;
170170
@@ -186,9 +186,9 @@ export default {
186186 </ Formsy >
187187 ) ;
188188
189- test . equal ( showRequireds [ 0 ] ( ) , false ) ;
190- test . equal ( showRequireds [ 1 ] ( ) , true ) ;
191- test . equal ( showRequireds [ 2 ] ( ) , false ) ;
189+ test . equal ( showRequireds [ 0 ] , false ) ;
190+ test . equal ( showRequireds [ 1 ] , true ) ;
191+ test . equal ( showRequireds [ 2 ] , false ) ;
192192
193193 test . done ( ) ;
194194
@@ -198,8 +198,8 @@ export default {
198198
199199 let isPristine = null ;
200200 const Input = InputFactory ( {
201- componentDidMount : function ( ) {
202- isPristine = this . props . isPristine ;
201+ componentWillReceiveProps : function ( nextProps ) {
202+ isPristine = nextProps . isPristine ;
203203 }
204204 } ) ;
205205 const form = TestUtils . renderIntoDocument (
@@ -208,10 +208,10 @@ export default {
208208 </ Formsy >
209209 ) ;
210210
211- test . equal ( isPristine ( ) , true ) ;
211+ test . equal ( isPristine , true ) ;
212212 const input = TestUtils . findRenderedDOMComponentWithTag ( form , 'INPUT' ) ;
213213 TestUtils . Simulate . change ( input , { target : { value : 'foo' } } ) ;
214- test . equal ( isPristine ( ) , false ) ;
214+ test . equal ( isPristine , false ) ;
215215
216216 test . done ( ) ;
217217
@@ -594,7 +594,7 @@ export default {
594594 shouldComponentUpdate : function ( ) { return false } ,
595595 render : function ( ) {
596596 renderSpy ( ) ;
597- return < input type = { this . props . type } value = { this . props . getValue ( ) } onChange = { this . updateValue } /> ;
597+ return < input type = { this . props . type } value = { this . props . value } onChange = { this . updateValue } /> ;
598598 }
599599 } ) ;
600600
@@ -613,21 +613,10 @@ export default {
613613 'binds all necessary methods' : function ( test ) {
614614 const onInputRef = input => {
615615 [
616- 'getErrorMessage' ,
617- 'getErrorMessages' ,
618- 'getValue' ,
619- 'hasValue' ,
620- 'isFormDisabled' ,
621- 'isValid' ,
622- 'isPristine' ,
623- 'isFormSubmitted' ,
624- 'isRequired' ,
625616 'isValidValue' ,
626617 'resetValue' ,
627618 'setValidations' ,
628619 'setValue' ,
629- 'showRequired' ,
630- 'showError' ,
631620 ] . forEach ( fnName => {
632621 const fn = input [ fnName ] ;
633622 try {
0 commit comments