Skip to content
Snippets Groups Projects
Commit b81b1983 authored by OZGCloud's avatar OZGCloud
Browse files

Merge branch 'master' into OZG-5833-Barrierefreiheit-Layoutanpassungen

parents a7d3b0f7 a8716cd6
Branches
Tags
No related merge requests found
...@@ -27,10 +27,13 @@ ...@@ -27,10 +27,13 @@
*ngIf="binaryFileListStateResource.resource" *ngIf="binaryFileListStateResource.resource"
[stateResource]="binaryFileListStateResource" [stateResource]="binaryFileListStateResource"
> >
<ods-attachment-wrapper [title]="title" data-test-id="file-list"> <ods-attachment-wrapper data-test-id="file-list">
<ods-attachment-header [title]="title"> <ods-attachment-header
[title]="title"
*ngIf="title || archiveDownloadUri"
data-test-id="file-list-header"
>
<alfa-download-archive-file-button-container <alfa-download-archive-file-button-container
*ngIf="archiveDownloadUri"
data-test-class="download-archive-file-button" data-test-class="download-archive-file-button"
[downloadUri]="archiveDownloadUri" [downloadUri]="archiveDownloadUri"
action-buttons action-buttons
......
...@@ -37,7 +37,7 @@ import { ...@@ -37,7 +37,7 @@ import {
createBinaryFileListResource, createBinaryFileListResource,
createBinaryFileResource, createBinaryFileResource,
} from 'libs/binary-file-shared/test/binary-file'; } from 'libs/binary-file-shared/test/binary-file';
import { getDataTestClassOf } from 'libs/tech-shared/test/data-test'; import { getDataTestClassOf, getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { MockComponent } from 'ng-mocks'; import { MockComponent } from 'ng-mocks';
import { BinaryFile2ContainerComponent } from '../binary-file2-container/binary-file2-container.component'; import { BinaryFile2ContainerComponent } from '../binary-file2-container/binary-file2-container.component';
import { DownloadArchiveFileButtonContainerComponent } from '../download-archive-file-button-container/download-archive-file-button-container.component'; import { DownloadArchiveFileButtonContainerComponent } from '../download-archive-file-button-container/download-archive-file-button-container.component';
...@@ -48,6 +48,7 @@ describe('VerticalBinaryFileListComponent', () => { ...@@ -48,6 +48,7 @@ describe('VerticalBinaryFileListComponent', () => {
let fixture: ComponentFixture<VerticalBinaryFileListComponent>; let fixture: ComponentFixture<VerticalBinaryFileListComponent>;
const downloadArchiveFileButton: string = getDataTestClassOf('download-archive-file-button'); const downloadArchiveFileButton: string = getDataTestClassOf('download-archive-file-button');
const fileListHeader: string = getDataTestIdOf('file-list-header');
const binaryFile: BinaryFileResource = createBinaryFileResource(); const binaryFile: BinaryFileResource = createBinaryFileResource();
...@@ -109,6 +110,32 @@ describe('VerticalBinaryFileListComponent', () => { ...@@ -109,6 +110,32 @@ describe('VerticalBinaryFileListComponent', () => {
}); });
}); });
describe('attachment header', () => {
it('should show header if there is title', () => {
component.title = 'Title';
fixture.detectChanges();
existsAsHtmlElement(fixture, fileListHeader);
});
it('should show header if there is uri', () => {
component.archiveDownloadUri = faker.internet.url();
fixture.detectChanges();
existsAsHtmlElement(fixture, fileListHeader);
});
it('should not show header if there is no uri or title', () => {
component.title = '';
fixture.detectChanges();
notExistsAsHtmlElement(fixture, fileListHeader);
});
});
describe('download archive button', () => { describe('download archive button', () => {
const downloadUri: ResourceUri = faker.internet.url(); const downloadUri: ResourceUri = faker.internet.url();
......
import { existsAsHtmlElement, notExistsAsHtmlElement } from '@alfa-client/test-utils';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AttachmentHeaderComponent } from './attachment-header.component'; import { AttachmentHeaderComponent } from './attachment-header.component';
...@@ -18,4 +19,19 @@ describe('AttachmentHeaderComponent', () => { ...@@ -18,4 +19,19 @@ describe('AttachmentHeaderComponent', () => {
it('should create', () => { it('should create', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
describe('title', () => {
it('should show heading', () => {
component.title = 'Test';
fixture.detectChanges();
existsAsHtmlElement(fixture, 'h4');
});
it('should not show heading', () => {
component.title = '';
fixture.detectChanges();
notExistsAsHtmlElement(fixture, 'h4');
});
});
}); });
...@@ -5,8 +5,8 @@ import { Component, Input } from '@angular/core'; ...@@ -5,8 +5,8 @@ import { Component, Input } from '@angular/core';
selector: 'ods-attachment-header', selector: 'ods-attachment-header',
standalone: true, standalone: true,
imports: [CommonModule], imports: [CommonModule],
template: `<div class="flex h-11 items-center justify-between px-3"> template: `<div class="flex h-11 items-center justify-between px-3 empty:hidden">
<h4 class="text-sm font-medium text-text">{{ title }}</h4> <h4 class="text-sm font-medium text-text" *ngIf="title">{{ title }}</h4>
<ng-content select="[action-buttons]"></ng-content> <ng-content select="[action-buttons]"></ng-content>
</div>`, </div>`,
}) })
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment