From 4af3b4b98cec234b2826b8c9c88bca48fd2487d4 Mon Sep 17 00:00:00 2001 From: sebo <sebastian.bergandy@external.mgm-cp.com> Date: Thu, 13 Feb 2025 10:01:24 +0100 Subject: [PATCH] OZG-5977 add multi option to file upload button Sub Task: OZG-7574 --- .../file-upload-button.component.html | 1 + .../file-upload-button.component.spec.ts | 12 ++++++++++++ .../file-upload-button.component.ts | 1 + 3 files changed, 14 insertions(+) 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 ece1c85988..dc2b6cef68 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 0972a93d2b..b4cc192ce0 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 8a1f968b27..5de4efb83e 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({}); -- GitLab