mirror of
https://github.com/bitwarden/browser
synced 2026-03-01 02:51:24 +00:00
[CL-1051] Generic closeOnNavigation for drawers (#19031)
Exposes closeOnNavigation from cdk config and implements a drawer close solution on navigation. More complex scenarios may still require custom handling. DialogService is referenced in imported components in some tests meaning we need to use overrideProvider rather than providers.
This commit is contained in:
@@ -84,11 +84,12 @@ describe("VaultListItemsContainerComponent", () => {
|
||||
{ provide: CipherService, useValue: mock<CipherService>() },
|
||||
{ provide: Router, useValue: { navigate: jest.fn() } },
|
||||
{ provide: PlatformUtilsService, useValue: { getAutofillKeyboardShortcut: () => "" } },
|
||||
{ provide: DialogService, useValue: mock<DialogService>() },
|
||||
{ provide: PasswordRepromptService, useValue: mock<PasswordRepromptService>() },
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
}).compileComponents();
|
||||
})
|
||||
.overrideProvider(DialogService, { useValue: mock<DialogService>() })
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(VaultListItemsContainerComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
@@ -62,7 +62,6 @@ describe("ArchiveComponent", () => {
|
||||
useValue: { hasOrganizations, organizations$: () => of([]) },
|
||||
},
|
||||
{ provide: CollectionService, useValue: { decryptedCollections$ } },
|
||||
{ provide: DialogService, useValue: mock<DialogService>() },
|
||||
{ provide: CipherService, useValue: mock<CipherService>() },
|
||||
{
|
||||
provide: CipherArchiveService,
|
||||
@@ -99,7 +98,9 @@ describe("ArchiveComponent", () => {
|
||||
},
|
||||
},
|
||||
],
|
||||
}).compileComponents();
|
||||
})
|
||||
.overrideProvider(DialogService, { useValue: mock<DialogService>() })
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ArchiveComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
@@ -10,6 +10,7 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service"
|
||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||
import { CipherRepromptType, CipherType } from "@bitwarden/common/vault/enums";
|
||||
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
||||
import { DialogService } from "@bitwarden/components";
|
||||
import { PasswordRepromptService } from "@bitwarden/vault";
|
||||
|
||||
import { DesktopSettingsService } from "../../../platform/services/desktop-settings.service";
|
||||
@@ -65,7 +66,9 @@ describe("Fido2VaultComponent", () => {
|
||||
{ provide: I18nService, useValue: mockI18nService },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).compileComponents();
|
||||
})
|
||||
.overrideProvider(DialogService, { useValue: mock<DialogService>() })
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(Fido2VaultComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
@@ -86,7 +86,6 @@ describe("VaultItemDialogComponent", () => {
|
||||
{ provide: I18nService, useValue: { t: (key: string) => key } },
|
||||
{ provide: DIALOG_DATA, useValue: { ...baseParams } },
|
||||
{ provide: DialogRef, useValue: {} },
|
||||
{ provide: DialogService, useValue: {} },
|
||||
{
|
||||
provide: ToastService,
|
||||
useValue: {
|
||||
@@ -173,7 +172,9 @@ describe("VaultItemDialogComponent", () => {
|
||||
{ provide: SyncService, useValue: {} },
|
||||
{ provide: CipherRiskService, useValue: {} },
|
||||
],
|
||||
}).compileComponents();
|
||||
})
|
||||
.overrideProvider(DialogService, { useValue: {} })
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(TestVaultItemDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
@@ -87,7 +87,6 @@ describe("AddEditComponentV2", () => {
|
||||
{ provide: DIALOG_DATA, useValue: mockParams },
|
||||
{ provide: DialogRef, useValue: dialogRef },
|
||||
{ provide: I18nService, useValue: { t: jest.fn().mockReturnValue("login") } },
|
||||
{ provide: DialogService, useValue: dialogService },
|
||||
{ provide: CipherService, useValue: cipherService },
|
||||
{ provide: MessagingService, useValue: messagingService },
|
||||
{ provide: OrganizationService, useValue: organizationService },
|
||||
@@ -105,7 +104,9 @@ describe("AddEditComponentV2", () => {
|
||||
},
|
||||
{ provide: AccountService, useValue: accountService },
|
||||
],
|
||||
}).compileComponents();
|
||||
})
|
||||
.overrideProvider(DialogService, { useValue: dialogService })
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(AddEditComponentV2);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
Reference in New Issue
Block a user