diff --git a/alfa-client/libs/design-system/src/lib/form/file-upload-button/file-upload-button.component.html b/alfa-client/libs/design-system/src/lib/form/file-upload-button/file-upload-button.component.html index ece1c85988571d733845ce9403521c3b804d0c23..dc2b6cef68ea7358023c7791fea0eb6efbaf47bf 100644 --- a/alfa-client/libs/design-system/src/lib/form/file-upload-button/file-upload-button.component.html +++ b/alfa-client/libs/design-system/src/lib/form/file-upload-button/file-upload-button.component.html @@ -31,6 +31,7 @@ [accept]="accept" (click)="resetInput()" [disabled]="isLoading" + [multiple]="multi" [attr.data-test-id]="(id | convertForDataTest) + '-file-upload-input'" /> <label diff --git a/alfa-client/libs/design-system/src/lib/form/file-upload-button/file-upload-button.component.spec.ts b/alfa-client/libs/design-system/src/lib/form/file-upload-button/file-upload-button.component.spec.ts index 0972a93d2bce07621c9426953b0374f4e3167d6f..b4cc192ce058ef1c05db17ce82400820c7aa456a 100644 --- a/alfa-client/libs/design-system/src/lib/form/file-upload-button/file-upload-button.component.spec.ts +++ b/alfa-client/libs/design-system/src/lib/form/file-upload-button/file-upload-button.component.spec.ts @@ -25,6 +25,7 @@ import { TechSharedModule } from '@alfa-client/tech-shared'; import { getElementFromFixture } from '@alfa-client/test-utils'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { faker } from '@faker-js/faker'; +import { expect } from '@jest/globals'; import { getDataTestIdOf } from 'libs/tech-shared/test/data-test'; import { FileUploadButtonComponent } from './file-upload-button.component'; @@ -61,4 +62,15 @@ describe('FileUploadButtonComponent', () => { expect(component.resetInput).toHaveBeenCalled(); }); }); + + describe('template', () => { + it('should have inputs', () => { + component.multi = true; + fixture.detectChanges(); + + const inputElement: HTMLInputElement = getElementFromFixture(fixture, inputTestClass); + + expect(inputElement.multiple).toEqual(component.multi); + }); + }); }); diff --git a/alfa-client/libs/design-system/src/lib/form/file-upload-button/file-upload-button.component.ts b/alfa-client/libs/design-system/src/lib/form/file-upload-button/file-upload-button.component.ts index 8a1f968b27776f44ab77b0931867fc39487e13d5..5de4efb83e1c6e6088d513cb262b7b3182346c05 100644 --- a/alfa-client/libs/design-system/src/lib/form/file-upload-button/file-upload-button.component.ts +++ b/alfa-client/libs/design-system/src/lib/form/file-upload-button/file-upload-button.component.ts @@ -36,6 +36,7 @@ export class FileUploadButtonComponent { @Input({ required: true }) id!: string; @Input() isLoading: boolean = false; @Input() accept: string = '*/*'; + @Input() multi: boolean = false; @ViewChild('inputElement') inputElement: ElementRef = new ElementRef({});