File tree Expand file tree Collapse file tree 2 files changed +3
-14
lines changed
src/components/Form/FieldUpload Expand file tree Collapse file tree 2 files changed +3
-14
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 @@ -66,12 +66,7 @@ export const WithDefaultValue = () => {
66
66
return (
67
67
< Form { ...form } onSubmit = { ( values ) => console . log ( values ) } >
68
68
< 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" />
75
70
< Box >
76
71
< Button type = "submit" variant = "@primary" >
77
72
Submit
@@ -97,12 +92,7 @@ export const WithPreview = () => {
97
92
return (
98
93
< Form { ...form } onSubmit = { ( values ) => console . log ( values ) } >
99
94
< 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" />
106
96
< FieldUploadPreview uploaderName = "file" />
107
97
< Box >
108
98
< Button type = "submit" variant = "@primary" >
You can’t perform that action at this time.
0 commit comments