Skip to content

Commit

Permalink
fix: form method cleanErrorForFiled renamed into cleanErrorForField (#…
Browse files Browse the repository at this point in the history
…1236)

Co-authored-by: Christoph Wanja <wanja@toto.io>
  • Loading branch information
iwan-uschka and Christoph Wanja committed Aug 11, 2020
1 parent bf8cede commit 1aaaab0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Form/Form.tsx
Expand Up @@ -89,7 +89,7 @@ export interface FormInstance<
cleanErrors?: (callback?: () => void) => void;

/** Clear the error message of the specified field */
cleanErrorForFiled?: (fieldName: keyof E, callback?: () => void) => void;
cleanErrorForField?: (fieldName: keyof E, callback?: () => void) => void;

/** All error messages are reset, and an initial value can be set */
resetErrors?: (formError: E, callback?: () => void) => void;
Expand Down Expand Up @@ -277,7 +277,7 @@ const Form: FormComponent = React.forwardRef((props: FormProps, ref: React.Ref<F
setFormError({});
}, []);

const cleanErrorForFiled = useCallback(
const cleanErrorForField = useCallback(
(fieldName: string) => {
setFormError(omit(_formError, [fieldName]));
},
Expand All @@ -295,7 +295,7 @@ const Form: FormComponent = React.forwardRef((props: FormProps, ref: React.Ref<F
checkAsync,
checkForFieldAsync,
cleanErrors,
cleanErrorForFiled,
cleanErrorForField,
resetErrors
}));

Expand Down
4 changes: 2 additions & 2 deletions src/Form/test/FormSpec.js
Expand Up @@ -158,7 +158,7 @@ describe('Form', () => {
});
});

it('Should be {n1} for formError when call cleanErrorForFiled', () => {
it('Should be {n1} for formError when call cleanErrorForField', () => {
const values = {
n1: 1,
n2: 1
Expand All @@ -175,7 +175,7 @@ describe('Form', () => {
</Form>
);
instance.check();
instance.cleanErrorForFiled('n2', () => {
instance.cleanErrorForField('n2', () => {
assert.equal(instance.state.formError.n1, 'error');
assert.equal(instance.state.formError.n2, undefined);
});
Expand Down

0 comments on commit 1aaaab0

Please sign in to comment.