diff --git a/modules/ui/src/app/components/download-zip-modal/download-zip-modal.component.html b/modules/ui/src/app/components/download-zip-modal/download-zip-modal.component.html index 072ab9c19..2e9446cfa 100644 --- a/modules/ui/src/app/components/download-zip-modal/download-zip-modal.component.html +++ b/modules/ui/src/app/components/download-zip-modal/download-zip-modal.component.html @@ -55,11 +55,17 @@ [(value)]="selectedProfile" aria-label="Please choose a Risk Profile from the list"> - {{ selectedProfile }} + {{ selectedProfile.name }} + + {{ selectedProfile.risk }} risk + { }); it('should preselect "no profile" option', async () => { - const select = fixture.nativeElement.querySelector( - 'mat-select' - ) as HTMLElement; - - expect(select.getAttribute('ng-reflect-value')).toEqual( + expect(component.selectedProfile.name).toEqual( 'No Risk Profile selected' ); }); diff --git a/modules/ui/src/app/components/download-zip-modal/download-zip-modal.component.ts b/modules/ui/src/app/components/download-zip-modal/download-zip-modal.component.ts index f54bdfdd0..b042bdabf 100644 --- a/modules/ui/src/app/components/download-zip-modal/download-zip-modal.component.ts +++ b/modules/ui/src/app/components/download-zip-modal/download-zip-modal.component.ts @@ -53,7 +53,7 @@ export class DownloadZipModalComponent extends EscapableDialogComponent { } as Profile; public readonly Routes = Routes; profiles: Profile[] = []; - selectedProfile: string = ''; + selectedProfile: Profile; constructor( private readonly testRunService: TestRunService, public override dialogRef: MatDialogRef, @@ -69,14 +69,18 @@ export class DownloadZipModalComponent extends EscapableDialogComponent { ); } this.profiles.unshift(this.NO_PROFILE); - this.selectedProfile = this.profiles[0].name; + this.selectedProfile = this.profiles[0]; } - cancel(profile?: string | null) { - if (profile === this.NO_PROFILE.name) { - profile = ''; + cancel(profile?: Profile | null) { + if (profile === null) { + this.dialogRef.close(null); } - this.dialogRef.close(profile); + let value = profile?.name; + if (profile && profile?.name === this.NO_PROFILE.name) { + value = ''; + } + this.dialogRef.close(value); } public getRiskClass(riskResult: string): RiskResultClassName {