diff --git a/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.html b/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.html index 7ce109e37c4a657ca237db2bad059662781cf0d9..ce2f6172db9932a00808f6313e48f0eafb3e44cd 100644 --- a/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.html +++ b/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.html @@ -1,8 +1,11 @@ <goofy-client-incomming-mail *ngIf="isIncomingMail" [postfachMail]="postfachMail"></goofy-client-incomming-mail> <goofy-client-outgoing-mail *ngIf="!isIncomingMail" [postfachMail]="postfachMail"></goofy-client-outgoing-mail> -<ng-container *ngIf="onPage"> +<ng-container *ngIf="onPage; else icon"> <goofy-client-postfach-nachricht-attachments *ngIf="postfachMail | hasLink: postfachNachrichtLinkRel.ATTACHMENTS" data-test-id="postfach-nachricht-attachments-container" [postfachNachricht]="postfachMail"> </goofy-client-postfach-nachricht-attachments> -</ng-container> \ No newline at end of file +</ng-container> +<ng-template #icon> + <mat-icon data-test-id="postfach-nachricht-attachment-icon">attach_file</mat-icon> +</ng-template> \ No newline at end of file diff --git a/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.spec.ts b/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.spec.ts index 4581cbc0174a86c837ceb44011acdaf496ba1cfe..710a2dc668fd66c74b2dc24c66e6ce23371e2462 100644 --- a/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.spec.ts +++ b/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail.component.spec.ts @@ -1,4 +1,5 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { MatIcon } from '@angular/material/icon'; import { ON_PAGE, PostfachMailLinkRel } from '@goofy-client/postfach-shared'; import { HasLinkPipe } from '@goofy-client/tech-shared'; import { getElementFromFixture } from '@goofy-client/test-utils'; @@ -14,12 +15,14 @@ describe('PostfachMailComponent', () => { let fixture: ComponentFixture<PostfachMailComponent>; const attachmentContainer: string = '[data-test-id="postfach-nachricht-attachments-container"]'; + const attachmentIcon: string = '[data-test-id="postfach-nachricht-attachment-icon"]'; beforeEach(async () => { await TestBed.configureTestingModule({ declarations: [ PostfachMailComponent, HasLinkPipe, + MatIcon, MockComponent(IncommingMailComponent), MockComponent(OutgoingMailComponent), MockComponent(PostfachNachrichtAttachmentsComponent) @@ -27,7 +30,7 @@ describe('PostfachMailComponent', () => { providers: [ { provide: ON_PAGE, - useValue: true + useValue: undefined } ] }).compileComponents(); @@ -47,6 +50,7 @@ describe('PostfachMailComponent', () => { describe('attachments', () => { it('should not show attachments loaded if exists', () => { + component.onPage = true; component.postfachMail = createPostfachMailResource(); fixture.detectChanges(); @@ -56,6 +60,7 @@ describe('PostfachMailComponent', () => { }) it('should be loaded if exists', () => { + component.onPage = true; component.postfachMail = createPostfachMailResource([PostfachMailLinkRel.ATTACHMENTS]); fixture.detectChanges(); @@ -63,5 +68,14 @@ describe('PostfachMailComponent', () => { expect(element).toBeInstanceOf(HTMLElement); }) + + it('should only show attachment icon on detail', () => { + component.onPage = false; + fixture.detectChanges(); + + const element = getElementFromFixture(fixture, attachmentIcon); + + expect(element).toBeInstanceOf(HTMLElement); + }) }) }); \ No newline at end of file