mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 17:53:39 +00:00
[PM-20988][PM-20986][PM-20983][PM-20971][PM-21019] - Multiple defect fixes for desktop cipher form update (#14559)
* multiple bug fixes * favor getters to local state * fix tests
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<bit-section *ngIf="showPersonalDetails">
|
||||
<bit-section *ngIf="hasPersonalDetails">
|
||||
<bit-section-header>
|
||||
<h2 bitTypography="h6">{{ "personalDetails" | i18n }}</h2>
|
||||
</bit-section-header>
|
||||
@@ -66,7 +66,7 @@
|
||||
</read-only-cipher-card>
|
||||
</bit-section>
|
||||
|
||||
<bit-section *ngIf="showIdentificationDetails">
|
||||
<bit-section *ngIf="hasIdentificationDetails">
|
||||
<bit-section-header>
|
||||
<h2 bitTypography="h6">{{ "identification" | i18n }}</h2>
|
||||
</bit-section-header>
|
||||
@@ -155,7 +155,7 @@
|
||||
</read-only-cipher-card>
|
||||
</bit-section>
|
||||
|
||||
<bit-section *ngIf="showContactDetails">
|
||||
<bit-section *ngIf="hasContactDetails">
|
||||
<bit-section-header>
|
||||
<h2 bitTypography="h6">{{ "contactInfo" | i18n }}</h2>
|
||||
</bit-section-header>
|
||||
|
||||
@@ -43,7 +43,6 @@ describe("ViewIdentitySectionsComponent", () => {
|
||||
},
|
||||
} as CipherView;
|
||||
|
||||
component.ngOnInit();
|
||||
fixture.detectChanges();
|
||||
|
||||
personalDetailSection = fixture.debugElement.query(By.directive(SectionHeaderComponent));
|
||||
@@ -61,7 +60,6 @@ describe("ViewIdentitySectionsComponent", () => {
|
||||
},
|
||||
} as CipherView;
|
||||
|
||||
component.ngOnInit();
|
||||
fixture.detectChanges();
|
||||
|
||||
const fields = fixture.debugElement.queryAll(By.directive(BitInputDirective));
|
||||
@@ -86,7 +84,6 @@ describe("ViewIdentitySectionsComponent", () => {
|
||||
},
|
||||
} as CipherView;
|
||||
|
||||
component.ngOnInit();
|
||||
fixture.detectChanges();
|
||||
|
||||
identificationDetailSection = fixture.debugElement.query(
|
||||
@@ -106,7 +103,6 @@ describe("ViewIdentitySectionsComponent", () => {
|
||||
},
|
||||
} as CipherView;
|
||||
|
||||
component.ngOnInit();
|
||||
fixture.detectChanges();
|
||||
|
||||
const fields = fixture.debugElement.queryAll(By.directive(BitInputDirective));
|
||||
@@ -129,7 +125,6 @@ describe("ViewIdentitySectionsComponent", () => {
|
||||
},
|
||||
} as CipherView;
|
||||
|
||||
component.ngOnInit();
|
||||
fixture.detectChanges();
|
||||
|
||||
contactDetailSection = fixture.debugElement.query(By.directive(SectionHeaderComponent));
|
||||
@@ -151,7 +146,6 @@ describe("ViewIdentitySectionsComponent", () => {
|
||||
},
|
||||
} as CipherView;
|
||||
|
||||
component.ngOnInit();
|
||||
fixture.detectChanges();
|
||||
|
||||
const fields = fixture.debugElement.queryAll(By.directive(BitInputDirective));
|
||||
@@ -174,7 +168,6 @@ describe("ViewIdentitySectionsComponent", () => {
|
||||
},
|
||||
} as CipherView;
|
||||
|
||||
component.ngOnInit();
|
||||
fixture.detectChanges();
|
||||
|
||||
let textarea = fixture.debugElement.query(By.css("textarea"));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { NgIf } from "@angular/common";
|
||||
import { Component, Input, OnInit } from "@angular/core";
|
||||
import { Component, Input } from "@angular/core";
|
||||
|
||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
||||
@@ -28,19 +28,9 @@ import { ReadOnlyCipherCardComponent } from "../read-only-cipher-card/read-only-
|
||||
ReadOnlyCipherCardComponent,
|
||||
],
|
||||
})
|
||||
export class ViewIdentitySectionsComponent implements OnInit {
|
||||
export class ViewIdentitySectionsComponent {
|
||||
@Input({ required: true }) cipher: CipherView | null = null;
|
||||
|
||||
showPersonalDetails: boolean = false;
|
||||
showIdentificationDetails: boolean = false;
|
||||
showContactDetails: boolean = false;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.showPersonalDetails = this.hasPersonalDetails();
|
||||
this.showIdentificationDetails = this.hasIdentificationDetails();
|
||||
this.showContactDetails = this.hasContactDetails();
|
||||
}
|
||||
|
||||
/** Returns all populated address fields */
|
||||
get addressFields(): string {
|
||||
if (!this.cipher) {
|
||||
@@ -57,7 +47,7 @@ export class ViewIdentitySectionsComponent implements OnInit {
|
||||
}
|
||||
|
||||
/** Returns true when any of the "personal detail" attributes are populated */
|
||||
private hasPersonalDetails(): boolean {
|
||||
get hasPersonalDetails(): boolean {
|
||||
if (!this.cipher) {
|
||||
return false;
|
||||
}
|
||||
@@ -67,7 +57,7 @@ export class ViewIdentitySectionsComponent implements OnInit {
|
||||
}
|
||||
|
||||
/** Returns true when any of the "identification detail" attributes are populated */
|
||||
private hasIdentificationDetails(): boolean {
|
||||
get hasIdentificationDetails(): boolean {
|
||||
if (!this.cipher) {
|
||||
return false;
|
||||
}
|
||||
@@ -77,7 +67,7 @@ export class ViewIdentitySectionsComponent implements OnInit {
|
||||
}
|
||||
|
||||
/** Returns true when any of the "contact detail" attributes are populated */
|
||||
private hasContactDetails(): boolean {
|
||||
get hasContactDetails(): boolean {
|
||||
if (!this.cipher) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user