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

OZG-6620 Bugfix signatur updates

parent da211897
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
[formControlName]="formServiceClass.FIELD_MAIL_BODY" [formControlName]="formServiceClass.FIELD_MAIL_BODY"
label="Text" label="Text"
class="message-editor mt-3" class="message-editor mt-3"
[value]="signatur" [value]="signatur$ | async"
[autoFocus]="true" [autoFocus]="true"
[required]="true" [required]="true"
> >
......
...@@ -125,8 +125,9 @@ describe('PostfachMailFormComponent', () => { ...@@ -125,8 +125,9 @@ describe('PostfachMailFormComponent', () => {
expect(component.patchPostfachNachricht).toHaveBeenCalled(); expect(component.patchPostfachNachricht).toHaveBeenCalled();
}); });
}); });
});
describe('on setting signatur', () => { describe('ngAfterViewInit', () => {
it('should call postfachService', () => { it('should call postfachService', () => {
component.ngOnInit(); component.ngOnInit();
...@@ -136,7 +137,8 @@ describe('PostfachMailFormComponent', () => { ...@@ -136,7 +137,8 @@ describe('PostfachMailFormComponent', () => {
it('should set signatur', () => { it('should set signatur', () => {
component.ngOnInit(); component.ngOnInit();
expect(component.signatur).toBe(postfachSettings.signatur); component.signatur$.subscribe((signatur: string) => {
expect(signatur).toBe(postfachSettings.signatur);
}); });
}); });
}); });
......
...@@ -25,7 +25,7 @@ import { CommandResource } from '@alfa-client/command-shared'; ...@@ -25,7 +25,7 @@ import { CommandResource } from '@alfa-client/command-shared';
import { PostfachMailFormDialogData } from '@alfa-client/postfach-shared'; import { PostfachMailFormDialogData } from '@alfa-client/postfach-shared';
import { StateResource, createEmptyStateResource, isNotNil } from '@alfa-client/tech-shared'; import { StateResource, createEmptyStateResource, isNotNil } from '@alfa-client/tech-shared';
import { DialogService } from '@alfa-client/ui'; import { DialogService } from '@alfa-client/ui';
import { Component, Inject, OnInit } from '@angular/core'; import { ChangeDetectorRef, Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { Observable, of, tap } from 'rxjs'; import { Observable, of, tap } from 'rxjs';
import { PostfachMailFormservice } from './postfach-mail.formservice'; import { PostfachMailFormservice } from './postfach-mail.formservice';
...@@ -39,8 +39,8 @@ import * as CommandUtil from '../../../../command-shared/src/lib/command.util'; ...@@ -39,8 +39,8 @@ import * as CommandUtil from '../../../../command-shared/src/lib/command.util';
providers: [PostfachMailFormservice], providers: [PostfachMailFormservice],
}) })
export class PostfachMailFormComponent implements OnInit { export class PostfachMailFormComponent implements OnInit {
public signatur$: Observable<string>;
public readonly formServiceClass = PostfachMailFormservice; public readonly formServiceClass = PostfachMailFormservice;
public signatur = '';
public sendInProgress$: Observable<StateResource<CommandResource>> = of( public sendInProgress$: Observable<StateResource<CommandResource>> = of(
createEmptyStateResource<CommandResource>(), createEmptyStateResource<CommandResource>(),
...@@ -50,16 +50,18 @@ export class PostfachMailFormComponent implements OnInit { ...@@ -50,16 +50,18 @@ export class PostfachMailFormComponent implements OnInit {
private dialogService: DialogService, private dialogService: DialogService,
@Inject(MAT_DIALOG_DATA) public dialogData: PostfachMailFormDialogData, @Inject(MAT_DIALOG_DATA) public dialogData: PostfachMailFormDialogData,
public formService: PostfachMailFormservice, public formService: PostfachMailFormservice,
private changeDetectorRef: ChangeDetectorRef,
) {} ) {}
ngOnInit(): void { ngOnInit(): void {
if (isNotNil(this.dialogData.postfachNachricht)) { if (isNotNil(this.dialogData.postfachNachricht)) {
this.patchPostfachNachricht(); this.patchPostfachNachricht();
} }
}
this.formService.getSignatur().subscribe((signatur: string) => { ngAfterViewInit(): void {
this.signatur = signatur; this.signatur$ = this.formService.getSignatur();
}); this.changeDetectorRef.detectChanges();
} }
patchPostfachNachricht(): void { patchPostfachNachricht(): void {
......
...@@ -102,7 +102,7 @@ describe('PostfachMailFormservice', () => { ...@@ -102,7 +102,7 @@ describe('PostfachMailFormservice', () => {
}); });
it('should return signatur', () => { it('should return signatur', () => {
formService.getSignatur().subscribe((signatur) => { formService.getSignatur().subscribe((signatur: string) => {
expect(signatur).toBe(postfachSettings.signatur); expect(signatur).toBe(postfachSettings.signatur);
}); });
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment