File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ const isEmpty = value => value === '';
33
44const validations = {
55 isDefaultRequiredValue ( values , value ) {
6- return value === undefined || value === '' ;
6+ return value === undefined || value === null || value === '' ;
77 } ,
88 isExisty ( values , value ) {
99 return isExisty ( value ) ;
Original file line number Diff line number Diff line change @@ -103,6 +103,23 @@ export default {
103103
104104 } ,
105105
106+ 'should trigger the `onInvalid` handler if a required element receives `null` as the value' : function ( test ) {
107+
108+ const onValid = sinon . spy ( ) ;
109+ const onInvalid = sinon . spy ( ) ;
110+
111+ TestUtils . renderIntoDocument (
112+ < Formsy onValid = { onValid } onInvalid = { onInvalid } >
113+ < FormsyTest value = { null } name = "foo" required />
114+ </ Formsy >
115+ ) ;
116+
117+ test . equal ( onValid . called , false ) ;
118+ test . equal ( onInvalid . called , true ) ;
119+ test . done ( ) ;
120+
121+ } ,
122+
106123 'should be able to use provided validate function' : function ( test ) {
107124
108125 let isValid = false ;
You can’t perform that action at this time.
0 commit comments