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

OZG-5977 fix upload in progress in editor

parent 5edc2b30
Branches
Tags
1 merge request!74OZG-5977 add multi file upload to wiedervorlagen
import { BinaryFileService, ToUploadFile } from '@alfa-client/binary-file-shared';
import { BinaryFileService, FileUploadType, ToUploadFile } from '@alfa-client/binary-file-shared';
import { ConvertForDataTestPipe } from '@alfa-client/tech-shared';
import { existsAsHtmlElement, getElementComponentFromFixtureByCss, mock, Mock } from '@alfa-client/test-utils';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { faker } from '@faker-js/faker/.';
import { expect } from '@jest/globals';
import { getUrl, Resource } from '@ngxp/rest';
import { FileUploadButtonComponent, SpinnerIconComponent } from '@ods/system';
......@@ -17,7 +18,8 @@ describe('MultiFileUploadEditorComponent', () => {
let component: MultiFileUploadEditorComponent;
let fixture: ComponentFixture<MultiFileUploadEditorComponent>;
const uploadLinkRel: string = 'upload';
const fileUploadType: FileUploadType = faker.word.noun();
const uploadLinkRel: string = faker.word.noun();
const uploadResource: Resource = createDummyResource([uploadLinkRel]);
const buttonTestId: string = getDataTestIdOf('Ein_Label-file-upload-button');
......@@ -58,6 +60,14 @@ describe('MultiFileUploadEditorComponent', () => {
describe('component', () => {
describe('ngOnInit', () => {
it('should get upload in progress', () => {
component.fileUploadType = fileUploadType;
component.ngOnInit();
expect(binaryFileService.isUploadInProgress).toHaveBeenCalledWith(fileUploadType);
});
it('should set upload in progress', () => {
binaryFileService.isUploadInProgress = jest.fn().mockReturnValue(of(true));
......
import { BinaryFileModule } from '@alfa-client/binary-file';
import { BinaryFileService, FileUploadType } from '@alfa-client/binary-file-shared';
import { KOMMENTAR_UPLOADED_ATTACHMENTS } from '@alfa-client/kommentar-shared';
import { ConvertForDataTestPipe } from '@alfa-client/tech-shared';
import { AsyncPipe } from '@angular/common';
import { Component, HostListener, inject, Input, OnInit } from '@angular/core';
......@@ -39,7 +38,7 @@ export class MultiFileUploadEditorComponent implements OnInit {
public readonly uploadButtonId: string = uniqueId();
ngOnInit(): void {
this.isUploadInProgress$ = this.binaryFileService.isUploadInProgress(KOMMENTAR_UPLOADED_ATTACHMENTS);
this.isUploadInProgress$ = this.binaryFileService.isUploadInProgress(this.fileUploadType);
}
@HostListener('change', ['$event.target.files'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment