diff --git a/frontend/src/lib/listNav.restoreMoved.dom.test.tsx b/frontend/src/lib/listNav.restoreMoved.dom.test.tsx
index b8ee90e7..9bf46723 100644
--- a/frontend/src/lib/listNav.restoreMoved.dom.test.tsx
+++ b/frontend/src/lib/listNav.restoreMoved.dom.test.tsx
@@ -13,6 +13,7 @@ import {
NAV_REVEAL_EVENT,
navItemAttrs,
navPosition,
+ pendingNavName,
restoreNavPosition,
useListNav,
} from "./listNav";
@@ -150,4 +151,56 @@ describe("Back to an item that moved to another list", () => {
document.querySelector("main")!.firstElementChild,
);
});
+
+ it("looks in another list at its last look when its own never renders the place it counts", async () => {
+ vi.useFakeTimers();
+ try {
+ const { unmount } = render();
+ button("subscribed").focus();
+ const pos = navPosition()!;
+ unmount();
+ // Its own list still counts two, and keeps showing one; the item is in the next list.
+ render();
+ const cancel = restoreNavPosition(pos);
+ await act(async () => vi.advanceTimersByTimeAsync(1000));
+ expect(focused()).toBeUndefined(); // still giving its own list the chance
+ await act(async () => vi.advanceTimersByTimeAsync(1100));
+ expect(focused()).toBe("subscribed");
+ cancel();
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+});
+
+describe("the name a Back is still looking for", () => {
+ const pos = { list: 0, lists: 1, index: 0, name: "subscribed" };
+
+ it("is there while it looks, and gone once cancelled", () => {
+ const cancel = restoreNavPosition(pos);
+ expect(pendingNavName()).toBe("subscribed");
+ cancel();
+ expect(pendingNavName()).toBeNull();
+ });
+
+ it("is gone once the focus went somewhere else", async () => {
+ render();
+ const cancel = restoreNavPosition(pos);
+ button("elsewhere").focus();
+ await wait(80);
+ expect(pendingNavName()).toBeNull();
+ cancel();
+ });
+
+ it("is gone once it gave up", async () => {
+ vi.useFakeTimers();
+ try {
+ const cancel = restoreNavPosition(pos);
+ await vi.advanceTimersByTimeAsync(2100);
+ expect(pendingNavName()).toBeNull();
+ cancel();
+ } finally {
+ vi.useRealTimers();
+ }
+ });
});