Opening a page by URL showed "Page not found" in the tab while the router was still at its start location, which carries no label, so the not-found copy stood in for the page for as long as the resolution took. The title is now written only once the router has resolved the address, and the rule lives in ui/src/lib/page-title.ts so the start location's silence is tested.
22 lines
840 B
TypeScript
22 lines
840 B
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import { pageTitle } from "../src/lib/page-title.ts";
|
|
|
|
const MISSING = "Page not found";
|
|
|
|
// Guards #2115: opening a dashboard page by URL showed "Page not found" in the
|
|
// tab until the router resolved the address, because the start location has no
|
|
// label and the not-found copy stood in for it.
|
|
test("an unresolved route writes no title", () => {
|
|
assert.equal(pageTitle(false, "", "", "archie", MISSING), "");
|
|
});
|
|
|
|
test("a resolved route names its page", () => {
|
|
assert.equal(pageTitle(true, "Models", "Instance", "carina", MISSING), "Models | Instance | Archie | carina");
|
|
});
|
|
|
|
test("a resolved route with no page is the one that reads as not found", () => {
|
|
assert.equal(pageTitle(true, "", "", "carina", MISSING), "Page not found | Archie | carina");
|
|
});
|