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

Merge branch 'master' into OZG-5600-OZG-5715-darkmode

parents 1ee110ac 11fa1af5
Branches
Tags
No related merge requests found
Showing
with 494 additions and 63 deletions
......@@ -8,7 +8,7 @@ export enum BescheidStatus {
export interface Bescheid {
status: BescheidStatus;
beschiedenAm: string;
bewilligt: boolean;
bewilligt: boolean | string;
sendBy?: BescheidSendBy;
bescheidDocument?: string;
attachments?: string[];
......
......@@ -13,7 +13,7 @@ export class BescheidInVorgangComponent {
@Input() hasBescheidDraft: boolean = false;
get bescheidBewilligt(): boolean {
return this.bescheidStateResource.resource.bewilligt;
return <boolean>this.bescheidStateResource.resource.bewilligt;
}
get bescheidAbgelehnt(): boolean {
......
......@@ -88,45 +88,6 @@ export enum CommandOrder {
SEND_BESCHEID = 'SEND_BESCHEID',
}
export enum CommandOrderType {
USER = 'User',
FORWARDING = 'Forwarding',
KOMMENTAR = 'Kommentar',
POSTFACH_NACHRICHT = 'PostfachNachricht',
VORGANG = 'Vorgang',
WIEDERVORLAGE = 'Wiedervorlage',
LOESCH_ANFORDERUNG = 'LoeschAnforderung',
SET_AKTENZEICHEN = 'SetAktenzeichen',
}
export const ORDER_TYPE_BY_COMMAND_ORDER = {
[CommandOrder.ASSIGN_USER]: CommandOrderType.USER,
[CommandOrder.CREATE_KOMMENTAR]: CommandOrderType.KOMMENTAR,
[CommandOrder.EDIT_KOMMENTAR]: CommandOrderType.KOMMENTAR,
[CommandOrder.CREATE_WIEDERVORLAGE]: CommandOrderType.WIEDERVORLAGE,
[CommandOrder.EDIT_WIEDERVORLAGE]: CommandOrderType.WIEDERVORLAGE,
[CommandOrder.FORWARD_FAILED]: CommandOrderType.FORWARDING,
[CommandOrder.REDIRECT_VORGANG]: CommandOrderType.FORWARDING,
[CommandOrder.FORWARD_SUCCESSFULL]: CommandOrderType.FORWARDING,
[CommandOrder.SEND_POSTFACH_NACHRICHT]: CommandOrderType.POSTFACH_NACHRICHT,
[CommandOrder.RECEIVE_POSTFACH_NACHRICHT]: CommandOrderType.POSTFACH_NACHRICHT,
[CommandOrder.RESEND_POSTFACH_NACHRICHT]: CommandOrderType.POSTFACH_NACHRICHT,
[CommandOrder.WIEDERVORLAGE_ERLEDIGEN]: CommandOrderType.WIEDERVORLAGE,
[CommandOrder.WIEDERVORLAGE_WIEDEREROEFFNEN]: CommandOrderType.WIEDERVORLAGE,
[CommandOrder.VORGANG_ANNEHMEN]: CommandOrderType.VORGANG,
[CommandOrder.VORGANG_VERWERFEN]: CommandOrderType.VORGANG,
[CommandOrder.VORGANG_ZURUECKHOLEN]: CommandOrderType.VORGANG,
[CommandOrder.VORGANG_BEARBEITEN]: CommandOrderType.VORGANG,
[CommandOrder.VORGANG_BESCHEIDEN]: CommandOrderType.VORGANG,
[CommandOrder.VORGANG_ZURUECKSTELLEN]: CommandOrderType.VORGANG,
[CommandOrder.VORGANG_ABSCHLIESSEN]: CommandOrderType.VORGANG,
[CommandOrder.VORGANG_WIEDEREROEFFNEN]: CommandOrderType.VORGANG,
[CommandOrder.VORGANG_ZUM_LOESCHEN_MARKIEREN]: CommandOrderType.LOESCH_ANFORDERUNG,
[CommandOrder.VORGANG_LOESCHEN]: CommandOrderType.LOESCH_ANFORDERUNG,
[CommandOrder.LOESCH_ANFORDERUNG_ZURUECKNEHMEN]: CommandOrderType.LOESCH_ANFORDERUNG,
[CommandOrder.SET_AKTENZEICHEN]: CommandOrderType.SET_AKTENZEICHEN,
};
export interface CreateCommandProps {
resource: Resource;
linkRel: string;
......
......@@ -21,10 +21,10 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { Injectable } from '@angular/core';
import { CommandResource } from '@alfa-client/command-shared';
import { doIfLoadingRequired, StateResource } from '@alfa-client/tech-shared';
import { UserProfileResource, UserProfileService } from '@alfa-client/user-profile-shared';
import { Injectable } from '@angular/core';
import { Store } from '@ngrx/store';
import { Observable } from 'rxjs';
import { filter } from 'rxjs/operators';
......@@ -40,10 +40,10 @@ export class HistorieFacade {
private userProfileService: UserProfileService,
) {}
getHistorie(): Observable<StateResource<HistorieListResource>> {
public getHistorie(): Observable<StateResource<HistorieListResource>> {
return this.store.select(HistorieSelectors.historieSelector).pipe(
filter(
(historieList) =>
(historieList: StateResource<HistorieListResource>) =>
!doIfLoadingRequired(historieList, () => {
this.store.dispatch(HistorieActions.loadHistorie());
}),
......@@ -51,11 +51,11 @@ export class HistorieFacade {
);
}
reloadHistorie(): void {
public reloadHistorie(): void {
this.store.dispatch(HistorieActions.reloadHistorie());
}
getAssignedTo(command: CommandResource): Observable<StateResource<UserProfileResource>> {
public getAssignedTo(command: CommandResource): Observable<StateResource<UserProfileResource>> {
return this.userProfileService.getAssignedUserProfile(command, 'assignedTo');
}
}
......@@ -21,7 +21,8 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { ListResource } from '@alfa-client/tech-shared';
import { CommandOrder } from '@alfa-client/command-shared';
import { ListResource, StringBasedKeyMap } from '@alfa-client/tech-shared';
import { Resource } from '@ngxp/rest';
export interface Historie {
......@@ -37,3 +38,45 @@ export interface Historie {
export interface HistorieResource extends Historie, Resource {}
export interface HistorieListResource extends ListResource {}
export enum CommandOrderType {
USER = 'User',
FORWARDING = 'Forwarding',
KOMMENTAR = 'Kommentar',
POSTFACH_NACHRICHT = 'PostfachNachricht',
VORGANG = 'Vorgang',
WIEDERVORLAGE = 'Wiedervorlage',
LOESCH_ANFORDERUNG = 'LoeschAnforderung',
SET_AKTENZEICHEN = 'SetAktenzeichen',
BESCHEID = 'Bescheid',
}
export const ORDER_TYPE_BY_COMMAND_ORDER: StringBasedKeyMap<CommandOrderType> = {
[CommandOrder.ASSIGN_USER]: CommandOrderType.USER,
[CommandOrder.CREATE_KOMMENTAR]: CommandOrderType.KOMMENTAR,
[CommandOrder.EDIT_KOMMENTAR]: CommandOrderType.KOMMENTAR,
[CommandOrder.CREATE_WIEDERVORLAGE]: CommandOrderType.WIEDERVORLAGE,
[CommandOrder.EDIT_WIEDERVORLAGE]: CommandOrderType.WIEDERVORLAGE,
[CommandOrder.FORWARD_FAILED]: CommandOrderType.FORWARDING,
[CommandOrder.REDIRECT_VORGANG]: CommandOrderType.FORWARDING,
[CommandOrder.FORWARD_SUCCESSFULL]: CommandOrderType.FORWARDING,
[CommandOrder.SEND_POSTFACH_NACHRICHT]: CommandOrderType.POSTFACH_NACHRICHT,
[CommandOrder.RECEIVE_POSTFACH_NACHRICHT]: CommandOrderType.POSTFACH_NACHRICHT,
[CommandOrder.RESEND_POSTFACH_NACHRICHT]: CommandOrderType.POSTFACH_NACHRICHT,
[CommandOrder.WIEDERVORLAGE_ERLEDIGEN]: CommandOrderType.WIEDERVORLAGE,
[CommandOrder.WIEDERVORLAGE_WIEDEREROEFFNEN]: CommandOrderType.WIEDERVORLAGE,
[CommandOrder.VORGANG_ANNEHMEN]: CommandOrderType.VORGANG,
[CommandOrder.VORGANG_VERWERFEN]: CommandOrderType.VORGANG,
[CommandOrder.VORGANG_ZURUECKHOLEN]: CommandOrderType.VORGANG,
[CommandOrder.VORGANG_BEARBEITEN]: CommandOrderType.VORGANG,
[CommandOrder.VORGANG_BESCHEIDEN]: CommandOrderType.VORGANG,
[CommandOrder.VORGANG_ZURUECKSTELLEN]: CommandOrderType.VORGANG,
[CommandOrder.VORGANG_ABSCHLIESSEN]: CommandOrderType.VORGANG,
[CommandOrder.VORGANG_WIEDEREROEFFNEN]: CommandOrderType.VORGANG,
[CommandOrder.VORGANG_ZUM_LOESCHEN_MARKIEREN]: CommandOrderType.LOESCH_ANFORDERUNG,
[CommandOrder.VORGANG_LOESCHEN]: CommandOrderType.LOESCH_ANFORDERUNG,
[CommandOrder.LOESCH_ANFORDERUNG_ZURUECKNEHMEN]: CommandOrderType.LOESCH_ANFORDERUNG,
[CommandOrder.SET_AKTENZEICHEN]: CommandOrderType.SET_AKTENZEICHEN,
[CommandOrder.SEND_BESCHEID]: CommandOrderType.BESCHEID,
[CommandOrder.UPDATE_BESCHEID]: CommandOrderType.BESCHEID,
};
<p class="flex text-base font-bold text-text">
<span class="flex items-center gap-2">
<span *ngIf="bescheid.bewilligt | convertToBoolean" data-test-class="bewilligt"
>Bewilligt am</span
>
<span *ngIf="!(bescheid.bewilligt | convertToBoolean)" data-test-class="abgelehnt"
>Abgelehnt am</span
>
</span>
<span>&nbsp;{{ bescheid.beschiedenAm | formatFullDatePipe }}</span>
</p>
import { ConvertToBooleanPipe } from '@alfa-client/tech-shared';
import { existsAsHtmlElement, notExistsAsHtmlElement } from '@alfa-client/test-utils';
import { registerLocaleData } from '@angular/common';
import localeDe from '@angular/common/locales/de';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FormatFullDatePipe } from 'libs/tech-shared/src/lib/pipe/format-full-date.pipe';
import { getDataTestClassOf } from 'libs/tech-shared/test/data-test';
import { createBescheid } from '../../../../../../../bescheid-shared/src/test/bescheid';
import { HistorieItemBescheidStatusComponent } from './historie-item-bescheid-status.component';
registerLocaleData(localeDe);
describe('HistorieItemBescheidStatusComponent', () => {
let component: HistorieItemBescheidStatusComponent;
let fixture: ComponentFixture<HistorieItemBescheidStatusComponent>;
const bewilligt: string = getDataTestClassOf('bewilligt');
const abgelehnt: string = getDataTestClassOf('abgelehnt');
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [HistorieItemBescheidStatusComponent, ConvertToBooleanPipe, FormatFullDatePipe],
}).compileComponents();
fixture = TestBed.createComponent(HistorieItemBescheidStatusComponent);
component = fixture.componentInstance;
component.bescheid = { ...createBescheid(), bewilligt: 'false' };
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
describe('on bewilligt', () => {
beforeEach(() => {
component.bescheid = { ...createBescheid(), bewilligt: 'true' };
fixture.detectChanges();
});
it('should show bewilligt text', () => {
existsAsHtmlElement(fixture, bewilligt);
});
it('should hide abgelehnt text', () => {
notExistsAsHtmlElement(fixture, abgelehnt);
});
});
describe('on abgelehnt', () => {
beforeEach(() => {
component.bescheid = { ...createBescheid(), bewilligt: 'false' };
fixture.detectChanges();
});
it('should show abgelehnt text', () => {
existsAsHtmlElement(fixture, abgelehnt);
});
it('should hide bewilligt text', () => {
notExistsAsHtmlElement(fixture, bewilligt);
});
});
});
import { Bescheid } from '@alfa-client/bescheid-shared';
import { Component, Input } from '@angular/core';
@Component({
selector: 'alfa-historie-item-bescheid-status',
templateUrl: './historie-item-bescheid-status.component.html',
})
export class HistorieItemBescheidStatusComponent {
@Input() bescheid: Bescheid;
}
<alfa-expansion-panel-with-user
*ngIf="hasBody; else headlineOnly"
[headline]="headline"
[resource]="command"
data-test-class="historie-item-bescheid-user-expansion-panel"
>
<alfa-historie-item-bescheid-status
[bescheid]="bescheid"
data-test-class="historie-item-bescheid-status"
></alfa-historie-item-bescheid-status>
<span data-test-class="historie-item-bescheid-document"
>Es wurde ein Bescheiddokument erstellt.</span
>
<alfa-historie-item-attachment
*ngIf="bescheid.attachments"
[attachments]="bescheid.attachments"
data-test-class="historie-item-bescheid-attachments"
></alfa-historie-item-attachment>
</alfa-expansion-panel-with-user>
<ng-template #headlineOnly>
<div class="mat-expansion-panel">
<alfa-historie-item-header
[headline]="headline"
[resource]="command"
data-test-class="historie-item-bescheid-header"
></alfa-historie-item-header>
</div>
</ng-template>
import { CommandOrder, CommandResource } from '@alfa-client/command-shared';
import {
existsAsHtmlElement,
getMockComponent,
notExistsAsHtmlElement,
} from '@alfa-client/test-utils';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import faker from '@faker-js/faker';
import { createBescheid } from 'libs/bescheid-shared/src/test/bescheid';
import { createCommandResource } from 'libs/command-shared/test/command';
import { getDataTestClassOf } from 'libs/tech-shared/test/data-test';
import { MockComponent } from 'ng-mocks';
import { ExpansionPanelWithUserComponent } from '../expansion-panel-with-user/expansion-panel-with-user.component';
import { HistorieItemAttachmentComponent } from '../historie-item-attachment/historie-item-attachment.component';
import { HistorieItemHeaderComponent } from '../historie-item-header/historie-item-header.component';
import { HistorieItemBescheidStatusComponent } from './historie-item-bescheid-status/historie-item-bescheid-status.component';
import { HistorieItemBescheidComponent } from './historie-item-bescheid.component';
describe('HistorieItemBescheidComponent', () => {
let component: HistorieItemBescheidComponent;
let fixture: ComponentFixture<HistorieItemBescheidComponent>;
const expansionPanel: string = getDataTestClassOf('historie-item-bescheid-user-expansion-panel');
const status: string = getDataTestClassOf('historie-item-bescheid-status');
const document: string = getDataTestClassOf('historie-item-bescheid-document');
const attachments: string = getDataTestClassOf('historie-item-bescheid-attachments');
const header: string = getDataTestClassOf('historie-item-bescheid-header');
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
HistorieItemBescheidComponent,
MockComponent(HistorieItemHeaderComponent),
MockComponent(HistorieItemBescheidStatusComponent),
MockComponent(HistorieItemAttachmentComponent),
MockComponent(ExpansionPanelWithUserComponent),
],
}).compileComponents();
fixture = TestBed.createComponent(HistorieItemBescheidComponent);
component = fixture.componentInstance;
component.command = createCommandResource();
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
describe('ngOnInit', () => {
describe('headline', () => {
it('should set for SEND_BESCHEID', () => {
component.command = { ...createCommandResource(), order: CommandOrder.SEND_BESCHEID };
component.ngOnInit();
expect(component.headline).toBe('einen Bescheid per Nachricht verschickt.');
});
it('should set for UPDATE_BESCHEID', () => {
component.command = { ...createCommandResource(), order: CommandOrder.UPDATE_BESCHEID };
component.ngOnInit();
expect(component.headline).toBe('einen Bescheid erstellt.');
});
});
describe('has body', () => {
it('should set true on UPDATE_BESCHEID', () => {
component.command = { ...createCommandResource(), order: CommandOrder.UPDATE_BESCHEID };
component.ngOnInit();
expect(component.hasBody).toBeTruthy();
});
it('should set false on SEND_BESCHEID', () => {
component.command = { ...createCommandResource(), order: CommandOrder.SEND_BESCHEID };
component.ngOnInit();
expect(component.hasBody).toBeFalsy();
});
});
});
describe('on command with body', () => {
beforeEach(() => {
component.command = {
...createCommandResource(),
order: CommandOrder.UPDATE_BESCHEID,
body: createBescheid(),
};
component.ngOnInit();
fixture.detectChanges();
});
describe('expansion panel with user', () => {
it('should be visible', () => {
existsAsHtmlElement(fixture, expansionPanel);
});
it('should be called with headline', () => {
const expansionPanelComp: ExpansionPanelWithUserComponent =
getMockComponent<ExpansionPanelWithUserComponent>(
fixture,
ExpansionPanelWithUserComponent,
);
expect(expansionPanelComp.headline).toBe('einen Bescheid erstellt.');
});
it('should be called with resource', () => {
const expansionPanelComp: ExpansionPanelWithUserComponent =
getMockComponent<ExpansionPanelWithUserComponent>(
fixture,
ExpansionPanelWithUserComponent,
);
expect(expansionPanelComp.resource).toBe(component.command);
});
});
it('should show bewillig', () => {
existsAsHtmlElement(fixture, status);
});
it('should show document', () => {
existsAsHtmlElement(fixture, document);
});
describe('attachments', () => {
describe('exists', () => {
const attachment: string = faker.internet.url();
beforeEach(() => {
const bodyWithAttachments: unknown = { attachments: attachment };
component.command = {
...createCommandResource(),
order: CommandOrder.UPDATE_BESCHEID,
body: bodyWithAttachments,
};
component.ngOnInit();
fixture.detectChanges();
});
it('should show', () => {
existsAsHtmlElement(fixture, attachments);
});
it('component should be called with attachments', () => {
const attachmentsComp: HistorieItemAttachmentComponent =
getMockComponent<HistorieItemAttachmentComponent>(
fixture,
HistorieItemAttachmentComponent,
);
expect(attachmentsComp.attachments).toBe(attachment);
});
});
it('should hide if missing', () => {
const bodyWithoutAttachments: unknown = { attachments: null };
component.command = {
...createCommandResource(),
order: CommandOrder.UPDATE_BESCHEID,
body: bodyWithoutAttachments,
};
fixture.detectChanges();
notExistsAsHtmlElement(fixture, attachments);
});
});
});
describe('on command without body', () => {
const command: CommandResource = {
...createCommandResource(),
order: CommandOrder.SEND_BESCHEID,
body: null,
};
beforeEach(() => {
component.command = command;
component.ngOnInit();
fixture.detectChanges();
});
it('should show header', () => {
existsAsHtmlElement(fixture, header);
});
describe('item header', () => {
it('should be called with headline', () => {
const itemHeaderComp: HistorieItemHeaderComponent =
getMockComponent<HistorieItemHeaderComponent>(fixture, HistorieItemHeaderComponent);
expect(itemHeaderComp.headline).toBe('einen Bescheid per Nachricht verschickt.');
});
it('should be called with resource', () => {
const itemHeaderComp: HistorieItemHeaderComponent =
getMockComponent<HistorieItemHeaderComponent>(fixture, HistorieItemHeaderComponent);
expect(itemHeaderComp.resource).toBe(component.command);
});
});
});
});
import { Bescheid } from '@alfa-client/bescheid-shared';
import { CommandOrder, CommandResource } from '@alfa-client/command-shared';
import { StringBasedKeyMap } from '@alfa-client/tech-shared';
import { Component, Input } from '@angular/core';
@Component({
selector: 'alfa-historie-item-bescheid',
templateUrl: './historie-item-bescheid.component.html',
styleUrls: ['./historie-item-bescheid.component.scss'],
})
export class HistorieItemBescheidComponent {
@Input() command: CommandResource;
headline: string;
hasBody: boolean = true;
get bescheid(): Bescheid {
return this.command.body;
}
ngOnInit(): void {
this.headline = HISTORIE_TEXT_BY_BESCHEID_ORDER[this.command.order];
this.hasBody = this.hasCommandBody();
}
private hasCommandBody(): boolean {
return this.command.order == CommandOrder.UPDATE_BESCHEID;
}
}
const HISTORIE_TEXT_BY_BESCHEID_ORDER: StringBasedKeyMap<string> = {
[CommandOrder.SEND_BESCHEID]: 'einen Bescheid per Nachricht verschickt.',
[CommandOrder.UPDATE_BESCHEID]: 'einen Bescheid erstellt.',
};
......@@ -72,6 +72,12 @@
data-test-id="historie-item-aktenzeichen"
></alfa-historie-item-aktenzeichen>
</ng-container>
<ng-container *ngSwitchCase="commandOrderType.BESCHEID">
<alfa-historie-item-bescheid
[command]="historieCommand"
data-test-id="historie-item-bescheid"
></alfa-historie-item-bescheid>
</ng-container>
<ng-container *ngSwitchDefault>
<alfa-historie-item-unknown
[headline]="historieCommand.order"
......
......@@ -21,13 +21,14 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { CommandOrder } from '@alfa-client/command-shared';
import { existsAsHtmlElement, getElementFromFixture } from '@alfa-client/test-utils';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CommandOrder, CommandOrderType } from '@alfa-client/command-shared';
import { getElementFromFixture } from '@alfa-client/test-utils';
import { createCommandResource } from 'libs/command-shared/test/command';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { MockComponent } from 'ng-mocks';
import { HistorieItemAssignUserContainerComponent } from '../historie-item-assign-user-container/historie-item-assign-user-container.component';
import { HistorieItemBescheidComponent } from '../historie-item-bescheid/historie-item-bescheid.component';
import { HistorieItemForwardingComponent } from '../historie-item-forwarding/historie-item-forwarding.component';
import { HistorieItemHeaderComponent } from '../historie-item-header/historie-item-header.component';
import { HistorieItemKommentarComponent } from '../historie-item-kommentar/historie-item-kommentar.component';
......@@ -47,6 +48,7 @@ describe('HistorieListItemComponent', () => {
const postfachNachrichtItem: string = getDataTestIdOf('historie-item-postfach-nachricht');
const vorgangItem: string = getDataTestIdOf('historie-item-vorgang');
const wiedervorlageItem: string = getDataTestIdOf('historie-item-wiedervorlage');
const bescheidItem: string = getDataTestIdOf('historie-item-bescheid');
beforeEach(async () => {
await TestBed.configureTestingModule({
......@@ -60,6 +62,7 @@ describe('HistorieListItemComponent', () => {
MockComponent(HistorieItemPostfachNachrichtComponent),
MockComponent(HistorieItemForwardingComponent),
MockComponent(HistorieItemAssignUserContainerComponent),
MockComponent(HistorieItemBescheidComponent),
],
}).compileComponents();
});
......@@ -76,7 +79,7 @@ describe('HistorieListItemComponent', () => {
});
describe('decision of item component', () => {
describe('on ' + CommandOrderType.USER + ' type ', () => {
describe('on User type ', () => {
const order: CommandOrder[] = [CommandOrder.ASSIGN_USER];
it.each(order)('should show item on order s%', (order: CommandOrder) => {
......@@ -89,7 +92,7 @@ describe('HistorieListItemComponent', () => {
});
});
describe('on ' + CommandOrderType.KOMMENTAR + ' type ', () => {
describe('on Kommentar type ', () => {
const order: CommandOrder[] = [CommandOrder.CREATE_KOMMENTAR, CommandOrder.EDIT_KOMMENTAR];
it.each(order)('should show item on order %s', (order: CommandOrder) => {
......@@ -102,7 +105,7 @@ describe('HistorieListItemComponent', () => {
});
});
describe('on ' + CommandOrderType.FORWARDING + ' type ', () => {
describe('on Fowarding type ', () => {
const order: CommandOrder[] = [
CommandOrder.REDIRECT_VORGANG,
CommandOrder.FORWARD_SUCCESSFULL,
......@@ -119,7 +122,7 @@ describe('HistorieListItemComponent', () => {
});
});
describe('on ' + CommandOrderType.POSTFACH_NACHRICHT + ' type ', () => {
describe('on Nachricht type ', () => {
const order: CommandOrder[] = [
CommandOrder.SEND_POSTFACH_NACHRICHT,
CommandOrder.RECEIVE_POSTFACH_NACHRICHT,
......@@ -135,7 +138,7 @@ describe('HistorieListItemComponent', () => {
});
});
describe('on ' + CommandOrderType.VORGANG + ' type ', () => {
describe('on Vorgang type ', () => {
const order: CommandOrder[] = [
CommandOrder.VORGANG_ANNEHMEN,
CommandOrder.VORGANG_VERWERFEN,
......@@ -157,7 +160,7 @@ describe('HistorieListItemComponent', () => {
});
});
describe('on ' + CommandOrderType.WIEDERVORLAGE + ' type ', () => {
describe('on Wiedervorlage type ', () => {
const order: CommandOrder[] = [
CommandOrder.CREATE_WIEDERVORLAGE,
CommandOrder.EDIT_WIEDERVORLAGE,
......@@ -174,5 +177,17 @@ describe('HistorieListItemComponent', () => {
expect(itemComponent).toBeInstanceOf(HTMLElement);
});
});
describe('on Bescheid type ', () => {
const order: CommandOrder[] = [CommandOrder.UPDATE_BESCHEID, CommandOrder.SEND_BESCHEID];
it.each(order)('should show item on order %s', (order: CommandOrder) => {
component.historieCommand = { ...createCommandResource(), order };
fixture.detectChanges();
existsAsHtmlElement(fixture, bescheidItem);
});
});
});
});
......@@ -21,12 +21,9 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { CommandResource } from '@alfa-client/command-shared';
import { CommandOrderType, ORDER_TYPE_BY_COMMAND_ORDER } from '@alfa-client/historie-shared';
import { Component, Input } from '@angular/core';
import {
CommandOrderType,
CommandResource,
ORDER_TYPE_BY_COMMAND_ORDER,
} from '@alfa-client/command-shared';
@Component({
selector: 'alfa-historie-list-item',
......
......@@ -21,18 +21,21 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { CommandSharedModule } from '@alfa-client/command-shared';
import { HistorieSharedModule } from '@alfa-client/historie-shared';
import { TechSharedModule } from '@alfa-client/tech-shared';
import { UiModule } from '@alfa-client/ui';
import { UserProfileModule } from '@alfa-client/user-profile';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { HistorieContainerComponent } from './historie-container/historie-container.component';
import { ExpansionPanelWithUserComponent } from './historie-container/historie-list/expansion-panel-with-user/expansion-panel-with-user.component';
import { HistorieItemAktenzeichenComponent } from './historie-container/historie-list/historie-item-aktenzeichen/historie-item-aktenzeichen.component';
import { HistorieItemAssignUserContainerComponent } from './historie-container/historie-list/historie-item-assign-user-container/historie-item-assign-user-container.component';
import { HistorieItemAssignUserComponent } from './historie-container/historie-list/historie-item-assign-user-container/historie-item-assign-user/historie-item-assign-user.component';
import { HistorieItemAttachmentComponent } from './historie-container/historie-list/historie-item-attachment/historie-item-attachment.component';
import { HistorieItemBescheidStatusComponent } from './historie-container/historie-list/historie-item-bescheid/historie-item-bescheid-status/historie-item-bescheid-status.component';
import { HistorieItemBescheidComponent } from './historie-container/historie-list/historie-item-bescheid/historie-item-bescheid.component';
import { HistorieItemForwardingComponent } from './historie-container/historie-list/historie-item-forwarding/historie-item-forwarding.component';
import { HistorieItemHeaderComponent } from './historie-container/historie-list/historie-item-header/historie-item-header.component';
import { HistorieItemKommentarComponent } from './historie-container/historie-list/historie-item-kommentar/historie-item-kommentar.component';
......@@ -45,7 +48,6 @@ import { HistorieItemWiedervorlageStatusComponent } from './historie-container/h
import { HistorieItemWiedervorlageComponent } from './historie-container/historie-list/historie-item-wiedervorlage/historie-item-wiedervorlage.component';
import { HistorieListItemComponent } from './historie-container/historie-list/historie-list-item/historie-list-item.component';
import { HistorieListComponent } from './historie-container/historie-list/historie-list.component';
import { HistorieItemAktenzeichenComponent } from './historie-container/historie-list/historie-item-aktenzeichen/historie-item-aktenzeichen.component';
@NgModule({
imports: [
......@@ -75,6 +77,8 @@ import { HistorieItemAktenzeichenComponent } from './historie-container/historie
HistorieItemAttachmentComponent,
HistorieItemLoeschAnforderungComponent,
HistorieItemAktenzeichenComponent,
HistorieItemBescheidComponent,
HistorieItemBescheidStatusComponent,
],
exports: [HistorieContainerComponent],
})
......
......@@ -32,6 +32,7 @@ export * from './lib/http.util';
export * from './lib/message-code';
export * from './lib/ngrx/actions';
export * from './lib/pipe/convert-for-data-test.pipe';
export * from './lib/pipe/convert-to-boolean.pipe';
export * from './lib/pipe/enum-to-label.pipe';
export * from './lib/pipe/file-size.pipe';
export * from './lib/pipe/format-date-with-time.pipe';
......
import { ConvertToBooleanPipe } from './convert-to-boolean.pipe';
import * as TechUtil from '../tech.util';
describe('convertToBoolean', () => {
const pipe: ConvertToBooleanPipe = new ConvertToBooleanPipe();
it('create an instance', () => {
expect(pipe).toBeTruthy();
});
describe('transform', () => {
const booleanStr: string = 'true';
let convertToBooleanSpy: jest.SpyInstance;
beforeEach(() => {
convertToBooleanSpy = jest.spyOn(TechUtil, 'convertToBoolean').mockReturnValue(true);
});
it('should call convert to boolean', () => {
pipe.transform(booleanStr);
expect(convertToBooleanSpy).toHaveBeenCalledWith(booleanStr);
});
it('should return converted result', () => {
jest.spyOn(TechUtil, 'convertToBoolean').mockReturnValue(true);
const converted: boolean = pipe.transform(booleanStr);
expect(converted).toBeTruthy();
});
});
});
import { Pipe, PipeTransform } from '@angular/core';
import { convertToBoolean } from '../tech.util';
@Pipe({ name: 'convertToBoolean' })
export class ConvertToBooleanPipe implements PipeTransform {
public transform(booleanStr: string): boolean {
return convertToBoolean(booleanStr);
}
}
......@@ -28,6 +28,7 @@ import { HttpBinaryFileInterceptor } from './interceptor/http-binary-file.interc
import { HttpXsrfInterceptor } from './interceptor/http-xsrf.interceptor';
import { XhrInterceptor } from './interceptor/xhr.interceptor';
import { ConvertForDataTestPipe } from './pipe/convert-for-data-test.pipe';
import { ConvertToBooleanPipe } from './pipe/convert-to-boolean.pipe';
import { EnumToLabelPipe } from './pipe/enum-to-label.pipe';
import { FileSizePlainPipe } from './pipe/file-size-plain.pipe';
import { FileSizePipe } from './pipe/file-size.pipe';
......@@ -63,6 +64,7 @@ import { ToTrafficLightPipe } from './pipe/to-traffic-light.pipe';
FileSizePipe,
FileSizePlainPipe,
GetUrlPipe,
ConvertToBooleanPipe,
],
exports: [
FormatToPrettyDatePipe,
......@@ -81,6 +83,7 @@ import { ToTrafficLightPipe } from './pipe/to-traffic-light.pipe';
FileSizePipe,
FileSizePlainPipe,
GetUrlPipe,
ConvertToBooleanPipe,
],
providers: [
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment