Files
penguin-harness/packages/landing/test/nav-state.test.ts
T
Youhai abf0a2f248 fix(site): correct navigation state and anchor scrolling (#6)
- make the docs brand link return to the landing site
- keep landing navigation active state synchronized across routes and section links
- tighten sticky-header anchor scroll spacing
2026-07-20 20:39:10 +09:00

21 lines
814 B
TypeScript

import { describe, expect, it } from "vitest";
import { getActiveNavItem } from "../src/lib/nav-state";
describe("landing navigation active state", () => {
it("tracks known section hashes on the home page", () => {
expect(getActiveNavItem("/", "#features")).toBe("features");
expect(getActiveNavItem("/", "#quickstart")).toBe("quickstart");
});
it("tracks the Blog route and blog posts", () => {
expect(getActiveNavItem("/blog", "")).toBe("blog");
expect(getActiveNavItem("/blog/release-notes", "")).toBe("blog");
});
it("does not mark unknown hashes or unrelated routes active", () => {
expect(getActiveNavItem("/", "#unknown")).toBeNull();
expect(getActiveNavItem("/blog", "#features")).toBe("blog");
expect(getActiveNavItem("/other", "#features")).toBeNull();
});
});