mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[PM-19826] - browser - clear history after creating new cipher (#14894)
* browser - clear history after creating new cipher * fix tests
This commit is contained in:
@@ -51,6 +51,7 @@ describe("AddEditV2Component", () => {
|
||||
const disable = jest.fn();
|
||||
const navigate = jest.fn();
|
||||
const back = jest.fn().mockResolvedValue(null);
|
||||
const setHistory = jest.fn();
|
||||
const collect = jest.fn().mockResolvedValue(null);
|
||||
|
||||
beforeEach(async () => {
|
||||
@@ -70,7 +71,7 @@ describe("AddEditV2Component", () => {
|
||||
providers: [
|
||||
{ provide: PlatformUtilsService, useValue: mock<PlatformUtilsService>() },
|
||||
{ provide: ConfigService, useValue: mock<ConfigService>() },
|
||||
{ provide: PopupRouterCacheService, useValue: { back } },
|
||||
{ provide: PopupRouterCacheService, useValue: { back, setHistory } },
|
||||
{ provide: PopupCloseWarningService, useValue: { disable } },
|
||||
{ provide: Router, useValue: { navigate } },
|
||||
{ provide: ActivatedRoute, useValue: { queryParams: queryParams$ } },
|
||||
|
||||
@@ -265,6 +265,8 @@ export class AddEditV2Component implements OnInit {
|
||||
replaceUrl: true,
|
||||
queryParams: { cipherId: cipher.id },
|
||||
});
|
||||
// Clear popup history so after closing/reopening, Back won’t return to the add-edit form
|
||||
await this.popupRouterCacheService.setHistory([]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user