added internal validation
This commit is contained in:
parent
ebd17fde62
commit
8cbd6e19ff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -50,7 +50,7 @@ describe('Validation', function() {
|
|||
|
||||
});
|
||||
|
||||
it('should use provided checkValidity function', function () {
|
||||
it('should use provided validate function', function () {
|
||||
|
||||
var isValid = jasmine.createSpy('valid');
|
||||
var TestInput = React.createClass({
|
||||
|
|
@ -64,7 +64,7 @@ describe('Validation', function() {
|
|||
}
|
||||
return <input value={this.getValue()} onChange={this.updateValue}/>
|
||||
},
|
||||
checkValidity: function () {
|
||||
validate: function () {
|
||||
return this.getValue() === "checkValidity";
|
||||
}
|
||||
});
|
||||
|
|
@ -75,7 +75,6 @@ describe('Validation', function() {
|
|||
);
|
||||
|
||||
var input = TestUtils.findRenderedDOMComponentWithTag(form, 'INPUT');
|
||||
expect(isValid).not.toHaveBeenCalled();
|
||||
TestUtils.Simulate.change(input, {target: {value: 'checkValidity'}});
|
||||
expect(isValid).toHaveBeenCalled();
|
||||
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ Formsy.Form = React.createClass({
|
|||
}
|
||||
|
||||
var isValid = true;
|
||||
if (component.validate) {
|
||||
if (component.validate && typeof component.validate === 'function') {
|
||||
isValid = component.validate();
|
||||
} else if (component.props.required || component._validations) {
|
||||
isValid = this.runValidation(component);
|
||||
|
|
|
|||
Loading…
Reference in New Issue