Merge branch 'master' into react-0.14
Conflicts: package.json
This commit is contained in:
commit
c0fa87f5cb
2
API.md
2
API.md
|
|
@ -212,7 +212,7 @@ You should always use the [**getValue()**](#getvalue) method inside your formsy
|
|||
}
|
||||
}}/>
|
||||
```
|
||||
An comma seperated list with validation rules. Take a look at [**Validators**](#validators) to see default rules. Use ":" to separate argument passed to the validator. The argument will go through a **JSON.parse** converting them into correct JavaScript types. Meaning:
|
||||
An comma separated list with validation rules. Take a look at [**Validators**](#validators) to see default rules. Use ":" to separate argument passed to the validator. The argument will go through a **JSON.parse** converting them into correct JavaScript types. Meaning:
|
||||
|
||||
```html
|
||||
<MyInputComponent name="fruit" validations="isIn:['apple', 'orange']"/>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
formsy-react [](https://github.com/christianalfoni/formsy-react/releases) 
|
||||
formsy-react [](https://github.com/christianalfoni/formsy-react/releases) [](https://travis-ci.org/christianalfoni/formsy-react)
|
||||
============
|
||||
|
||||
A form input builder and validator for React JS
|
||||
|
|
|
|||
|
|
@ -34,9 +34,12 @@
|
|||
"babel-loader": "^5.0.0",
|
||||
"jasmine-node": "^1.14.5",
|
||||
"jsdom": "^3.1.2",
|
||||
"react": "^0.14.0-beta1",
|
||||
"react-dom": "^0.14.0-beta1",
|
||||
"react": "^0.14.0-beta3"
|
||||
"react-dom": "^0.14.0-beta3",
|
||||
"webpack": "^1.7.3",
|
||||
"webpack-dev-server": "^1.7.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^0.14.0-beta3"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,8 +198,11 @@ describe('Element', function() {
|
|||
it('should allow an undefined value to be updated to a value', function (done) {
|
||||
var TestInput = React.createClass({
|
||||
mixins: [Formsy.Mixin],
|
||||
changeValue: function (event) {
|
||||
this.setValue(event.target.value);
|
||||
},
|
||||
render: function () {
|
||||
return <input value={this.getValue()}/>
|
||||
return <input value={this.getValue()} onChange={this.changeValue}/>
|
||||
}
|
||||
});
|
||||
var TestForm = React.createClass({
|
||||
|
|
@ -237,7 +240,7 @@ it('should allow an undefined value to be updated to a value', function (done) {
|
|||
var TestInput = React.createClass({
|
||||
mixins: [Formsy.Mixin],
|
||||
render: function () {
|
||||
return <input value={this.getValue()}/>
|
||||
return <input/>
|
||||
}
|
||||
});
|
||||
var TestForm = React.createClass({
|
||||
|
|
@ -264,7 +267,7 @@ it('should allow an undefined value to be updated to a value', function (done) {
|
|||
var TestInput = React.createClass({
|
||||
mixins: [Formsy.Mixin],
|
||||
render: function () {
|
||||
return <input value={this.getValue()}/>
|
||||
return <input/>
|
||||
}
|
||||
});
|
||||
var TestForm = React.createClass({
|
||||
|
|
@ -368,7 +371,7 @@ it('should allow an undefined value to be updated to a value', function (done) {
|
|||
var TestInput = React.createClass({
|
||||
mixins: [Formsy.Mixin],
|
||||
render: function () {
|
||||
return <input value={this.getValue()}/>
|
||||
return <input/>
|
||||
}
|
||||
});
|
||||
var TestForm = React.createClass({
|
||||
|
|
@ -394,7 +397,7 @@ it('should allow an undefined value to be updated to a value', function (done) {
|
|||
var TestInput = React.createClass({
|
||||
mixins: [Formsy.Mixin],
|
||||
render: function () {
|
||||
return <input value={this.getValue()}/>
|
||||
return <input/>
|
||||
}
|
||||
});
|
||||
var TestForm = React.createClass({
|
||||
|
|
@ -428,7 +431,7 @@ it('should allow an undefined value to be updated to a value', function (done) {
|
|||
var TestInput = React.createClass({
|
||||
mixins: [Formsy.Mixin],
|
||||
render: function () {
|
||||
return <input value={this.getValue()}/>
|
||||
return <input/>
|
||||
}
|
||||
});
|
||||
var TestForm = React.createClass({
|
||||
|
|
@ -459,7 +462,7 @@ it('should allow an undefined value to be updated to a value', function (done) {
|
|||
var TestInput = React.createClass({
|
||||
mixins: [Formsy.Mixin],
|
||||
render: function () {
|
||||
return <input value={this.getValue()}/>
|
||||
return <input/>
|
||||
}
|
||||
});
|
||||
var TestForm = React.createClass({
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ describe('Formsy', function () {
|
|||
// Wait before adding the input
|
||||
setTimeout(function () {
|
||||
|
||||
inputs.push(<TestInput name="test" value=""/>);
|
||||
inputs.push(<TestInput key={inputs.length} name="test" value=""/>);
|
||||
|
||||
forceUpdate(function () {
|
||||
// Wait for next event loop, as that does the form
|
||||
|
|
@ -135,7 +135,7 @@ describe('Formsy', function () {
|
|||
// Wait before adding the input
|
||||
setTimeout(function () {
|
||||
|
||||
inputs.push(<TestInput name="test"/>);
|
||||
inputs.push(<TestInput key={inputs.length} name="test"/>);
|
||||
|
||||
forceUpdate(function () {
|
||||
|
||||
|
|
@ -378,7 +378,7 @@ describe('Formsy', function () {
|
|||
);
|
||||
|
||||
// Wait before adding the input
|
||||
inputs.push(<TestInput name='test'/>);
|
||||
inputs.push(<TestInput key={inputs.length} name='test'/>);
|
||||
|
||||
forceUpdate(function () {
|
||||
|
||||
|
|
@ -401,7 +401,7 @@ describe('Formsy', function () {
|
|||
var TestInput = React.createClass({
|
||||
mixins: [Formsy.Mixin],
|
||||
render: function () {
|
||||
return <input value={this.getValue()}/>
|
||||
return <input/>
|
||||
}
|
||||
});
|
||||
var TestForm = React.createClass({
|
||||
|
|
@ -439,7 +439,7 @@ describe('Formsy', function () {
|
|||
var TestInput = React.createClass({
|
||||
mixins: [Formsy.Mixin],
|
||||
render: function () {
|
||||
return <input value={this.getValue()}/>;
|
||||
return <input/>;
|
||||
}
|
||||
});
|
||||
var TestForm = React.createClass({
|
||||
|
|
@ -494,7 +494,7 @@ describe('Formsy', function () {
|
|||
var TestInput = React.createClass({
|
||||
mixins: [Formsy.Mixin],
|
||||
render: function () {
|
||||
return <input value={this.getValue()}/>;
|
||||
return <input/>;
|
||||
}
|
||||
});
|
||||
var TestForm = React.createClass({
|
||||
|
|
@ -524,7 +524,7 @@ describe('Formsy', function () {
|
|||
var TestInput = React.createClass({
|
||||
mixins: [Formsy.Mixin],
|
||||
render: function () {
|
||||
return <input value={this.getValue()}/>;
|
||||
return <input/>;
|
||||
}
|
||||
});
|
||||
var TestForm = React.createClass({
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ describe('Validation', function() {
|
|||
var TestInput = React.createClass({
|
||||
mixins: [Formsy.Mixin],
|
||||
render: function () {
|
||||
return <input value={this.getValue()}/>
|
||||
return <input/>
|
||||
}
|
||||
});
|
||||
var TestForm = React.createClass({
|
||||
|
|
@ -191,7 +191,7 @@ describe('Validation', function() {
|
|||
var TestInput = React.createClass({
|
||||
mixins: [Formsy.Mixin],
|
||||
render: function () {
|
||||
return <input value={this.getValue()}/>
|
||||
return <input/>
|
||||
}
|
||||
});
|
||||
var TestForm = React.createClass({
|
||||
|
|
@ -223,7 +223,7 @@ describe('Validation', function() {
|
|||
var TestInput = React.createClass({
|
||||
mixins: [Formsy.Mixin],
|
||||
render: function () {
|
||||
return <input value={this.getValue()}/>
|
||||
return <input/>
|
||||
}
|
||||
});
|
||||
var TestForm = React.createClass({
|
||||
|
|
@ -253,7 +253,7 @@ describe('Validation', function() {
|
|||
var TestInput = React.createClass({
|
||||
mixins: [Formsy.Mixin],
|
||||
render: function () {
|
||||
return <input value={this.getValue()}/>
|
||||
return <input/>
|
||||
}
|
||||
});
|
||||
var TestForm = React.createClass({
|
||||
|
|
|
|||
|
|
@ -393,17 +393,15 @@ Formsy.Form = React.createClass({
|
|||
// Validate the form by going through all child input components
|
||||
// and check their state
|
||||
validateForm: function () {
|
||||
var allIsValid = true;
|
||||
var allIsValid;
|
||||
var inputs = this.inputs;
|
||||
var inputKeys = Object.keys(inputs);
|
||||
|
||||
// We need a callback as we are validating all inputs again. This will
|
||||
// run when the last component has set its state
|
||||
var onValidationComplete = function () {
|
||||
inputKeys.forEach(function (name) {
|
||||
if (!inputs[name].state._isValid) {
|
||||
allIsValid = false;
|
||||
}
|
||||
allIsValid = inputKeys.every(function (name) {
|
||||
return inputs[name].state._isValid;
|
||||
}.bind(this));
|
||||
|
||||
this.setState({
|
||||
|
|
|
|||
Loading…
Reference in New Issue