diff --git a/src/Field.js b/src/Field.js index d4db8a73..1901e6c5 100644 --- a/src/Field.js +++ b/src/Field.js @@ -104,6 +104,8 @@ export default class Field extends React.PureComponent { component, children, allowNull, + subscription, + validate, value: _value, ...rest } = this.props diff --git a/src/Field.test.js b/src/Field.test.js index 764d317e..dd88a370 100644 --- a/src/Field.test.js +++ b/src/Field.test.js @@ -237,6 +237,43 @@ describe('Field', () => { expect(render.mock.calls[2][0].values.foo).toBe(null) }) + it('should not let validate prop bleed through', () => { + const input = jest.fn(({ input }) => ) + const required = value => (value ? undefined : 'Required') + + TestUtils.renderIntoDocument( +
+ {() => ( + + + + )} + + ) + + expect(input).toHaveBeenCalled() + expect(input).toHaveBeenCalledTimes(1) + expect(input.mock.calls[0][0].validate).toBeUndefined() + }) + + it('should not let subscription prop bleed through', () => { + const input = jest.fn(({ input }) => ) + + TestUtils.renderIntoDocument( +
+ {() => ( + + + + )} + + ) + + expect(input).toHaveBeenCalled() + expect(input).toHaveBeenCalledTimes(1) + expect(input.mock.calls[0][0].subscription).toBeUndefined() + }) + it('should allow changing field-level validation function', () => { const input = jest.fn(({ input }) => ) const required = value => (value ? undefined : 'Required')