fix: Back from Settings no longer lands on a delete wallet screen left by the gear (closes #480)
Leaving the delete wallet or lost-password screen drops its wallet selection, but the settings gear had just pushed the screen onto the Back stack, so Back from Settings showed a screen whose button could only answer "No wallet selected for deletion." Each screen's leave handler now also takes it off the top of the stack, as the private key export and recovery phrase screens do since #461. Back from Settings then stays on Settings once, as it does for the recovery phrase screen. Jest tests drive the gear and then Back on both screens, and the delete screen's own Back. Model: opus-5-5
This commit is contained in:
@@ -615,3 +615,44 @@ describe("the password route's confirm button", () => {
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
// https://git.eeqj.de/sneak/AutistMask/issues/480: leaving either delete
|
||||
// screen drops its wallet selection, so Back onto one showed a screen whose
|
||||
// button could only answer "No wallet selected for deletion."
|
||||
describe("Back from Settings after leaving by the settings gear", () => {
|
||||
test("does not land on the delete screen", () => {
|
||||
const { helpers, deleteWallet, state } = load();
|
||||
deleteWallet.show(1);
|
||||
// The settings gear: push the current view, then show Settings.
|
||||
helpers.pushCurrentView();
|
||||
helpers.showView("settings");
|
||||
|
||||
expect(state.viewStack).toEqual(["main", "settings"]);
|
||||
helpers.goBack();
|
||||
expect(state.currentView).not.toBe("delete-wallet-confirm");
|
||||
});
|
||||
|
||||
test("does not land on the lost-password screen", async () => {
|
||||
const { helpers, deleteWallet, state } = load();
|
||||
await openLostPassword(deleteWallet, 1);
|
||||
// The settings gear: push the current view, then show Settings.
|
||||
helpers.pushCurrentView();
|
||||
helpers.showView("settings");
|
||||
|
||||
expect(state.viewStack).toEqual(["main", "settings"]);
|
||||
helpers.goBack();
|
||||
expect(state.currentView).not.toBe(VIEW);
|
||||
});
|
||||
|
||||
// The lost-password screen's own Back is "Back returns to the delete
|
||||
// screen with its wallet still chosen", above.
|
||||
test("the delete screen's own Back leaves the rest of the stack alone", async () => {
|
||||
const { deleteWallet, state } = load();
|
||||
deleteWallet.show(1);
|
||||
|
||||
await click("btn-delete-wallet-back");
|
||||
|
||||
expect(state.currentView).toBe("settings");
|
||||
expect(state.viewStack).toEqual(["main"]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user