[PM-9962] Hide remove passkey button when cipher has "except passwords" permissions

This commit is contained in:
Shane Melton 2024-07-26 14:48:37 -07:00
parent 9a0188048c
commit 11e874aaef
No known key found for this signature in database
2 changed files with 12 additions and 2 deletions

View File

@ -67,7 +67,7 @@
bitIconButton="bwi-minus-circle"
buttonType="danger"
bitSuffix
*ngIf="loginDetailsForm.enabled"
*ngIf="loginDetailsForm.enabled && viewHiddenFields"
[bitAction]="removePasskey"
data-testid="remove-passkey-button"
[appA11yTitle]="'removePasskey' | i18n"

View File

@ -452,6 +452,8 @@ describe("LoginDetailsSectionComponent", () => {
fixture = TestBed.createComponent(LoginDetailsSectionComponent);
component = fixture.componentInstance;
jest.spyOn(component, "viewHiddenFields", "get").mockReturnValue(true);
});
it("renders the passkey field when available", () => {
@ -469,7 +471,7 @@ describe("LoginDetailsSectionComponent", () => {
it("renders the passkey remove button when editable", () => {
fixture.detectChanges();
expect(getRemovePasskeyBtn).not.toBeNull();
expect(getRemovePasskeyBtn()).not.toBeNull();
});
it("does not render the passkey remove button when not editable", () => {
@ -480,6 +482,14 @@ describe("LoginDetailsSectionComponent", () => {
expect(getRemovePasskeyBtn()).toBeNull();
});
it("does not render the passkey remove button when viewHiddenFields is false", () => {
jest.spyOn(component, "viewHiddenFields", "get").mockReturnValue(false);
fixture.detectChanges();
expect(getRemovePasskeyBtn()).toBeNull();
});
it("hides the passkey field when missing a passkey", () => {
(cipherFormContainer.originalCipherView as CipherView).login.fido2Credentials = [];