fix: Back from Settings never lands on Settings itself (closes #481)
The recovery phrase and delete wallet screens take themselves off the Back stack when left, so Settings, one of those screens, then the settings gear leaves Settings under the Settings now showing. A reopened popup restores the same stack, cut at the screen the gear left. Back then showed Settings again and seemed to do nothing. goBack() now skips any entry for the screen already showing before it pops its target. Jest tests drive the gear and then Back for the recovery phrase screen, once and twice over, for both delete screens, and after a reopen. Model: opus-5-5
This commit was merged in pull request #486.
This commit is contained in:
@@ -131,8 +131,10 @@ describe("Back from Settings after leaving by the settings gear", () => {
|
||||
|
||||
// https://git.eeqj.de/sneak/AutistMask/issues/461: leaving drops the
|
||||
// wallet selection, so Back onto this screen showed a password prompt
|
||||
// that could only answer "No wallet is selected."
|
||||
test("does not land on the recovery phrase screen", () => {
|
||||
// that could only answer "No wallet is selected." Taking the screen off
|
||||
// the stack leaves Settings under Settings, and Back must not land there
|
||||
// either (https://git.eeqj.de/sneak/AutistMask/issues/481).
|
||||
test("goes to the screen under Settings", () => {
|
||||
const { helpers, state, showPhrase } = load();
|
||||
|
||||
// Opened from the wallet list in Settings, then left by the gear:
|
||||
@@ -143,7 +145,21 @@ describe("Back from Settings after leaving by the settings gear", () => {
|
||||
|
||||
expect(state.viewStack).toEqual(["main", "settings"]);
|
||||
helpers.goBack();
|
||||
expect(state.currentView).not.toBe(SHOW_PHRASE_VIEW);
|
||||
expect(state.currentView).toBe("main");
|
||||
});
|
||||
|
||||
// Each round trip leaves one more Settings under Settings.
|
||||
test("goes to the screen under Settings after two round trips", () => {
|
||||
const { helpers, state, showPhrase } = load();
|
||||
for (let i = 0; i < 2; i++) {
|
||||
showPhrase.show(0);
|
||||
helpers.pushCurrentView();
|
||||
helpers.showView("settings");
|
||||
}
|
||||
|
||||
expect(state.viewStack).toEqual(["main", "settings", "settings"]);
|
||||
helpers.goBack();
|
||||
expect(state.currentView).toBe("main");
|
||||
});
|
||||
|
||||
// This Back takes Settings off the stack before the screen is left, so
|
||||
|
||||
Reference in New Issue
Block a user