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
This commit is contained in:
1 parent
0eaaa54e25
commit
abf0a2f248
9 files changed
+123
-62
No files matched your search
@@ -0,0 +1,20 @@
|
||||
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();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user