Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
auumgn committed Jul 22, 2024
1 parent a442cc8 commit 8f8a558
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,16 @@ <h2 class="orc-font-body-large" i18n="@@side-bar.emailAddressesUppercase">
[ngClass]="{
'disabled-select-notifications-email': hasOneEmailAddress()
}"
placeholder=" {{ primaryEmail.value }}"
placeholder=" {{ primaryEmail?.value }}"
[(value)]="primaryEmail"
class="select-notifications-email orc-font-body-small"
>
<ng-container *ngFor="let email of emails">
<mat-option
*ngIf="email.verified"
[ngClass]="{
'current-notification-email': email.value === primaryEmail.value
'current-notification-email':
email.value === primaryEmail?.value
}"
[value]="email"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -15,14 +14,19 @@ 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
let fixture: ComponentFixture<ModalEmailComponent>

beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule, RouterTestingModule],
imports: [
HttpClientTestingModule,
RouterTestingModule,
AlertMessageModule,
],
declarations: [ModalEmailComponent],
providers: [
{ provide: MAT_DIALOG_DATA, useValue: {} },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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()
}

Expand Down

0 comments on commit 8f8a558

Please sign in to comment.