emit success events on upload resume (#3824)

This commit is contained in:
Denys Vuika
2018-09-25 16:23:14 +01:00
committed by Eugenio Romano
parent ef568679d5
commit 580cd3440f
3 changed files with 29 additions and 5 deletions

View File

@@ -127,6 +127,26 @@ describe('UploadBase', () => {
expect(uploadFilesInTheQueue).toHaveBeenCalled();
}));
it('should emit callback events on resume', fakeAsync((done) => {
spyOn(uploadService, 'addToQueue').and.stub();
spyOn(uploadService, 'uploadFilesInTheQueue').and.stub();
let uploadEvent: UploadFilesEvent;
component.beginUpload.subscribe(event => {
uploadEvent = event;
event.preventDefault();
});
const file = <File> { name: 'bigFile.png', size: 1000 };
component.uploadFiles([file]);
tick();
uploadEvent.resumeUpload();
component.success.subscribe(() => {
done();
});
}));
});
describe('filesize', () => {

View File

@@ -128,7 +128,8 @@ export abstract class UploadBase implements OnInit, OnDestroy {
this.ngZone.run(() => {
const event = new UploadFilesEvent(
[...filteredFiles],
this.uploadService
this.uploadService,
this.success
);
this.beginUpload.emit(event);