1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

[PM-28231] Enable component-class-suffix (#17384)

* Enable component-class-suffix

* Rename file
This commit is contained in:
Oscar Hinton
2025-11-18 13:26:38 +01:00
committed by GitHub
parent 8f04f25818
commit 9efc31534b
38 changed files with 111 additions and 88 deletions

View File

@@ -5,7 +5,7 @@ import { Account, AccountService } from "@bitwarden/common/auth/abstractions/acc
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { CipherType } from "@bitwarden/common/vault/enums";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { BitIconButtonComponent, MenuItemDirective } from "@bitwarden/components";
import { BitIconButtonComponent, MenuItemComponent } from "@bitwarden/components";
import { CopyCipherFieldService } from "@bitwarden/vault";
import { CopyCipherFieldDirective } from "./copy-cipher-field.directive";
@@ -83,7 +83,7 @@ describe("CopyCipherFieldDirective", () => {
});
it("updates menuItemDirective disabled state", async () => {
const menuItemDirective = {
const menuItemComponent = {
disabled: false,
};
@@ -91,14 +91,14 @@ describe("CopyCipherFieldDirective", () => {
copyFieldService as unknown as CopyCipherFieldService,
mockAccountService,
mockCipherService,
menuItemDirective as unknown as MenuItemDirective,
menuItemComponent as unknown as MenuItemComponent,
);
copyCipherFieldDirective.action = "totp";
await copyCipherFieldDirective.ngOnChanges();
expect(menuItemDirective.disabled).toBe(true);
expect(menuItemComponent.disabled).toBe(true);
});
});

View File

@@ -10,7 +10,7 @@ import {
CipherViewLike,
CipherViewLikeUtils,
} from "@bitwarden/common/vault/utils/cipher-view-like-utils";
import { MenuItemDirective, BitIconButtonComponent } from "@bitwarden/components";
import { MenuItemComponent, BitIconButtonComponent } from "@bitwarden/components";
import { CopyAction, CopyCipherFieldService } from "@bitwarden/vault";
/**
@@ -47,7 +47,7 @@ export class CopyCipherFieldDirective implements OnChanges {
private copyCipherFieldService: CopyCipherFieldService,
private accountService: AccountService,
private cipherService: CipherService,
@Optional() private menuItemDirective?: MenuItemDirective,
@Optional() private menuItemComponent?: MenuItemComponent,
@Optional() private iconButtonComponent?: BitIconButtonComponent,
) {}
@@ -60,7 +60,7 @@ export class CopyCipherFieldDirective implements OnChanges {
*/
@HostBinding("class.tw-hidden")
private get hidden() {
return this.disabled && this.menuItemDirective;
return this.disabled && this.menuItemComponent;
}
@HostListener("click")
@@ -87,8 +87,8 @@ export class CopyCipherFieldDirective implements OnChanges {
}
// If the directive is used on a menu item, update the menu item to prevent keyboard navigation
if (this.menuItemDirective) {
this.menuItemDirective.disabled = this.disabled ?? false;
if (this.menuItemComponent) {
this.menuItemComponent.disabled = this.disabled ?? false;
}
}