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

Merge pull request 'OZG-6376 OZG-6800 Fix status bug' (#770) from OZG-6376-hotfix into master

parents 6b50c3cb 43eaa1b4
No related branches found
No related tags found
No related merge requests found
...@@ -24,5 +24,5 @@ ...@@ -24,5 +24,5 @@
--> -->
<div class="status-name text-sm" data-test-id="vorgang-status-text"> <div class="status-name text-sm" data-test-id="vorgang-status-text">
{{ status }} {{ status | enumToLabel: vorgangStatusLabel }}
</div> </div>
...@@ -21,19 +21,23 @@ ...@@ -21,19 +21,23 @@
* 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 { EnumToLabelPipe } from '@alfa-client/tech-shared';
import { VorgangResource, VorgangStatusLabel } from '@alfa-client/vorgang-shared';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test'; import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { createVorgangResource } from 'libs/vorgang-shared/test/vorgang';
import { VorgangStatusTextComponent } from './vorgang-status-text.component'; import { VorgangStatusTextComponent } from './vorgang-status-text.component';
describe('VorgangStatusTextComponent', () => { describe('VorgangStatusTextComponent', () => {
let component: VorgangStatusTextComponent; let component: VorgangStatusTextComponent;
let fixture: ComponentFixture<VorgangStatusTextComponent>; let fixture: ComponentFixture<VorgangStatusTextComponent>;
const vorgang: VorgangResource = createVorgangResource();
const statusTextTestId: string = getDataTestIdOf('vorgang-status-text'); const statusTextTestId: string = getDataTestIdOf('vorgang-status-text');
beforeEach(async () => { beforeEach(async () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
declarations: [VorgangStatusTextComponent], declarations: [EnumToLabelPipe, VorgangStatusTextComponent],
}).compileComponents(); }).compileComponents();
}); });
...@@ -48,11 +52,12 @@ describe('VorgangStatusTextComponent', () => { ...@@ -48,11 +52,12 @@ describe('VorgangStatusTextComponent', () => {
}); });
it('should show status text', () => { it('should show status text', () => {
component.status = 'Neu'; component.status = vorgang.status;
const statusText: string = VorgangStatusLabel[vorgang.status];
fixture.detectChanges(); fixture.detectChanges();
const statusTextElement: HTMLElement = fixture.nativeElement.querySelector(statusTextTestId); const statusTextElement: HTMLElement = fixture.nativeElement.querySelector(statusTextTestId);
expect(statusTextElement.innerHTML).toContain('Neu'); expect(statusTextElement.innerHTML).toContain(statusText);
}); });
}); });
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
* 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 { VorgangStatus, VorgangStatusLabel } from '@alfa-client/vorgang-shared';
import { Component, Input } from '@angular/core'; import { Component, Input } from '@angular/core';
@Component({ @Component({
...@@ -29,5 +30,6 @@ import { Component, Input } from '@angular/core'; ...@@ -29,5 +30,6 @@ import { Component, Input } from '@angular/core';
styleUrls: ['./vorgang-status-text.component.scss'], styleUrls: ['./vorgang-status-text.component.scss'],
}) })
export class VorgangStatusTextComponent { export class VorgangStatusTextComponent {
@Input() status: string; @Input() status: VorgangStatus;
readonly vorgangStatusLabel = VorgangStatusLabel;
} }
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
data-test-class="status-dot" data-test-class="status-dot"
></alfa-vorgang-status-dot> ></alfa-vorgang-status-dot>
<alfa-vorgang-status-text <alfa-vorgang-status-text
[status]="status" [status]="vorgang.status"
data-test-class="status-text" data-test-class="status-text"
class="status-text" class="status-text"
></alfa-vorgang-status-text> ></alfa-vorgang-status-text>
......
...@@ -114,14 +114,6 @@ describe('VorgangListItemComponent', () => { ...@@ -114,14 +114,6 @@ describe('VorgangListItemComponent', () => {
}); });
describe('ngOnInit', () => { describe('ngOnInit', () => {
it('should set status', () => {
component.getStatus = jest.fn().mockReturnValue('Test');
component.ngOnInit();
expect(component.status).toBe('Test');
});
it('should build aria label', () => { it('should build aria label', () => {
component.buildAriaLabel = jest.fn(); component.buildAriaLabel = jest.fn();
......
...@@ -56,7 +56,6 @@ export class VorgangListItemComponent implements OnInit { ...@@ -56,7 +56,6 @@ export class VorgangListItemComponent implements OnInit {
userProfile: StateResource<UserProfileResource> = createEmptyStateResource<UserProfileResource>(); userProfile: StateResource<UserProfileResource> = createEmptyStateResource<UserProfileResource>();
public ariaLabel: string = ''; public ariaLabel: string = '';
public status: string = '';
constructor(public userProfileService: UserProfileService) {} constructor(public userProfileService: UserProfileService) {}
...@@ -69,7 +68,6 @@ export class VorgangListItemComponent implements OnInit { ...@@ -69,7 +68,6 @@ export class VorgangListItemComponent implements OnInit {
this.userProfile = userProfileStateResource; this.userProfile = userProfileStateResource;
}); });
} }
this.status = this.getStatus();
this.buildAriaLabel(); this.buildAriaLabel();
} }
...@@ -80,7 +78,7 @@ export class VorgangListItemComponent implements OnInit { ...@@ -80,7 +78,7 @@ export class VorgangListItemComponent implements OnInit {
const approvalStatus: string = this.getApprovalText(); const approvalStatus: string = this.getApprovalText();
const createdAt: string = formatFullDateWithTimeWithoutSeconds(this.vorgang.createdAt); const createdAt: string = formatFullDateWithTimeWithoutSeconds(this.vorgang.createdAt);
this.ariaLabel = `Vorgang: ${name}, Aktenzeichen: ${aktenzeichen}, Nummer: ${nummer} Status: ${this.status} ${approvalStatus}, Eingang: ${createdAt}, Aktuell zugewiesener Nutzer: ${getUserName(this.userProfile.resource)}`; this.ariaLabel = `Vorgang: ${name}, Aktenzeichen: ${aktenzeichen}, Nummer: ${nummer} Status: ${this.getStatus()} ${approvalStatus}, Eingang: ${createdAt}, Aktuell zugewiesener Nutzer: ${getUserName(this.userProfile.resource)}`;
if ( if (
hasLink(this.vorgang, VorgangHeaderLinkRel.WIEDERVORLAGEN) && hasLink(this.vorgang, VorgangHeaderLinkRel.WIEDERVORLAGEN) &&
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment