mirror of
https://github.com/bitwarden/clients.git
synced 2026-11-16 07:03:29 +00:00
[PM-41494] Move Vault changes to their own PR
This commit is contained in:
@@ -53,7 +53,6 @@ import {
|
||||
|
||||
import { BrowserApi } from "../../../../platform/browser/browser-api";
|
||||
import BrowserPopupUtils from "../../../../platform/browser/browser-popup-utils";
|
||||
import { ImportConfirmationPopupService } from "../../../../tools/popup/settings/import/import-confirmation-popup.service";
|
||||
import { ImportUpgradeNavigationService } from "../../../../tools/popup/settings/import/import-upgrade-navigation.service";
|
||||
import { IntroCarouselService } from "../../services/intro-carousel.service";
|
||||
import { VaultPopupAutofillService } from "../../services/vault-popup-autofill.service";
|
||||
@@ -331,7 +330,6 @@ describe("VaultComponent", () => {
|
||||
};
|
||||
|
||||
const importUpgradeNavigationSvc = mock<ImportUpgradeNavigationService>();
|
||||
const importConfirmationPopupSvc = mock<ImportConfirmationPopupService>();
|
||||
|
||||
const premiumUpsellSvc = {
|
||||
showUpsell: jest.fn().mockReturnValue(false),
|
||||
@@ -347,9 +345,6 @@ describe("VaultComponent", () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks();
|
||||
// No import result is pending unless a test says so.
|
||||
importConfirmationPopupSvc.conditionallyOpen.mockReset();
|
||||
importConfirmationPopupSvc.conditionallyOpen.mockResolvedValue(false);
|
||||
premiumUpsellSvc.showUpsell.mockReturnValue(false);
|
||||
routeParams$.next(convertToParamMap({}));
|
||||
vaultNav$.next({ vaults: [], organizationDataOwnership: false });
|
||||
@@ -422,10 +417,6 @@ describe("VaultComponent", () => {
|
||||
provide: ImportUpgradeNavigationService,
|
||||
useValue: importUpgradeNavigationSvc,
|
||||
},
|
||||
{
|
||||
provide: ImportConfirmationPopupService,
|
||||
useValue: importConfirmationPopupSvc,
|
||||
},
|
||||
{
|
||||
provide: SearchService,
|
||||
useValue: { isCipherSearching$: of(false) },
|
||||
@@ -970,19 +961,6 @@ describe("VaultComponent", () => {
|
||||
flush();
|
||||
}));
|
||||
|
||||
it("ngOnInit shows the active user's own result of an import that finished in a tab", fakeAsync(() => {
|
||||
importConfirmationPopupSvc.conditionallyOpen.mockClear();
|
||||
activeAccount$.next({ id: "user-xyz" });
|
||||
|
||||
void component.ngOnInit();
|
||||
tick();
|
||||
|
||||
expect(importConfirmationPopupSvc.conditionallyOpen).toHaveBeenCalledTimes(1);
|
||||
expect(importConfirmationPopupSvc.conditionallyOpen).toHaveBeenCalledWith("user-xyz");
|
||||
|
||||
flush();
|
||||
}));
|
||||
|
||||
it("dismissVaultNudgeSpotlight forwards to NudgesService with active user id", fakeAsync(() => {
|
||||
const spy = jest.spyOn(nudgesSvc, "dismissNudge").mockResolvedValue(undefined);
|
||||
|
||||
@@ -1410,63 +1388,6 @@ describe("VaultComponent", () => {
|
||||
);
|
||||
}));
|
||||
|
||||
it("holds the dialog back on an open that showed the result of an import", fakeAsync(() => {
|
||||
importConfirmationPopupSvc.conditionallyOpen.mockResolvedValueOnce(true);
|
||||
|
||||
initVault();
|
||||
|
||||
expect(newExperienceDialogSpy).not.toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it("opens the dialog when there was no import result to show", fakeAsync(() => {
|
||||
importConfirmationPopupSvc.conditionallyOpen.mockResolvedValueOnce(false);
|
||||
|
||||
initVault();
|
||||
|
||||
expect(newExperienceDialogSpy).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it("looks for an import result only after data ownership enforcement has finished", fakeAsync(() => {
|
||||
let finish!: () => void;
|
||||
(vaultItemsTransferSvc.enforceOrganizationDataOwnership as jest.Mock).mockReturnValueOnce(
|
||||
new Promise<void>((resolve) => (finish = resolve)),
|
||||
);
|
||||
|
||||
initVault();
|
||||
|
||||
expect(importConfirmationPopupSvc.conditionallyOpen).not.toHaveBeenCalled();
|
||||
|
||||
finish();
|
||||
tick();
|
||||
|
||||
expect(importConfirmationPopupSvc.conditionallyOpen).toHaveBeenCalledTimes(1);
|
||||
}));
|
||||
|
||||
it("leaves the nudge undismissed on an open that showed the result of an import", fakeAsync(() => {
|
||||
importConfirmationPopupSvc.conditionallyOpen.mockResolvedValueOnce(true);
|
||||
|
||||
initVault();
|
||||
|
||||
expect(nudgesSvc.dismissNudge).not.toHaveBeenCalledWith(
|
||||
NudgeType.Vfo1NewExperience,
|
||||
expect.anything(),
|
||||
);
|
||||
}));
|
||||
|
||||
it("opens the dialog on the next open, after an open that showed the result of an import", fakeAsync(() => {
|
||||
importConfirmationPopupSvc.conditionallyOpen
|
||||
.mockResolvedValueOnce(true)
|
||||
.mockResolvedValueOnce(false);
|
||||
|
||||
initVault();
|
||||
|
||||
expect(newExperienceDialogSpy).not.toHaveBeenCalled();
|
||||
|
||||
initVault();
|
||||
|
||||
expect(newExperienceDialogSpy).toHaveBeenCalledTimes(1);
|
||||
}));
|
||||
|
||||
it("leaves dismissing the nudge to the dialog's actions", fakeAsync(() => {
|
||||
newExperienceDialogSpy.mockReturnValue(new Promise(() => {}));
|
||||
|
||||
|
||||
@@ -86,7 +86,6 @@ import { CurrentAccountComponent } from "../../../../auth/popup/account-switchin
|
||||
import { PopOutComponent } from "../../../../platform/popup/components/pop-out.component";
|
||||
import { PopupHeaderComponent } from "../../../../platform/popup/layout/popup-header.component";
|
||||
import { PopupPageComponent } from "../../../../platform/popup/layout/popup-page.component";
|
||||
import { ImportConfirmationPopupService } from "../../../../tools/popup/settings/import/import-confirmation-popup.service";
|
||||
import { ImportUpgradeNavigationService } from "../../../../tools/popup/settings/import/import-upgrade-navigation.service";
|
||||
import { IntroCarouselService } from "../../services/intro-carousel.service";
|
||||
import { VaultPopupItemsService } from "../../services/vault-popup-items.service";
|
||||
@@ -417,7 +416,6 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
private readonly importUpgradeNavigationService = inject(ImportUpgradeNavigationService);
|
||||
private readonly importConfirmationPopupService = inject(ImportConfirmationPopupService);
|
||||
|
||||
/**
|
||||
* Follows the scroll region rather than latching it: the table claims it only once its rows
|
||||
@@ -520,13 +518,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
|
||||
this.readySubject.next(true);
|
||||
|
||||
// The next open gets the new experience prompt: it must not open over the import result.
|
||||
const showedImportResult = await this.importConfirmationPopupService.conditionallyOpen(
|
||||
this.activeUserId,
|
||||
);
|
||||
if (!showedImportResult) {
|
||||
await this.openNewExperienceDialog(this.activeUserId, onboardingWelcomeDismissed);
|
||||
}
|
||||
await this.openNewExperienceDialog(this.activeUserId, onboardingWelcomeDismissed);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -72,7 +72,6 @@ export const LOGIN_EMAIL_DISK = new StateDefinition("loginEmail", "disk", {
|
||||
});
|
||||
export const LOGIN_EMAIL_MEMORY = new StateDefinition("loginEmail", "memory");
|
||||
export const LOGIN_STRATEGY_MEMORY = new StateDefinition("loginStrategy", "memory");
|
||||
export const IMPORT_CONFIRMATION_MEMORY = new StateDefinition("importConfirmation", "memory");
|
||||
export const MASTER_PASSWORD_DISK = new StateDefinition("masterPassword", "disk");
|
||||
export const MASTER_PASSWORD_UNLOCK_DISK = new StateDefinition("masterPasswordUnlock", "disk");
|
||||
export const ROUTER_DISK = new StateDefinition("router", "disk");
|
||||
@@ -192,6 +191,7 @@ export const SM_ONBOARDING_DISK = new StateDefinition("smOnboarding", "disk", {
|
||||
export const EXTENSION_DISK = new StateDefinition("extension", "disk");
|
||||
export const GENERATOR_DISK = new StateDefinition("generator", "disk");
|
||||
export const GENERATOR_MEMORY = new StateDefinition("generator", "memory");
|
||||
export const IMPORT_CONFIRMATION_MEMORY = new StateDefinition("importConfirmation", "memory");
|
||||
export const BROWSER_SEND_MEMORY = new StateDefinition("sendBrowser", "memory");
|
||||
export const EVENT_COLLECTION_DISK = new StateDefinition("eventCollection", "disk");
|
||||
export const SEND_DISK = new StateDefinition("encryptedSend", "disk", {
|
||||
|
||||
Reference in New Issue
Block a user