mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 22:03:36 +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 disable = jest.fn();
|
||||||
const navigate = jest.fn();
|
const navigate = jest.fn();
|
||||||
const back = jest.fn().mockResolvedValue(null);
|
const back = jest.fn().mockResolvedValue(null);
|
||||||
|
const setHistory = jest.fn();
|
||||||
const collect = jest.fn().mockResolvedValue(null);
|
const collect = jest.fn().mockResolvedValue(null);
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
@@ -70,7 +71,7 @@ describe("AddEditV2Component", () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: PlatformUtilsService, useValue: mock<PlatformUtilsService>() },
|
{ provide: PlatformUtilsService, useValue: mock<PlatformUtilsService>() },
|
||||||
{ provide: ConfigService, useValue: mock<ConfigService>() },
|
{ provide: ConfigService, useValue: mock<ConfigService>() },
|
||||||
{ provide: PopupRouterCacheService, useValue: { back } },
|
{ provide: PopupRouterCacheService, useValue: { back, setHistory } },
|
||||||
{ provide: PopupCloseWarningService, useValue: { disable } },
|
{ provide: PopupCloseWarningService, useValue: { disable } },
|
||||||
{ provide: Router, useValue: { navigate } },
|
{ provide: Router, useValue: { navigate } },
|
||||||
{ provide: ActivatedRoute, useValue: { queryParams: queryParams$ } },
|
{ provide: ActivatedRoute, useValue: { queryParams: queryParams$ } },
|
||||||
|
|||||||
@@ -265,6 +265,8 @@ export class AddEditV2Component implements OnInit {
|
|||||||
replaceUrl: true,
|
replaceUrl: true,
|
||||||
queryParams: { cipherId: cipher.id },
|
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