mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
fix(UIRefresh-Extension-Duo-2FA): [Auth/PM-18901] Adjust determineDuoLaunchAction logic to consider if already in popout (#13712)
This commit is contained in:
@@ -15,6 +15,7 @@ jest.mock("../popup/utils/auth-popout-window", () => {
|
||||
|
||||
jest.mock("../../platform/popup/browser-popup-utils", () => ({
|
||||
inSingleActionPopout: jest.fn(),
|
||||
inPopout: jest.fn(),
|
||||
}));
|
||||
|
||||
import { DuoLaunchAction } from "@bitwarden/auth/angular";
|
||||
@@ -173,6 +174,8 @@ describe("ExtensionTwoFactorAuthComponentService", () => {
|
||||
return key === AuthPopoutType.twoFactorAuthDuo;
|
||||
});
|
||||
|
||||
jest.spyOn(BrowserPopupUtils, "inPopout").mockImplementation(() => false);
|
||||
|
||||
expect(extensionTwoFactorAuthComponentService.determineDuoLaunchAction()).toBe(
|
||||
DuoLaunchAction.DIRECT_LAUNCH,
|
||||
);
|
||||
@@ -180,10 +183,20 @@ describe("ExtensionTwoFactorAuthComponentService", () => {
|
||||
|
||||
it("should return SINGLE_ACTION_POPOUT if not in two factor auth duo popout", () => {
|
||||
jest.spyOn(BrowserPopupUtils, "inSingleActionPopout").mockImplementation(() => false);
|
||||
jest.spyOn(BrowserPopupUtils, "inPopout").mockImplementation(() => false);
|
||||
|
||||
expect(extensionTwoFactorAuthComponentService.determineDuoLaunchAction()).toBe(
|
||||
DuoLaunchAction.SINGLE_ACTION_POPOUT,
|
||||
);
|
||||
});
|
||||
|
||||
it("should return DIRECT_LAUNCH if in popout", () => {
|
||||
jest.spyOn(BrowserPopupUtils, "inSingleActionPopout").mockImplementation(() => false);
|
||||
jest.spyOn(BrowserPopupUtils, "inPopout").mockImplementation(() => true);
|
||||
|
||||
expect(extensionTwoFactorAuthComponentService.determineDuoLaunchAction()).toBe(
|
||||
DuoLaunchAction.DIRECT_LAUNCH,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -106,7 +106,9 @@ export class ExtensionTwoFactorAuthComponentService
|
||||
AuthPopoutType.twoFactorAuthDuo,
|
||||
);
|
||||
|
||||
if (inTwoFactorAuthDuoPopout) {
|
||||
const inPopout = BrowserPopupUtils.inPopout(this.window);
|
||||
|
||||
if (inTwoFactorAuthDuoPopout || inPopout) {
|
||||
return DuoLaunchAction.DIRECT_LAUNCH;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user