fix(nav): the dead-page rewrite does not restore a spent focus stamp
It spread the event's snapshot, which still carried the sfNav stamp lib/history's own listener had just taken off the entry, so a later landing there (an overlay closing) refocused a stale item. It now spreads the live entry (test red on the snapshot). Also: format.test's comment named a test image that never runs vitest; it is the gate host's locale.
This commit is contained in:
@@ -191,6 +191,19 @@ describe("NavigationProvider · Back", () => {
|
||||
expect(window.history.state).toMatchObject({ sfPage: "feed" });
|
||||
expect(window.location.search).toBe("?keep=1");
|
||||
});
|
||||
|
||||
// lib/history's own listener takes a spent focus stamp off the entry it lands on; the rewrite must
|
||||
// not put it back, or the next landing there (an overlay closing) would refocus a stale item.
|
||||
it("does not put back the focus stamp the landing spent", () => {
|
||||
render();
|
||||
const st = { sfPage: "messages", sfNav: { list: 0, lists: 1 } };
|
||||
act(() => {
|
||||
window.history.replaceState(st, "", "/?page=messages");
|
||||
window.dispatchEvent(new PopStateEvent("popstate", { state: st }));
|
||||
});
|
||||
expect(window.history.state).toMatchObject({ sfPage: "feed" });
|
||||
expect(window.history.state).not.toHaveProperty("sfNav");
|
||||
});
|
||||
});
|
||||
|
||||
describe("NavigationProvider · never under an open overlay", () => {
|
||||
|
||||
Reference in New Issue
Block a user