1
0
mirror of synced 2025-02-16 20:53:13 +03:00

refactor: pendingValidation renamed to validationRun

This commit is contained in:
Zaytsev Kirill 2020-10-26 00:41:28 +03:00
parent 7b5d38923f
commit 91a97e4365

View File

@ -63,7 +63,7 @@ export default class FormularioInput extends Vue {
private localErrors: string[] = [] private localErrors: string[] = []
private violations: Violation[] = [] private violations: Violation[] = []
private pendingValidation: Promise<any> = Promise.resolve() private validationRun: Promise<any> = Promise.resolve()
get fullQualifiedName (): string { get fullQualifiedName (): string {
return this.path !== '' ? `${this.path}.${this.name}` : this.name return this.path !== '' ? `${this.path}.${this.name}` : this.name
@ -193,7 +193,7 @@ export default class FormularioInput extends Vue {
} }
runValidation (): Promise<void> { runValidation (): Promise<void> {
this.pendingValidation = this.validate().then(violations => { this.validationRun = this.validate().then(violations => {
const validationChanged = !shallowEqualObjects(violations, this.violations) const validationChanged = !shallowEqualObjects(violations, this.violations)
this.violations = violations this.violations = violations
if (validationChanged) { if (validationChanged) {
@ -209,7 +209,7 @@ export default class FormularioInput extends Vue {
return this.violations return this.violations
}) })
return this.pendingValidation return this.validationRun
} }
validate (): Promise<Violation[]> { validate (): Promise<Violation[]> {
@ -227,7 +227,7 @@ export default class FormularioInput extends Vue {
hasValidationErrors (): Promise<boolean> { hasValidationErrors (): Promise<boolean> {
return new Promise(resolve => { return new Promise(resolve => {
this.$nextTick(() => { this.$nextTick(() => {
this.pendingValidation.then(() => resolve(this.violations.length > 0)) this.validationRun.then(() => resolve(this.violations.length > 0))
}) })
}) })
} }