Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit 53e2317

Browse files
committed
Merging
2 parents 95569f1 + e9e4980 commit 53e2317

File tree

3 files changed

+20
-24
lines changed

3 files changed

+20
-24
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-redux-form",
3-
"version": "1.14.0",
3+
"version": "1.14.1",
44
"description": "Create Forms Easily with React and Redux",
55
"main": "lib/index.js",
66
"typings": "react-redux-form.d.ts",
@@ -72,8 +72,8 @@
7272
"jsdom": "^9.2.1",
7373
"lodash": "~4.17.2",
7474
"mocha": "^2.5.1",
75-
"react": "^16.0.0-beta.2",
76-
"react-dom": "^16.0.0-beta.2",
75+
"react": "^15.6.1",
76+
"react-dom": "^15.6.1",
7777
"react-redux": "~5.0.0",
7878
"redux": "^3.3.1",
7979
"redux-immutable": "^3.0.8",

src/components/form-component.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@ function createFormClass(s = defaultStrategy) {
9191
}
9292

9393
componentDidMount() {
94-
this.handleUpdate();
95-
this.handleChange();
96-
9794
if (containsEvent(this.props.validateOn, 'change')) {
9895
this.validate(this.props, true);
9996
}

test/local-forms-spec.js

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,21 @@ describe('local forms', () => {
1111

1212
describe('standard usage with onUpdate', () => {
1313
let innerFormState;
14+
let dispatch;
1415

1516
const form = TestUtils.renderIntoDocument(
16-
<LocalForm onUpdate={(formValue) => innerFormState = formValue}>
17+
<LocalForm
18+
getDispatch={d => dispatch = d}
19+
onUpdate={(formValue) => innerFormState = formValue}
20+
>
1721
<Control.text model=".foo" />
1822
</LocalForm>
1923
);
2024

2125
const input = TestUtils.findRenderedDOMComponentWithTag(form, 'input');
2226

23-
it('should initially update with the loaded form value', () => {
27+
it('should update with the loaded form value', () => {
28+
dispatch(actions.setPristine('local'));
2429
assert.containSubset(innerFormState, {
2530
$form: {
2631
pristine: true,
@@ -45,36 +50,33 @@ describe('local forms', () => {
4550
});
4651

4752
describe('standard usage with onChange', () => {
48-
let innerModelState;
53+
let dispatch;
4954

5055
const form = TestUtils.renderIntoDocument(
51-
<LocalForm onChange={(modelValue) => innerModelState = modelValue}>
56+
<LocalForm getDispatch={d => dispatch = d}>
5257
<Control.text model=".foo" />
5358
</LocalForm>
5459
);
5560

5661
const input = TestUtils.findRenderedDOMComponentWithTag(form, 'input');
5762

5863
it('should initially have an empty object (by default) as the model value', () => {
59-
assert.deepEqual(innerModelState, {});
64+
assert.equal(input.value, ''); // { foo: '' }
6065
});
6166

6267
it('should behave like a normal form, with an internal Redux state', () => {
63-
input.value = 'changed';
64-
TestUtils.Simulate.change(input);
68+
dispatch(actions.change('local', { foo: 'changed' }));
6569

66-
assert.deepEqual(innerModelState, {
67-
foo: 'changed',
68-
});
70+
assert.equal(input.value, 'changed');
6971
});
7072
});
7173

7274
describe('onChange with initialState', () => {
73-
let innerModelState;
75+
let dispatch;
7476

7577
const form = TestUtils.renderIntoDocument(
7678
<LocalForm
77-
onChange={(modelValue) => innerModelState = modelValue}
79+
getDispatch={d => dispatch = d}
7880
initialState={{ foo: 'bar' }}
7981
>
8082
<Control.text model=".foo" />
@@ -84,16 +86,13 @@ describe('local forms', () => {
8486
const input = TestUtils.findRenderedDOMComponentWithTag(form, 'input');
8587

8688
it('should initially have an empty object (by default) as the model value', () => {
87-
assert.deepEqual(innerModelState, { foo: 'bar' });
89+
assert.equal(input.value, 'bar');
8890
});
8991

9092
it('should behave like a normal form, with an internal Redux state', () => {
91-
input.value = 'changed';
92-
TestUtils.Simulate.change(input);
93+
dispatch(actions.change('local', { foo: 'changed' }));
9394

94-
assert.deepEqual(innerModelState, {
95-
foo: 'changed',
96-
});
95+
assert.equal(input.value, 'changed');
9796
});
9897
});
9998

0 commit comments

Comments
 (0)