Skip to content

Commit

Permalink
Exports defaultShouldValidate and defaultShouldAsyncValidate
Browse files Browse the repository at this point in the history
These default functions are exported for external use - particularly so
that a user can wrap the default functionality with specialised behaviour.

To resolve redux-form#2890
  • Loading branch information
sh1989 committed May 5, 2017
1 parent cda2572 commit 35fb726
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/__tests__/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {
blur,
change,
clearSubmitErrors,
defaultShouldAsyncValidate,
defaultShouldValidate,
destroy,
Field,
Fields,
Expand Down Expand Up @@ -106,6 +108,12 @@ describe('index', () => {
it('should export clearSubmitErrors', () => {
expect(clearSubmitErrors).toExist().toBeA('function')
})
it('should export defaultShouldAsyncValidate', () => {
expect(defaultShouldAsyncValidate).toExist().toBeA('function')
})
it('should export defaultShouldValidate', () => {
expect(defaultShouldValidate).toExist().toBeA('function')
})
it('should export destroy', () => {
expect(destroy).toExist().toBeA('function')
})
Expand Down
4 changes: 4 additions & 0 deletions src/createAll.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import createIsValid from './selectors/isValid'
import createIsSubmitting from './selectors/isSubmitting'
import createHasSubmitSucceeded from './selectors/hasSubmitSucceeded'
import createHasSubmitFailed from './selectors/hasSubmitFailed'
import defaultShouldAsyncValidate from './defaultShouldAsyncValidate'
import defaultShouldValidate from './defaultShouldValidate'
import Form from './Form'
import FormSection from './FormSection'
import SubmissionError from './SubmissionError'
Expand All @@ -31,6 +33,8 @@ const createAll = structure => ({
// separate out field actions
actionTypes,
...actions,
defaultShouldAsyncValidate,
defaultShouldValidate,
Field: createField(structure),
Fields: createFields(structure),
FieldArray: createFieldArray(structure),
Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export const {
blur,
change,
clearSubmitErrors,
defaultShouldAsyncValidate,
defaultShouldValidate,
destroy,
Field,
Fields,
Expand Down

0 comments on commit 35fb726

Please sign in to comment.