-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fio-8316-invalid-data-nested-form
- Loading branch information
Showing
24 changed files
with
268 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
export * from './modules'; | ||
export * from './utils'; | ||
export * from './process/validation'; | ||
export * from './process/validation/rules'; | ||
export * from './process'; | ||
export * from './sdk'; | ||
export * from './types'; | ||
export * from './error'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { expect } from 'chai'; | ||
import { validationRules } from '..'; | ||
import { rules, serverRules } from '../rules'; | ||
|
||
const allRules = [...rules, ...serverRules]; | ||
|
||
const component = { | ||
type: 'textfield', | ||
key: 'multiple_textfield', | ||
label: 'Multiple Textfield', | ||
input: true, | ||
multiple: true, | ||
validate: { | ||
required: true, | ||
maxLength: 10, | ||
minLength: 5, | ||
pattern: '^[0-9]+$', | ||
} | ||
}; | ||
|
||
const context = { | ||
component, | ||
value: [], | ||
path: 'multiple_textfield', | ||
data: {multiple_textfield: []}, | ||
row: {multiple_textfield: []}, | ||
scope: {errors: []}, | ||
}; | ||
|
||
it('Validating required rule will work for multiple values component with no rows', async () => { | ||
const fullValueRules = allRules.filter((rule) => rule.fullValue); | ||
const rulesToValidate = validationRules(context, fullValueRules, undefined); | ||
expect(rulesToValidate).to.not.have.length(0); | ||
}); | ||
|
||
it('Validati olther rules will skip for multiple values component with no rows', async () => { | ||
const otherRules = allRules.filter((rule) => !rule.fullValue); | ||
const rulesToValidate = validationRules(context, otherRules, undefined); | ||
expect(rulesToValidate).to.have.length(0); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
import { ValidationRuleInfo } from "types"; | ||
import { validateUniqueInfo } from "./validateUnique"; | ||
import { validateCaptchaInfo } from "./validateCaptcha"; | ||
import { validateResourceSelectValueInfo } from "./validateResourceSelectValue"; | ||
|
||
// These are the validations that require a database connection. | ||
export const databaseRules: ValidationRuleInfo[] = [ | ||
validateUniqueInfo, | ||
validateCaptchaInfo, | ||
validateResourceSelectValueInfo | ||
]; |
Oops, something went wrong.