1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-18 15:47:57 +01:00

remove check for SHOW_AUTOFILL_BUTTON (#11971)

This commit is contained in:
Nick Krantz 2024-11-13 10:58:34 -06:00 committed by GitHub
parent a75c2118ec
commit 251213b69c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import { Subject } from "rxjs";
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service"; import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { AUTOFILL_ID } from "@bitwarden/common/autofill/constants";
import { EventType } from "@bitwarden/common/enums"; import { EventType } from "@bitwarden/common/enums";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
@ -33,6 +34,7 @@ describe("ViewV2Component", () => {
const params$ = new Subject(); const params$ = new Subject();
const mockNavigate = jest.fn(); const mockNavigate = jest.fn();
const collect = jest.fn().mockResolvedValue(null); const collect = jest.fn().mockResolvedValue(null);
const doAutofill = jest.fn();
const mockCipher = { const mockCipher = {
id: "122-333-444", id: "122-333-444",
@ -41,7 +43,7 @@ describe("ViewV2Component", () => {
}; };
const mockVaultPopupAutofillService = { const mockVaultPopupAutofillService = {
doAutofill: jest.fn(), doAutofill,
}; };
const mockUserId = Utils.newGuid() as UserId; const mockUserId = Utils.newGuid() as UserId;
const accountService: FakeAccountService = mockAccountServiceWith(mockUserId); const accountService: FakeAccountService = mockAccountServiceWith(mockUserId);
@ -54,6 +56,7 @@ describe("ViewV2Component", () => {
beforeEach(async () => { beforeEach(async () => {
mockNavigate.mockClear(); mockNavigate.mockClear();
collect.mockClear(); collect.mockClear();
doAutofill.mockClear();
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
imports: [ViewV2Component], imports: [ViewV2Component],
@ -148,5 +151,13 @@ describe("ViewV2Component", () => {
undefined, undefined,
); );
})); }));
it('invokes `doAutofill` when action="AUTOFILL_ID"', fakeAsync(() => {
params$.next({ action: AUTOFILL_ID });
flush(); // Resolve all promises
expect(doAutofill).toHaveBeenCalledOnce();
}));
}); });
}); });

View File

@ -100,7 +100,7 @@ export class ViewV2Component {
switchMap(async (cipher) => { switchMap(async (cipher) => {
this.cipher = cipher; this.cipher = cipher;
this.headerText = this.setHeader(cipher.type); this.headerText = this.setHeader(cipher.type);
if (this.loadAction === AUTOFILL_ID || this.loadAction === SHOW_AUTOFILL_BUTTON) { if (this.loadAction === AUTOFILL_ID) {
await this.vaultPopupAutofillService.doAutofill(this.cipher); await this.vaultPopupAutofillService.doAutofill(this.cipher);
} }