This commit is contained in:
parent
8e71537d57
commit
fcc18ddcc8
96 changed files with 8074 additions and 214 deletions
|
|
@ -24,13 +24,44 @@ describe("Stage 2 shell — boot", () => {
|
|||
document.body.innerHTML = "";
|
||||
});
|
||||
|
||||
it("boots into emergency when root / requested (offline-safe deep link)", () => {
|
||||
it("boots into home when root / requested (offline-safe deep link)", () => {
|
||||
history.replaceState(null, "", "/");
|
||||
const host = setupAppHost();
|
||||
const { router } = boot();
|
||||
expect(router.getPath()).toBe("/emergency");
|
||||
expect(host.querySelector("h1")?.textContent).toBe("Emergency");
|
||||
expect(document.title).toContain("Emergency");
|
||||
expect(router.getPath()).toBe("/");
|
||||
expect(router.getRouteId()).toBe("home");
|
||||
expect(host.querySelector("h1")?.textContent).toBe("Lumen");
|
||||
expect(document.title).toBe("Lumen");
|
||||
});
|
||||
|
||||
it("home renders the four destination tiles", () => {
|
||||
history.replaceState(null, "", "/");
|
||||
setupAppHost();
|
||||
boot();
|
||||
const tiles = [...document.querySelectorAll<HTMLAnchorElement>(".home-tile")];
|
||||
expect(tiles.map((a) => a.textContent)).toEqual([
|
||||
"Emergency",
|
||||
"Schedule",
|
||||
"Map",
|
||||
"Information",
|
||||
]);
|
||||
for (const t of tiles) {
|
||||
expect(t.getAttribute("data-route")).toBeTruthy();
|
||||
}
|
||||
});
|
||||
|
||||
it("brand acts as home/back button and is highlighted on destination pages", () => {
|
||||
history.replaceState(null, "", "/schedule");
|
||||
setupAppHost();
|
||||
boot();
|
||||
const brand = document.querySelector<HTMLAnchorElement>(".app-header__brand");
|
||||
expect(brand).toBeTruthy();
|
||||
expect(brand?.getAttribute("data-route")).toBe("/");
|
||||
expect(brand?.classList.contains("app-header__brand--back")).toBe(true);
|
||||
expect(brand?.hasAttribute("aria-current")).toBe(true);
|
||||
brand?.click();
|
||||
expect(location.pathname).toBe("/");
|
||||
expect(document.querySelector("h1")?.textContent).toBe("Lumen");
|
||||
});
|
||||
|
||||
it("removes aria-busy after boot", () => {
|
||||
|
|
@ -82,13 +113,21 @@ describe("Stage 2 shell — navigation / emergency affordance", () => {
|
|||
document.body.innerHTML = "";
|
||||
});
|
||||
|
||||
it("renders four primary destinations, emergency first and visually prioritized", () => {
|
||||
it("renders home plus four primary destinations, emergency visually prioritized", () => {
|
||||
setupAppHost();
|
||||
boot();
|
||||
const links = [...document.querySelectorAll<HTMLAnchorElement>(".bottom-nav__link")];
|
||||
expect(links.map((a) => a.textContent)).toEqual(["Emergency", "Schedule", "Map", "Festival"]);
|
||||
const first = links[0];
|
||||
expect(first?.classList.contains("bottom-nav__link--emergency")).toBe(true);
|
||||
const links = [...document.querySelectorAll<HTMLAnchorElement>(".side-nav__link")];
|
||||
expect(links.map((a) => a.textContent)).toEqual([
|
||||
"Home",
|
||||
"Emergency",
|
||||
"Schedule",
|
||||
"Map",
|
||||
"Information",
|
||||
]);
|
||||
const emergency = links[1];
|
||||
expect(emergency?.classList.contains("side-nav__link--emergency")).toBe(true);
|
||||
const home = links[0];
|
||||
expect(home?.getAttribute("data-route")).toBe("/");
|
||||
});
|
||||
|
||||
it("all four destinations have 48px touch-target capable links and data-route", () => {
|
||||
|
|
@ -133,15 +172,15 @@ describe("Stage 2 shell — navigation / emergency affordance", () => {
|
|||
const { router } = boot();
|
||||
expect(router.getRouteId()).toBe("not-found");
|
||||
expect(document.querySelector("h1")?.textContent).toBe("Page not found");
|
||||
expect(document.querySelector('.bottom-nav__link[aria-current="page"]')).toBeNull();
|
||||
expect(document.querySelector('.side-nav__link[aria-current="page"]')).toBeNull();
|
||||
});
|
||||
|
||||
it("normalizes paths: trailing slash, query, hash, and root", () => {
|
||||
expect(normalizePath("/schedule/")).toBe("/schedule");
|
||||
expect(normalizePath("/map?foo=1")).toBe("/map");
|
||||
expect(normalizePath("/festival#section")).toBe("/festival");
|
||||
expect(normalizePath("/")).toBe("/emergency");
|
||||
expect(routeForPath("/")).toBe("emergency");
|
||||
expect(normalizePath("/")).toBe("/");
|
||||
expect(routeForPath("/")).toBe("home");
|
||||
expect(routeForPath("/unknown")).toBe("not-found");
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue