Enhancement: navbar upload button (#14442)

This commit is contained in:
shamoon authored and GitHub committed 2026-10-19 19:07:55 -07:00
1 parent 8ea31cb3ce
commit c105486b6a
10 files changed
+96 -19

No files matched your search

@@ -85,15 +85,11 @@ describe('UploadFileWidgetComponent', () => {
'file.pdf'
)
const fileInput = fixture.debugElement.query(By.css('input'))
jest.spyOn(fileInput.nativeElement, 'files', 'get').mockReturnValue({
item: () => file,
length: 1,
[Symbol.iterator]: () => ({
next: () => ({ done: false, value: file }),
}),
} as any)
jest
.spyOn(fileInput.nativeElement, 'files', 'get')
.mockReturnValue([file] as any)
fileInput.nativeElement.dispatchEvent(new Event('change'))
expect(uploadSpy).toHaveBeenCalled()
expect(uploadSpy).toHaveBeenCalledWith(file)
})
it('should generate stats summary', () => {
@@ -130,11 +130,9 @@ export class UploadFileWidgetComponent extends ComponentWithPermissions {
}
public onFileSelected(event: Event) {
const files = (event.target as HTMLInputElement).files
for (let i = 0; i < files?.length; i++) {
const file = files.item(i)
file && this.uploadDocumentsService.uploadFile(file)
}
const input = event.target as HTMLInputElement
this.uploadDocumentsService.uploadFiles(Array.from(input.files ?? []))
input.value = ''
}
get slimSidebarEnabled(): boolean {