1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 23:33:31 +00:00

[PM-7900] Login Credentials and Autofill Browser V2 View sections (#10417)

* Added sections for Login Credentials and Autofill Options.
This commit is contained in:
Jason Ng
2024-08-08 13:52:45 -04:00
committed by GitHub
parent ad3c680f2c
commit bca619d0a4
11 changed files with 289 additions and 6 deletions

View File

@@ -22,9 +22,11 @@ import {
DialogService,
ToastService,
} from "@bitwarden/components";
import { TotpCaptureService } from "@bitwarden/vault";
import { CipherViewComponent } from "../../../../../../../../libs/vault/src/cipher-view";
import { PopOutComponent } from "../../../../../platform/popup/components/pop-out.component";
import { BrowserTotpCaptureService } from "../../../services/browser-totp-capture.service";
import { PopupFooterComponent } from "./../../../../../platform/popup/layout/popup-footer.component";
import { PopupHeaderComponent } from "./../../../../../platform/popup/layout/popup-header.component";
@@ -34,6 +36,7 @@ import { PopupPageComponent } from "./../../../../../platform/popup/layout/popup
selector: "app-view-v2",
templateUrl: "view-v2.component.html",
standalone: true,
providers: [{ provide: TotpCaptureService, useClass: BrowserTotpCaptureService }],
imports: [
CommonModule,
SearchModule,

View File

@@ -13,10 +13,15 @@ describe("BrowserTotpCaptureService", () => {
let testBed: TestBed;
let service: BrowserTotpCaptureService;
let mockCaptureVisibleTab: jest.SpyInstance;
let createNewTabSpy: jest.SpyInstance;
const validTotpUrl = "otpauth://totp/label?secret=123";
beforeEach(() => {
const tabReturn = new Promise<chrome.tabs.Tab>((resolve) =>
resolve({ url: "google.com", active: true } as chrome.tabs.Tab),
);
createNewTabSpy = jest.spyOn(BrowserApi, "createNewTab").mockReturnValue(tabReturn);
mockCaptureVisibleTab = jest.spyOn(BrowserApi, "captureVisibleTab");
mockCaptureVisibleTab.mockResolvedValue("screenshot");
@@ -66,4 +71,10 @@ describe("BrowserTotpCaptureService", () => {
expect(result).toBeNull();
});
it("should call BrowserApi.createNewTab with a given loginURI", async () => {
await service.openAutofillNewTab("www.google.com");
expect(createNewTabSpy).toHaveBeenCalledWith("www.google.com");
});
});

View File

@@ -20,4 +20,8 @@ export class BrowserTotpCaptureService implements TotpCaptureService {
}
return null;
}
async openAutofillNewTab(loginUri: string) {
await BrowserApi.createNewTab(loginUri);
}
}