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

OZG-5294 fix tests

parent d424ea6e
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
unter der Lizenz sind dem Lizenztext zu entnehmen. unter der Lizenz sind dem Lizenztext zu entnehmen.
--> -->
<ng-container *ngIf="vorgang | hasLink: linkRel.ABSCHLIESSEN && !inProgress"> <ng-container *ngIf="!isVorgangInBearbeitung && vorgang | hasLink: linkRel.ABSCHLIESSEN">
<ozgcloud-stroked-button-with-spinner <ozgcloud-stroked-button-with-spinner
*ngIf="!showAsIconButton" *ngIf="!showAsIconButton"
data-test-id="abschliessen-button" data-test-id="abschliessen-button"
......
...@@ -33,7 +33,11 @@ import { ...@@ -33,7 +33,11 @@ import {
IconButtonWithSpinnerComponent, IconButtonWithSpinnerComponent,
OzgcloudStrokedButtonWithSpinnerComponent, OzgcloudStrokedButtonWithSpinnerComponent,
} from '@alfa-client/ui'; } from '@alfa-client/ui';
import { VorgangCommandService, VorgangWithEingangLinkRel } from '@alfa-client/vorgang-shared'; import {
VorgangCommandService,
VorgangStatus,
VorgangWithEingangLinkRel,
} from '@alfa-client/vorgang-shared';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { createCommandResource } from 'libs/command-shared/test/command'; import { createCommandResource } from 'libs/command-shared/test/command';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test'; import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
...@@ -74,6 +78,7 @@ describe('AbschliessenButtonComponent', () => { ...@@ -74,6 +78,7 @@ describe('AbschliessenButtonComponent', () => {
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(AbschliessenButtonComponent); fixture = TestBed.createComponent(AbschliessenButtonComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
component.vorgang = createVorgangWithEingangResource();
fixture.detectChanges(); fixture.detectChanges();
}); });
...@@ -129,6 +134,18 @@ describe('AbschliessenButtonComponent', () => { ...@@ -129,6 +134,18 @@ describe('AbschliessenButtonComponent', () => {
expect(buttonElement).not.toBeInstanceOf(HTMLElement); expect(buttonElement).not.toBeInstanceOf(HTMLElement);
}); });
it('should be hidden if in bearbeitung', () => {
component.vorgang = createVorgangWithEingangResource([
VorgangWithEingangLinkRel.ABSCHLIESSEN,
]);
component.vorgang.status = VorgangStatus.IN_BEARBEITUNG;
fixture.detectChanges();
const buttonElement = fixture.nativeElement.querySelector(abschliessenButton);
expect(buttonElement).not.toBeInstanceOf(HTMLElement);
});
it('should be visible', () => { it('should be visible', () => {
component.vorgang = createVorgangWithEingangResource([ component.vorgang = createVorgangWithEingangResource([
VorgangWithEingangLinkRel.ABSCHLIESSEN, VorgangWithEingangLinkRel.ABSCHLIESSEN,
...@@ -156,6 +173,18 @@ describe('AbschliessenButtonComponent', () => { ...@@ -156,6 +173,18 @@ describe('AbschliessenButtonComponent', () => {
expect(buttonElement).not.toBeInstanceOf(HTMLElement); expect(buttonElement).not.toBeInstanceOf(HTMLElement);
}); });
it('should be hidden if in bearbeitung', () => {
component.vorgang = createVorgangWithEingangResource([
VorgangWithEingangLinkRel.ABSCHLIESSEN,
]);
component.vorgang.status = VorgangStatus.IN_BEARBEITUNG;
fixture.detectChanges();
const buttonElement = fixture.nativeElement.querySelector(abschliessenIconButton);
expect(buttonElement).not.toBeInstanceOf(HTMLElement);
});
it('should be visible', () => { it('should be visible', () => {
component.vorgang = createVorgangWithEingangResource([ component.vorgang = createVorgangWithEingangResource([
VorgangWithEingangLinkRel.ABSCHLIESSEN, VorgangWithEingangLinkRel.ABSCHLIESSEN,
......
...@@ -56,7 +56,7 @@ export class AbschliessenButtonComponent implements OnInit { ...@@ -56,7 +56,7 @@ export class AbschliessenButtonComponent implements OnInit {
this.commandStateResource$ = this.vorgangCommandService.abschliessen(this.vorgang); this.commandStateResource$ = this.vorgangCommandService.abschliessen(this.vorgang);
} }
get inProgress(): boolean { get isVorgangInBearbeitung(): boolean {
return this.vorgang?.status === 'IN_BEARBEITUNG'; return this.vorgang.status === 'IN_BEARBEITUNG';
} }
} }
...@@ -26,16 +26,19 @@ ...@@ -26,16 +26,19 @@
<ng-container *ngIf="vorgangStateResource$ | async as vorgangStateResource"> <ng-container *ngIf="vorgangStateResource$ | async as vorgangStateResource">
<ozgcloud-subnavigation class="mat-typography mat-app-background"> <ozgcloud-subnavigation class="mat-typography mat-app-background">
<alfa-vorgang-detail-back-button-container></alfa-vorgang-detail-back-button-container> <alfa-vorgang-detail-back-button-container></alfa-vorgang-detail-back-button-container>
<ng-container *ngIf="vorgangStateResource.resource">
<alfa-vorgang-detail-action-buttons <alfa-vorgang-detail-action-buttons
[vorgangWithEingang]="vorgangStateResource.resource" [vorgangWithEingang]="vorgangStateResource.resource"
></alfa-vorgang-detail-action-buttons> ></alfa-vorgang-detail-action-buttons>
<alfa-vorgang-detail-more-menu <alfa-vorgang-detail-more-menu
[vorgangWithEingang]="vorgangStateResource.resource" [vorgangWithEingang]="vorgangStateResource.resource"
></alfa-vorgang-detail-more-menu> ></alfa-vorgang-detail-more-menu>
</ng-container>
</ozgcloud-subnavigation> </ozgcloud-subnavigation>
<div class="l-scroll-area--full"> <div class="l-scroll-area--full">
<alfa-vorgang-detail-area <alfa-vorgang-detail-area
*ngIf="vorgangStateResource"
[vorgangStateResource]="vorgangStateResource" [vorgangStateResource]="vorgangStateResource"
></alfa-vorgang-detail-area> ></alfa-vorgang-detail-area>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment