Skip to content

Commit

Permalink
馃憤 fix setCustomValidity typo (#7154)
Browse files Browse the repository at this point in the history
Co-authored-by: xuanyul <xuanyul@zillowgroup.com>
  • Loading branch information
lxy-yz and allenli9 committed Nov 26, 2021
1 parent 1d5059a commit a07df37
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/logic/validateField.ts
Expand Up @@ -43,7 +43,7 @@ export default async (
return {};
}
const inputRef: HTMLInputElement = refs ? refs[0] : (ref as HTMLInputElement);
const setCustomValidty = (message?: string | boolean) => {
const setCustomValidity = (message?: string | boolean) => {
if (shouldUseNativeValidation && inputRef.reportValidity) {
inputRef.setCustomValidity(isBoolean(message) ? '' : message || ' ');
inputRef.reportValidity();
Expand Down Expand Up @@ -98,7 +98,7 @@ export default async (
...appendErrorsCurry(INPUT_VALIDATION_RULES.required, message),
};
if (!validateAllFieldCriteria) {
setCustomValidty(message);
setCustomValidity(message);
return error;
}
}
Expand Down Expand Up @@ -139,7 +139,7 @@ export default async (
INPUT_VALIDATION_RULES.min,
);
if (!validateAllFieldCriteria) {
setCustomValidty(error[name]!.message);
setCustomValidity(error[name]!.message);
return error;
}
}
Expand All @@ -162,7 +162,7 @@ export default async (
minLengthOutput.message,
);
if (!validateAllFieldCriteria) {
setCustomValidty(error[name]!.message);
setCustomValidity(error[name]!.message);
return error;
}
}
Expand All @@ -179,7 +179,7 @@ export default async (
...appendErrorsCurry(INPUT_VALIDATION_RULES.pattern, message),
};
if (!validateAllFieldCriteria) {
setCustomValidty(message);
setCustomValidity(message);
return error;
}
}
Expand All @@ -199,7 +199,7 @@ export default async (
),
};
if (!validateAllFieldCriteria) {
setCustomValidty(validateError.message);
setCustomValidity(validateError.message);
return error;
}
}
Expand All @@ -223,7 +223,7 @@ export default async (
...appendErrorsCurry(key, validateError.message),
};

setCustomValidty(validateError.message);
setCustomValidity(validateError.message);

if (validateAllFieldCriteria) {
error[name] = validationResult;
Expand All @@ -243,6 +243,6 @@ export default async (
}
}

setCustomValidty(true);
setCustomValidity(true);
return error;
};

0 comments on commit a07df37

Please sign in to comment.