Skip to content
Snippets Groups Projects
Commit 43eaa1b4 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6376 OZG-6800 Fix status bug

parent 6b50c3cb
No related branches found
No related tags found
No related merge requests found
......@@ -24,5 +24,5 @@
-->
<div class="status-name text-sm" data-test-id="vorgang-status-text">
{{ status }}
{{ status | enumToLabel: vorgangStatusLabel }}
</div>
......@@ -21,19 +21,23 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen
* 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 { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { createVorgangResource } from 'libs/vorgang-shared/test/vorgang';
import { VorgangStatusTextComponent } from './vorgang-status-text.component';
describe('VorgangStatusTextComponent', () => {
let component: VorgangStatusTextComponent;
let fixture: ComponentFixture<VorgangStatusTextComponent>;
const vorgang: VorgangResource = createVorgangResource();
const statusTextTestId: string = getDataTestIdOf('vorgang-status-text');
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [VorgangStatusTextComponent],
declarations: [EnumToLabelPipe, VorgangStatusTextComponent],
}).compileComponents();
});
......@@ -48,11 +52,12 @@ describe('VorgangStatusTextComponent', () => {
});
it('should show status text', () => {
component.status = 'Neu';
component.status = vorgang.status;
const statusText: string = VorgangStatusLabel[vorgang.status];
fixture.detectChanges();
const statusTextElement: HTMLElement = fixture.nativeElement.querySelector(statusTextTestId);
expect(statusTextElement.innerHTML).toContain('Neu');
expect(statusTextElement.innerHTML).toContain(statusText);
});
});
......@@ -21,6 +21,7 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { VorgangStatus, VorgangStatusLabel } from '@alfa-client/vorgang-shared';
import { Component, Input } from '@angular/core';
@Component({
......@@ -29,5 +30,6 @@ import { Component, Input } from '@angular/core';
styleUrls: ['./vorgang-status-text.component.scss'],
})
export class VorgangStatusTextComponent {
@Input() status: string;
@Input() status: VorgangStatus;
readonly vorgangStatusLabel = VorgangStatusLabel;
}
......@@ -38,7 +38,7 @@
data-test-class="status-dot"
></alfa-vorgang-status-dot>
<alfa-vorgang-status-text
[status]="status"
[status]="vorgang.status"
data-test-class="status-text"
class="status-text"
></alfa-vorgang-status-text>
......
......@@ -114,14 +114,6 @@ describe('VorgangListItemComponent', () => {
});
describe('ngOnInit', () => {
it('should set status', () => {
component.getStatus = jest.fn().mockReturnValue('Test');
component.ngOnInit();
expect(component.status).toBe('Test');
});
it('should build aria label', () => {
component.buildAriaLabel = jest.fn();
......
......@@ -56,7 +56,6 @@ export class VorgangListItemComponent implements OnInit {
userProfile: StateResource<UserProfileResource> = createEmptyStateResource<UserProfileResource>();
public ariaLabel: string = '';
public status: string = '';
constructor(public userProfileService: UserProfileService) {}
......@@ -69,7 +68,6 @@ export class VorgangListItemComponent implements OnInit {
this.userProfile = userProfileStateResource;
});
}
this.status = this.getStatus();
this.buildAriaLabel();
}
......@@ -80,7 +78,7 @@ export class VorgangListItemComponent implements OnInit {
const approvalStatus: string = this.getApprovalText();
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 (
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