- {children ? (
- React.cloneElement(children, control)
- ) : (
-
- )}
+ {children ? React.cloneElement(children, control) :
}
{errors.map(error => (
- {error}
diff --git a/tests/common/index.js b/tests/common/index.js
index 477f5174..e87d58cd 100644
--- a/tests/common/index.js
+++ b/tests/common/index.js
@@ -1,5 +1,5 @@
import timeout from './timeout';
-import InfoField from './InfoField';
+import InfoField, { Input } from './InfoField';
export async function changeValue(wrapper, value) {
wrapper.find('input').simulate('change', { target: { value } });
@@ -22,3 +22,7 @@ export function matchError(wrapper, error) {
export function getField(wrapper, index = 0) {
return wrapper.find(InfoField).at(index);
}
+
+export function getInput(wrapper, index = 0) {
+ return wrapper.find(Input).at(index);
+}
diff --git a/tests/dependencies.test.js b/tests/dependencies.test.js
index 1033c60b..3351afa2 100644
--- a/tests/dependencies.test.js
+++ b/tests/dependencies.test.js
@@ -1,8 +1,8 @@
import React from 'react';
import { mount } from 'enzyme';
-import Form from '../src';
-import InfoField from './common/InfoField';
-import { changeValue, matchError, getField } from './common';
+import Form, { Field } from '../src';
+import InfoField, { Input } from './common/InfoField';
+import { changeValue, matchError, getField, getInput } from './common';
describe('dependencies', () => {
it('touched', async () => {
@@ -30,4 +30,43 @@ describe('dependencies', () => {
await changeValue(getField(wrapper, 0), '');
matchError(getField(wrapper, 1), true);
});
+
+ it('nest dependencies', async () => {
+ let form = null;
+ let rendered = false;
+
+ const wrapper = mount(
+
+
+
,
+ );
+
+ form.setFields([
+ { name: 'field_1', touched: true },
+ { name: 'field_2', touched: true },
+ { name: 'field_3', touched: true },
+ ]);
+
+ rendered = false;
+ await changeValue(getInput(wrapper), '1');
+
+ expect(rendered).toBeTruthy();
+ });
});