File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -108,13 +108,14 @@ class AjaxUploader extends Component<UploadProps> {
108
108
// Batch upload files
109
109
Promise . all ( postFiles ) . then ( fileList => {
110
110
const { onBatchStart } = this . props ;
111
- const enabledFiles = fileList . filter ( file => file ) ;
112
111
113
112
onBatchStart ?.( fileList . map ( ( { origin, parsedFile } ) => ( { file : origin , parsedFile } ) ) ) ;
114
113
115
- enabledFiles . forEach ( file => {
116
- this . post ( file ) ;
117
- } ) ;
114
+ fileList
115
+ . filter ( file => file . parsedFile !== null )
116
+ . forEach ( file => {
117
+ this . post ( file ) ;
118
+ } ) ;
118
119
} ) ;
119
120
} ;
120
121
Original file line number Diff line number Diff line change @@ -516,8 +516,10 @@ describe('uploader', () => {
516
516
return true ;
517
517
} ) ;
518
518
519
- const onBatchStart = await testWrapper ( { beforeUpload } ) ;
519
+ const onStart = jest . fn ( ) ;
520
+ const onBatchStart = await testWrapper ( { beforeUpload, onStart } ) ;
520
521
522
+ expect ( onStart ) . toHaveBeenCalledTimes ( 1 ) ;
521
523
expect ( beforeUpload ) . toHaveBeenCalledTimes ( 2 ) ;
522
524
expect ( onBatchStart ) . toHaveBeenCalledWith (
523
525
files . map ( file =>
You can’t perform that action at this time.
0 commit comments