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 @@
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
*ngIf="!showAsIconButton"
data-test-id="abschliessen-button"
......
......@@ -33,7 +33,11 @@ import {
IconButtonWithSpinnerComponent,
OzgcloudStrokedButtonWithSpinnerComponent,
} 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 { createCommandResource } from 'libs/command-shared/test/command';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
......@@ -74,6 +78,7 @@ describe('AbschliessenButtonComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(AbschliessenButtonComponent);
component = fixture.componentInstance;
component.vorgang = createVorgangWithEingangResource();
fixture.detectChanges();
});
......@@ -129,6 +134,18 @@ describe('AbschliessenButtonComponent', () => {
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', () => {
component.vorgang = createVorgangWithEingangResource([
VorgangWithEingangLinkRel.ABSCHLIESSEN,
......@@ -156,6 +173,18 @@ describe('AbschliessenButtonComponent', () => {
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', () => {
component.vorgang = createVorgangWithEingangResource([
VorgangWithEingangLinkRel.ABSCHLIESSEN,
......
......@@ -56,7 +56,7 @@ export class AbschliessenButtonComponent implements OnInit {
this.commandStateResource$ = this.vorgangCommandService.abschliessen(this.vorgang);
}
get inProgress(): boolean {
return this.vorgang?.status === 'IN_BEARBEITUNG';
get isVorgangInBearbeitung(): boolean {
return this.vorgang.status === 'IN_BEARBEITUNG';
}
}
......@@ -26,16 +26,19 @@
<ng-container *ngIf="vorgangStateResource$ | async as vorgangStateResource">
<ozgcloud-subnavigation class="mat-typography mat-app-background">
<alfa-vorgang-detail-back-button-container></alfa-vorgang-detail-back-button-container>
<ng-container *ngIf="vorgangStateResource.resource">
<alfa-vorgang-detail-action-buttons
[vorgangWithEingang]="vorgangStateResource.resource"
></alfa-vorgang-detail-action-buttons>
<alfa-vorgang-detail-more-menu
[vorgangWithEingang]="vorgangStateResource.resource"
></alfa-vorgang-detail-more-menu>
</ng-container>
</ozgcloud-subnavigation>
<div class="l-scroll-area--full">
<alfa-vorgang-detail-area
*ngIf="vorgangStateResource"
[vorgangStateResource]="vorgangStateResource"
></alfa-vorgang-detail-area>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment