From 8f8a55822d44030332ab05819ce8fc4ae61e4cc1 Mon Sep 17 00:00:00 2001
From: andrej romanov <50377758+auumgn@users.noreply.github.com>
Date: Mon, 22 Jul 2024 18:24:41 +0300
Subject: [PATCH] fix test
---
.../modals/modal-email/modal-email.component.html | 5 +++--
.../modals/modal-email/modal-email.component.spec.ts | 8 ++++++--
.../side-bar/modals/modal-email/modal-email.component.ts | 4 ++--
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.html b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.html
index 967bc21baf..f5be10ed40 100644
--- a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.html
+++ b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.html
@@ -258,7 +258,7 @@
[ngClass]="{
'disabled-select-notifications-email': hasOneEmailAddress()
}"
- placeholder=" {{ primaryEmail.value }}"
+ placeholder=" {{ primaryEmail?.value }}"
[(value)]="primaryEmail"
class="select-notifications-email orc-font-body-small"
>
@@ -266,7 +266,8 @@
diff --git a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.spec.ts b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.spec.ts
index 12a069e695..00e7ca8375 100644
--- a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.spec.ts
+++ b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.spec.ts
@@ -4,7 +4,6 @@ import { ModalEmailComponent } from './modal-email.component'
import { HttpClientTestingModule } from '@angular/common/http/testing'
import { RouterTestingModule } from '@angular/router/testing'
import { WINDOW_PROVIDERS } from '../../../window'
-import { RegisterService } from '../../../../core/register/register.service'
import { PlatformInfoService } from '../../../platform-info'
import { ErrorHandlerService } from '../../../../core/error-handler/error-handler.service'
import { SnackbarService } from '../../../snackbar/snackbar.service'
@@ -15,6 +14,7 @@ import {
MatLegacyDialogRef as MatDialogRef,
} from '@angular/material/legacy-dialog'
import { Overlay } from '@angular/cdk/overlay'
+import { AlertMessageModule } from 'src/app/cdk/alert-message/alert-message.module'
describe('ModalEmailComponent', () => {
let component: ModalEmailComponent
@@ -22,7 +22,11 @@ describe('ModalEmailComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
- imports: [HttpClientTestingModule, RouterTestingModule],
+ imports: [
+ HttpClientTestingModule,
+ RouterTestingModule,
+ AlertMessageModule,
+ ],
declarations: [ModalEmailComponent],
providers: [
{ provide: MAT_DIALOG_DATA, useValue: {} },
diff --git a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.ts b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.ts
index 89df1be13d..6f25d97040 100644
--- a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.ts
+++ b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.ts
@@ -70,7 +70,7 @@ export class ModalEmailComponent implements OnInit, OnDestroy {
addedEmailsCount = 0
emailsForm: UntypedFormGroup = new UntypedFormGroup({})
emails: AssertionVisibilityString[] = []
- primaryEmail: AssertionVisibilityString
+ primaryEmail: AssertionVisibilityString | undefined = undefined
originalEmailsBackendCopy: AssertionVisibilityString[]
defaultVisibility: VisibilityStrings = 'PRIVATE'
@@ -399,7 +399,7 @@ export class ModalEmailComponent implements OnInit, OnDestroy {
deleteEmail(controlKey: string) {
if (!this.hasOneEmailAddress(controlKey)) {
- if (controlKey === this.primaryEmail.putCode) {
+ if (controlKey === this.primaryEmail?.putCode) {
this.setNextEmailAsPrimary()
}