File tree 2 files changed +4
-20
lines changed
src/components/Form/FieldUpload
2 files changed +4
-20
lines changed Original file line number Diff line number Diff line change @@ -76,8 +76,7 @@ test('default value', async () => {
76
76
77
77
// Here we can use '!' on mockFile.name to prevent TS error because we are sure it is defined
78
78
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 ) ;
81
80
await user . click ( screen . getByRole ( 'button' , { name : 'Submit' } ) ) ;
82
81
expect ( mockedSubmit ) . toHaveBeenCalledWith ( { file : mockFile } ) ;
83
82
} ) ;
Original file line number Diff line number Diff line change @@ -35,12 +35,7 @@ export const Default = () => {
35
35
return (
36
36
< Form { ...form } onSubmit = { ( values ) => console . log ( values ) } >
37
37
< Stack spacing = { 4 } >
38
- < FormField
39
- control = { form . control }
40
- type = "upload"
41
- name = "file"
42
- label = "Name"
43
- />
38
+ < FormField type = "upload" name = "file" label = "Name" />
44
39
< Box >
45
40
< Button type = "submit" variant = "@primary" >
46
41
Submit
@@ -66,12 +61,7 @@ export const WithDefaultValue = () => {
66
61
return (
67
62
< Form { ...form } onSubmit = { ( values ) => console . log ( values ) } >
68
63
< Stack spacing = { 4 } >
69
- < FormField
70
- control = { form . control }
71
- type = "upload"
72
- name = "file"
73
- label = "Name"
74
- />
64
+ < FormField type = "upload" name = "file" label = "Name" />
75
65
< Box >
76
66
< Button type = "submit" variant = "@primary" >
77
67
Submit
@@ -97,12 +87,7 @@ export const WithPreview = () => {
97
87
return (
98
88
< Form { ...form } onSubmit = { ( values ) => console . log ( values ) } >
99
89
< Stack spacing = { 4 } >
100
- < FormField
101
- control = { form . control }
102
- type = "upload"
103
- name = "file"
104
- label = "Name"
105
- />
90
+ < FormField type = "upload" name = "file" label = "Name" />
106
91
< FieldUploadPreview uploaderName = "file" />
107
92
< Box >
108
93
< Button type = "submit" variant = "@primary" >
You can’t perform that action at this time.
0 commit comments