Skip to content
Snippets Groups Projects
Verified Commit 4af3b4b9 authored by Sebastian Bergandy's avatar Sebastian Bergandy :keyboard:
Browse files

OZG-5977 add multi option to file upload button

Sub Task: OZG-7574
parent 82637f82
Branches
Tags
1 merge request!67OZG-5977 add multi option to file upload button
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
[accept]="accept" [accept]="accept"
(click)="resetInput()" (click)="resetInput()"
[disabled]="isLoading" [disabled]="isLoading"
[multiple]="multi"
[attr.data-test-id]="(id | convertForDataTest) + '-file-upload-input'" [attr.data-test-id]="(id | convertForDataTest) + '-file-upload-input'"
/> />
<label <label
......
...@@ -25,6 +25,7 @@ import { TechSharedModule } from '@alfa-client/tech-shared'; ...@@ -25,6 +25,7 @@ import { TechSharedModule } from '@alfa-client/tech-shared';
import { getElementFromFixture } from '@alfa-client/test-utils'; import { getElementFromFixture } from '@alfa-client/test-utils';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { faker } from '@faker-js/faker'; import { faker } from '@faker-js/faker';
import { expect } from '@jest/globals';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test'; import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { FileUploadButtonComponent } from './file-upload-button.component'; import { FileUploadButtonComponent } from './file-upload-button.component';
...@@ -61,4 +62,15 @@ describe('FileUploadButtonComponent', () => { ...@@ -61,4 +62,15 @@ describe('FileUploadButtonComponent', () => {
expect(component.resetInput).toHaveBeenCalled(); 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);
});
});
}); });
...@@ -36,6 +36,7 @@ export class FileUploadButtonComponent { ...@@ -36,6 +36,7 @@ export class FileUploadButtonComponent {
@Input({ required: true }) id!: string; @Input({ required: true }) id!: string;
@Input() isLoading: boolean = false; @Input() isLoading: boolean = false;
@Input() accept: string = '*/*'; @Input() accept: string = '*/*';
@Input() multi: boolean = false;
@ViewChild('inputElement') inputElement: ElementRef = new ElementRef({}); @ViewChild('inputElement') inputElement: ElementRef = new ElementRef({});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment