feat: expose stable journey intent signals
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
activationLineDocumentY,
|
||||
deriveSectionActivationSnapshot,
|
||||
deriveSectionState,
|
||||
isAtDocumentEnd,
|
||||
selectActiveSection,
|
||||
@@ -109,6 +110,41 @@ describe("active section selection", () => {
|
||||
).toBe("profile");
|
||||
});
|
||||
|
||||
it("derives responsive heading offsets from the same activation-line geometry", () => {
|
||||
expect(deriveSectionActivationSnapshot({
|
||||
headings: [
|
||||
{ id: "start", top: 100 },
|
||||
{ id: "profile", top: 420 },
|
||||
{ id: "experience", top: 1_120 },
|
||||
],
|
||||
activeSectionId: "profile",
|
||||
activationY: 500,
|
||||
viewportHeight: 800,
|
||||
layoutRevision: 7,
|
||||
})).toEqual({
|
||||
layoutRevision: 7,
|
||||
activeHeadingOffsetVh: -0.1,
|
||||
nextHeadingOffsetVh: 0.775,
|
||||
});
|
||||
});
|
||||
|
||||
it("returns no following-heading offset for the final active heading", () => {
|
||||
expect(deriveSectionActivationSnapshot({
|
||||
headings: [
|
||||
{ id: "start", top: 100 },
|
||||
{ id: "profile", top: 420 },
|
||||
],
|
||||
activeSectionId: "profile",
|
||||
activationY: 500,
|
||||
viewportHeight: 800,
|
||||
layoutRevision: 8,
|
||||
})).toEqual({
|
||||
layoutRevision: 8,
|
||||
activeHeadingOffsetVh: -0.1,
|
||||
nextHeadingOffsetVh: null,
|
||||
});
|
||||
});
|
||||
|
||||
it("maps every canonical section to its chapter and arrival state", () => {
|
||||
expect([
|
||||
deriveSectionState("start"),
|
||||
|
||||
Reference in New Issue
Block a user