Skip to content
Snippets Groups Projects
Commit 17fb21e7 authored by Alexander Reifschneider's avatar Alexander Reifschneider
Browse files

OZG-7474 fix unit tests

parent e978e9cb
No related branches found
No related tags found
1 merge request!49Ozg 7474 weiterleiten button
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
import { existsAsHtmlElement, notExistsAsHtmlElement } from '@alfa-client/test-utils'; import { existsAsHtmlElement, notExistsAsHtmlElement } from '@alfa-client/test-utils';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ButtonWithSpinnerComponent } from '@ods/component'; import { ButtonWithSpinnerComponent } from '@ods/component';
import { UndoRequestDeletionIconComponent } from 'libs/design-system/src/lib/icons/undo-request-delition-icon/undo-request-deletion-icon.component'; import { UndoRequestDeletionIconComponent } from '@ods/system';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test'; import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { MockComponent } from 'ng-mocks'; import { MockComponent } from 'ng-mocks';
import { LoeschAnforderungZuruecknehmenButtonComponent } from './loesch-anforderung-zuruecknehmen-button.component'; import { LoeschAnforderungZuruecknehmenButtonComponent } from './loesch-anforderung-zuruecknehmen-button.component';
......
...@@ -23,41 +23,39 @@ ...@@ -23,41 +23,39 @@
unter der Lizenz sind dem Lizenztext zu entnehmen. unter der Lizenz sind dem Lizenztext zu entnehmen.
--> -->
<ng-container @if (postfachMailListStateResource.resource | hasLink: postfachMailListLinkRel.SEND_POSTFACH_MAIL) {
*ngIf="
postfachMailListStateResource.resource | hasLink: postfachMailListLinkRel.SEND_POSTFACH_MAIL
"
>
<!-- TODO Aufteilen in 3 einzelne Komponenten --> <!-- TODO Aufteilen in 3 einzelne Komponenten -->
<ozgcloud-stroked-button-with-spinner @if (showAsIconButton) {
*ngIf="!showAsIconButton && text && !toolTip" <ods-button
data-test-id="send-mail-icon-button"
[isLoading]="pendingSendPostfachMailCommand.resource | hasLink: commandLinkRel.UPDATE"
tooltip="Neue Nachricht erstellen"
variant="icon"
size="fit"
(clickEmitter)="openPostfachNachrichtenDialog.emit()"
>
<ods-mailbox-icon icon class="stroke-text" />
</ods-button>
} @else if (text && !toolTip) {
<ods-button
data-test-id="create-mail-button-with-text" data-test-id="create-mail-button-with-text"
[showSpinner]="pendingSendPostfachMailCommand.resource | hasLink: commandLinkRel.UPDATE" [isLoading]="pendingSendPostfachMailCommand.resource | hasLink: commandLinkRel.UPDATE"
class="create-button"
[text]="text" [text]="text"
icon="add" variant="outline"
(clickEmitter)="openPostfachNachrichtenDialog.emit()" (clickEmitter)="openPostfachNachrichtenDialog.emit()"
> >
</ozgcloud-stroked-button-with-spinner> <ods-plus-icon icon class="fill-primary" />
</ods-button>
<ozgcloud-stroked-button-with-spinner } @else if (!text && toolTip) {
*ngIf="!showAsIconButton && !text && toolTip" <ods-button
data-test-id="create-mail-button-without-text" data-test-id="create-mail-button-without-text"
[showSpinner]="pendingSendPostfachMailCommand.resource | hasLink: commandLinkRel.UPDATE" [isLoading]="pendingSendPostfachMailCommand.resource | hasLink: commandLinkRel.UPDATE"
class="create-button" [tooltip]="toolTip"
[toolTip]="toolTip" variant="icon"
icon="add" size="fit"
(clickEmitter)="openPostfachNachrichtenDialog.emit()"
>
</ozgcloud-stroked-button-with-spinner>
<ozgcloud-icon-button-with-spinner
*ngIf="showAsIconButton"
data-test-id="send-mail-icon-button"
[showSpinner]="pendingSendPostfachMailCommand.resource | hasLink: commandLinkRel.UPDATE"
icon="mail_outline"
toolTip="Neue Nachricht erstellen"
(clickEmitter)="openPostfachNachrichtenDialog.emit()" (clickEmitter)="openPostfachNachrichtenDialog.emit()"
> >
</ozgcloud-icon-button-with-spinner> <ods-plus-icon icon class="fill-primary" />
</ng-container> </ods-button>
}
}
...@@ -21,18 +21,15 @@ ...@@ -21,18 +21,15 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen * Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen. * unter der Lizenz sind dem Lizenztext zu entnehmen.
*/ */
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { faker } from '@faker-js/faker';
import { PostfachMailListLinkRel } from '@alfa-client/postfach-shared'; import { PostfachMailListLinkRel } from '@alfa-client/postfach-shared';
import { EMPTY_STRING, HasLinkPipe, createStateResource } from '@alfa-client/tech-shared'; import { EMPTY_STRING, HasLinkPipe, createStateResource } from '@alfa-client/tech-shared';
import { import { ComponentFixture, TestBed } from '@angular/core/testing';
IconButtonWithSpinnerComponent, import { faker } from '@faker-js/faker';
OzgcloudStrokedButtonWithSpinnerComponent, import { ButtonComponent, MailboxIconComponent, PlusIconComponent, TooltipDirective } from '@ods/system';
} from '@alfa-client/ui';
import { createCommandResource } from 'libs/command-shared/test/command'; import { createCommandResource } from 'libs/command-shared/test/command';
import { createPostfachMailListResource } from 'libs/postfach-shared/test/postfach'; import { createPostfachMailListResource } from 'libs/postfach-shared/test/postfach';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test'; import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { MockComponent } from 'ng-mocks'; import { MockComponent, MockDirective } from 'ng-mocks';
import { PostfachMailButtonComponent } from './postfach-mail-button.component'; import { PostfachMailButtonComponent } from './postfach-mail-button.component';
describe('PostfachMailButtonComponent', () => { describe('PostfachMailButtonComponent', () => {
...@@ -48,8 +45,10 @@ describe('PostfachMailButtonComponent', () => { ...@@ -48,8 +45,10 @@ describe('PostfachMailButtonComponent', () => {
declarations: [ declarations: [
PostfachMailButtonComponent, PostfachMailButtonComponent,
HasLinkPipe, HasLinkPipe,
MockComponent(IconButtonWithSpinnerComponent), MockComponent(ButtonComponent),
MockComponent(OzgcloudStrokedButtonWithSpinnerComponent), MockComponent(PlusIconComponent),
MockComponent(MailboxIconComponent),
MockDirective(TooltipDirective),
], ],
}).compileComponents(); }).compileComponents();
}); });
...@@ -77,9 +76,7 @@ describe('PostfachMailButtonComponent', () => { ...@@ -77,9 +76,7 @@ describe('PostfachMailButtonComponent', () => {
}); });
it('should be hidden', () => { it('should be hidden', () => {
component.postfachMailListStateResource = createStateResource( component.postfachMailListStateResource = createStateResource(createPostfachMailListResource());
createPostfachMailListResource(),
);
fixture.detectChanges(); fixture.detectChanges();
const buttonElement = fixture.nativeElement.querySelector(sendMailButtonWithText); const buttonElement = fixture.nativeElement.querySelector(sendMailButtonWithText);
...@@ -108,9 +105,7 @@ describe('PostfachMailButtonComponent', () => { ...@@ -108,9 +105,7 @@ describe('PostfachMailButtonComponent', () => {
}); });
it('should be hidden', () => { it('should be hidden', () => {
component.postfachMailListStateResource = createStateResource( component.postfachMailListStateResource = createStateResource(createPostfachMailListResource());
createPostfachMailListResource(),
);
fixture.detectChanges(); fixture.detectChanges();
const buttonElement = fixture.nativeElement.querySelector(sendMailButtonWithoutText); const buttonElement = fixture.nativeElement.querySelector(sendMailButtonWithoutText);
...@@ -139,9 +134,7 @@ describe('PostfachMailButtonComponent', () => { ...@@ -139,9 +134,7 @@ describe('PostfachMailButtonComponent', () => {
}); });
it('should be hidden', () => { it('should be hidden', () => {
component.postfachMailListStateResource = createStateResource( component.postfachMailListStateResource = createStateResource(createPostfachMailListResource());
createPostfachMailListResource(),
);
fixture.detectChanges(); fixture.detectChanges();
const buttonElement = fixture.nativeElement.querySelector(sendMailIconButton); const buttonElement = fixture.nativeElement.querySelector(sendMailIconButton);
......
...@@ -29,6 +29,7 @@ import { VorgangSharedUiModule } from '@alfa-client/vorgang-shared-ui'; ...@@ -29,6 +29,7 @@ import { VorgangSharedUiModule } from '@alfa-client/vorgang-shared-ui';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router'; import { RouterModule, Routes } from '@angular/router';
import { ButtonComponent, MailboxIconComponent, PlusIconComponent } from '@ods/system';
import { PostfachMailButtonContainerComponent } from './postfach-mail-button-container/postfach-mail-button-container.component'; import { PostfachMailButtonContainerComponent } from './postfach-mail-button-container/postfach-mail-button-container.component';
import { PostfachMailButtonComponent } from './postfach-mail-button-container/postfach-mail-button/postfach-mail-button.component'; import { PostfachMailButtonComponent } from './postfach-mail-button-container/postfach-mail-button/postfach-mail-button.component';
import { PostfachMailFormComponent } from './postfach-mail-form/postfach-mail-form.component'; import { PostfachMailFormComponent } from './postfach-mail-form/postfach-mail-form.component';
...@@ -67,6 +68,9 @@ const routes: Routes = [ ...@@ -67,6 +68,9 @@ const routes: Routes = [
UserProfileModule, UserProfileModule,
VorgangSharedUiModule, VorgangSharedUiModule,
BinaryFileModule, BinaryFileModule,
ButtonComponent,
PlusIconComponent,
MailboxIconComponent,
], ],
declarations: [ declarations: [
PostfachMailListContainerComponent, PostfachMailListContainerComponent,
...@@ -90,11 +94,7 @@ const routes: Routes = [ ...@@ -90,11 +94,7 @@ const routes: Routes = [
PostfachNachrichtAttachmentContainerComponent, PostfachNachrichtAttachmentContainerComponent,
PostfachNachrichtReplyEditorContainerComponent, PostfachNachrichtReplyEditorContainerComponent,
], ],
exports: [ exports: [PostfachMailListContainerComponent, PostfachMailButtonContainerComponent, PostfachMailFormComponent],
PostfachMailListContainerComponent,
PostfachMailButtonContainerComponent,
PostfachMailFormComponent,
],
providers: [ providers: [
{ {
provide: ON_PAGE, provide: ON_PAGE,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment