Skip to content

Commit 07a8868

Browse files
committed
fix(file-upload): Apply feedbacks
1 parent 5a542c5 commit 07a8868

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

src/components/Form/FieldUpload/FieldUpload.spec.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ test('default value', async () => {
7676

7777
// Here we can use '!' on mockFile.name to prevent TS error because we are sure it is defined
7878
const input = screen.getByLabelText<HTMLInputElement>(mockFile.name!);
79-
await user.upload(input, mockFile.file ?? []);
80-
expect(input.files ? input.files[0] : []).toBe(mockFile.file);
79+
expect(input.files ? input.files[0] : []).toBe(undefined);
8180
await user.click(screen.getByRole('button', { name: 'Submit' }));
8281
expect(mockedSubmit).toHaveBeenCalledWith({ file: mockFile });
8382
});

src/components/Form/FieldUpload/docs.stories.tsx

+2-12
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,7 @@ export const WithDefaultValue = () => {
6666
return (
6767
<Form {...form} onSubmit={(values) => console.log(values)}>
6868
<Stack spacing={4}>
69-
<FormField
70-
control={form.control}
71-
type="upload"
72-
name="file"
73-
label="Name"
74-
/>
69+
<FormField type="upload" name="file" label="Name" />
7570
<Box>
7671
<Button type="submit" variant="@primary">
7772
Submit
@@ -97,12 +92,7 @@ export const WithPreview = () => {
9792
return (
9893
<Form {...form} onSubmit={(values) => console.log(values)}>
9994
<Stack spacing={4}>
100-
<FormField
101-
control={form.control}
102-
type="upload"
103-
name="file"
104-
label="Name"
105-
/>
95+
<FormField type="upload" name="file" label="Name" />
10696
<FieldUploadPreview uploaderName="file" />
10797
<Box>
10898
<Button type="submit" variant="@primary">

0 commit comments

Comments
 (0)