Fixed bug with comparing validations. Removed dynamic validations

This commit is contained in:
christianalfoni 2015-04-16 17:19:01 +02:00
parent 7227895ee9
commit aaac6d0618
6 changed files with 5 additions and 45 deletions

View File

@ -1,6 +1,6 @@
{
"name": "formsy-react",
"version": "0.12.3",
"version": "0.12.4",
"main": "src/main.js",
"dependencies": {
"react": "^0.13.1"

View File

@ -1,6 +1,6 @@
{
"name": "formsy-react",
"version": "0.12.3",
"version": "0.12.4",
"description": "A form input builder and validator for React JS",
"repository": {
"type": "git",

View File

@ -496,7 +496,7 @@ module.exports = {
// If validations has changed or something outside changes
// the value, set the value again running a validation
if (prevProps.validations !== this.props.validations || isValueChanged()) {
if (isValueChanged()) {
this.setValue(this.props.value);
}
},

File diff suppressed because one or more lines are too long

View File

@ -229,46 +229,6 @@ it('should allow an undefined value to be updated to a value', function (done) {
}, 0);
});
it('should be able to dynamically change validations', function (done) {
var isInvalid = false;
var TestInput = React.createClass({
mixins: [Formsy.Mixin],
render: function () {
return <input value={this.getValue()}/>
}
});
var TestForm = React.createClass({
getInitialState: function () {
return {value: 'foo@bar.com', validations: 'isEmail'};
},
changeValidations: function () {
this.setState({
validations: 'equals:foo'
});
},
setInvalid: function () {
isInvalid = true;
},
render: function () {
return (
<Formsy.Form url="/users" onInvalid={this.setInvalid}>
<TestInput name="A" validations={this.state.validations} value={this.state.value}/>
</Formsy.Form>
);
}
});
var form = TestUtils.renderIntoDocument(
<TestForm/>
);
form.changeValidations();
setTimeout(function () {
expect(isInvalid).toBe(true);
done();
}, 0);
});
it('should be able to test a values validity', function () {
var isInvalid = false;

View File

@ -82,7 +82,7 @@ module.exports = {
// If validations has changed or something outside changes
// the value, set the value again running a validation
if (prevProps.validations !== this.props.validations || isValueChanged()) {
if (isValueChanged()) {
this.setValue(this.props.value);
}
},