Merge pull request #148 from christianalfoni/pass-props
Made passing all props, except `onSubmit`
This commit is contained in:
commit
1c74cb377f
|
|
@ -23,12 +23,12 @@
|
|||
"react-component"
|
||||
],
|
||||
"devDependencies": {
|
||||
"babel": "^5.6.4",
|
||||
"babel-core": "^5.1.11",
|
||||
"babel-loader": "^5.0.0",
|
||||
"jasmine-node": "^1.14.5",
|
||||
"react": "^0.13.1",
|
||||
"jsdom": "^3.1.2",
|
||||
"node-jsx": "^0.13.2",
|
||||
"react": "^0.13.1",
|
||||
"webpack": "^1.7.3",
|
||||
"webpack-dev-server": "^1.7.0"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -543,7 +543,7 @@ it('should allow an undefined value to be updated to a value', function (done) {
|
|||
<Formsy.Form disabled={this.state.bool}>
|
||||
{this.state.bool ?
|
||||
<TestInput name="foo" /> :
|
||||
<TestInput name="bar" />
|
||||
<TestInput name="bar" />
|
||||
}
|
||||
</Formsy.Form>
|
||||
);
|
||||
|
|
@ -555,7 +555,7 @@ it('should allow an undefined value to be updated to a value', function (done) {
|
|||
expect(input.isFormDisabled()).toBe(true);
|
||||
form.flip();
|
||||
expect(input.isFormDisabled()).toBe(false);
|
||||
|
||||
|
||||
});
|
||||
|
||||
it('should allow for dot notation in name which maps to a deep object', function () {
|
||||
|
|
@ -569,7 +569,7 @@ it('should allow an undefined value to be updated to a value', function (done) {
|
|||
|
||||
var TestForm = React.createClass({
|
||||
onSubmit: function (model) {
|
||||
expect(model).toEqual({foo: {bar: 'foo', test: 'test'}});
|
||||
expect(model).toEqual({foo: {bar: 'foo', test: 'test'}});
|
||||
},
|
||||
render: function () {
|
||||
return (
|
||||
|
|
@ -584,7 +584,7 @@ it('should allow an undefined value to be updated to a value', function (done) {
|
|||
var form = TestUtils.renderIntoDocument(<TestForm/>);
|
||||
var formEl = TestUtils.findRenderedDOMComponentWithTag(form, 'form');
|
||||
TestUtils.Simulate.submit(formEl);
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ describe('Rules: equals', function() {
|
|||
});
|
||||
|
||||
afterEach(function() {
|
||||
TestInput = isValid = isInvalid = form = null;
|
||||
TestInput = isValid = form = null;
|
||||
});
|
||||
|
||||
it('should pass with a default value', pass());
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ describe('Rules: isAlpha', function() {
|
|||
});
|
||||
|
||||
afterEach(function() {
|
||||
TestInput = isValid = isInvalid = form = null;
|
||||
TestInput = isValid = form = null;
|
||||
});
|
||||
|
||||
it('should pass with a default value', pass());
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ describe('Rules: isEmail', function() {
|
|||
});
|
||||
|
||||
afterEach(function() {
|
||||
TestInput = isValid = isInvalid = form = null;
|
||||
TestInput = isValid = form = null;
|
||||
});
|
||||
|
||||
it('should pass with a default value', pass());
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ describe('Rules: isEmptyString', function() {
|
|||
});
|
||||
|
||||
afterEach(function() {
|
||||
TestInput = isValid = isInvalid = form = null;
|
||||
TestInput = isValid = form = null;
|
||||
});
|
||||
|
||||
it('should fail with a default value', fail());
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ describe('Rules: isExisty', function() {
|
|||
});
|
||||
|
||||
afterEach(function() {
|
||||
TestInput = isValid = isInvalid = form = null;
|
||||
TestInput = isValid = form = null;
|
||||
});
|
||||
|
||||
it('should fail with a default value', fail());
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ describe('Rules: isLength', function() {
|
|||
});
|
||||
|
||||
afterEach(function() {
|
||||
TestInput = isValid = isInvalid = form = null;
|
||||
TestInput = isValid = form = null;
|
||||
});
|
||||
|
||||
describe('isLength:3', function() {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ describe('Rules: isNumeric', function() {
|
|||
});
|
||||
|
||||
afterEach(function() {
|
||||
TestInput = isValid = isInvalid = form = null;
|
||||
TestInput = isValid = form = null;
|
||||
});
|
||||
|
||||
it('should pass with a default value', pass());
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ describe('Rules: isUrl', function() {
|
|||
});
|
||||
|
||||
afterEach(function() {
|
||||
TestInput = isValid = isInvalid = form = null;
|
||||
TestInput = isValid = form = null;
|
||||
});
|
||||
|
||||
it('should pass with a default value', pass());
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ describe('Rules: isWords', function() {
|
|||
});
|
||||
|
||||
afterEach(function() {
|
||||
TestInput = isValid = isInvalid = form = null;
|
||||
TestInput = isValid = form = null;
|
||||
});
|
||||
|
||||
it('should pass with a default value', pass());
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ describe('Rules: maxLength', function() {
|
|||
});
|
||||
|
||||
afterEach(function() {
|
||||
TestInput = isValid = isInvalid = form = null;
|
||||
TestInput = isValid = form = null;
|
||||
});
|
||||
|
||||
it('should pass with a default value', pass());
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ describe('Rules: minLength', function() {
|
|||
});
|
||||
|
||||
afterEach(function() {
|
||||
TestInput = isValid = isInvalid = form = null;
|
||||
TestInput = isValid = form = null;
|
||||
});
|
||||
|
||||
describe('minLength:3', function() {
|
||||
|
|
|
|||
12
src/main.js
12
src/main.js
|
|
@ -98,7 +98,7 @@ Formsy.Form = React.createClass({
|
|||
return this.props.mapping(this.model)
|
||||
} else {
|
||||
return Object.keys(this.model).reduce(function (mappedModel, key) {
|
||||
|
||||
|
||||
var keyArray = key.split('.');
|
||||
while (keyArray.length) {
|
||||
var currentKey = keyArray.shift();
|
||||
|
|
@ -435,12 +435,10 @@ Formsy.Form = React.createClass({
|
|||
},
|
||||
render: function () {
|
||||
|
||||
return React.DOM.form({
|
||||
onSubmit: this.submit,
|
||||
className: this.props.className,
|
||||
autoComplete: this.props.autoComplete
|
||||
},
|
||||
this.traverseChildrenAndRegisterInputs(this.props.children)
|
||||
return (
|
||||
<form {...this.props} onSubmit={this.submit}>
|
||||
{this.traverseChildrenAndRegisterInputs(this.props.children)}
|
||||
</form>
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
require('node-jsx').install({
|
||||
extension: '.jsx'
|
||||
});
|
||||
require('babel/register');
|
||||
|
||||
var path = require('path');
|
||||
var jsdom = require("jsdom").jsdom;
|
||||
var jsdom = require('jsdom').jsdom;
|
||||
var jasmine = require('jasmine-node');
|
||||
|
||||
global.document = jsdom();
|
||||
|
|
|
|||
Loading…
Reference in New Issue