Fix: Form.validationErrors disables input validation #239

This commit is contained in:
adam.dymowski 2015-10-20 09:19:24 +02:00
parent 2a384f40a6
commit 8cf8409e3a
1 changed files with 23 additions and 0 deletions

View File

@ -295,6 +295,29 @@ export default {
},
'should not override error messages with error messages passed by form if passed eror messages is an empty object': function (test) {
const TestForm = React.createClass({
render() {
return (
<Formsy.Form validationErrors={{}}>
<TestInput name="A" validations={{
isEmail: true
}} validationError="bar2" validationErrors={{isEmail: 'bar3'}} value="foo"/>
</Formsy.Form>
);
}
});
const form = TestUtils.renderIntoDocument(<TestForm/>);
const inputComponent = TestUtils.findRenderedComponentWithType(form, TestInput);
test.equal(inputComponent.getErrorMessage(), 'bar3');
test.done();
},
'should override all error messages with error messages passed by form': function (test) {
const TestForm = React.createClass({