Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.ngZone.run(() => {
if (!this.uploader && !this.options) {
throw new Error('You must pass either an uploader instance or options.');
}
// if options were passed, init a new uploader
if (!this.uploader && this.options) {
this.uploader = new FileUploader(this.options);
}
// always remove after upload for this case
this.uploader.options.removeAfterUpload = true;
this.uploader.onAfterAddingFile = this.onAfterAddingFile.bind(this);
this.uploader.onBeforeUploadItem = this.onBeforeUploadItem.bind(this);
this.uploader.onProgressAll = this.onProgressAll.bind(this);
this.uploader.onSuccessItem = this.onSuccessItem.bind(this);
this.uploader.onErrorItem = this.onErrorItem.bind(this);
});
}
beforeEach(() => {
fixture = TestBed.createComponent(FileButtonComponent);
component = fixture.componentInstance;
component.uploader = new FileUploader({ });
component.disabled = false;
component.multiple = false;
fixture.detectChanges();
});