Skip to content

Commit 1fdce71

Browse files
authored
test(core): add T10 PreviewAdapter contract stubs (spec for R7) (heygen-com#1262)
* test(studio): add T5b rotation+motion build-patches characterization Extends manualEditsDomPatches.test.ts with rotation and motion pairs. Same 4-pattern structure: populated, empty, clear restores originals, build/clear symmetry. Merges duplicate manualEditsTypes import block. * test(studio): add T5c review-fix gaps in manualEditsDomPatches characterization Fixes four gaps identified in max-setting code review: - Box-size clear: replace arrayContaining with full ordered toEqual (30 ops) - Box-size / pathOffset / rotation clear: add empty-string coercion tests (origVal||null must produce null, not set property to "") - Rotation clear: add test for absent STUDIO_ORIGINAL_ROTATION_TRANSFORM_ORIGIN_ATTR - Motion clear: prove input-independence by calling with both empty and populated element and asserting identical output * refactor(core): extract maxEndTime+serialize to parsers/test-utils.ts (TU) Deduplicate helpers shared by T1 (htmlParser.roundtrip.test.ts) and T2 (stableIds.test.ts). Both files inline identical implementations; extract to test-utils.ts so future parser tests (T6a…) import one copy. Also fix lefthook fallow command to unset GIT_DIR+GIT_INDEX_FILE before running — those vars are set by git in worktree hook context and block fallow’s internal temp-worktree creation. * test(core): add T10 PreviewAdapter contract stubs (spec for R7) All 14 tests are it.todo, following the T4 pattern. The stubs define the full createPreviewAdapter interface — elementAtPoint (root exclusion, hf-id ancestor walk, opacity filter), applyDraft/revertDraft (draft marker lifecycle), commitPreview (patch derivation), and getElementTimings (data-start/data-end reader). createPreviewAdapter does not exist yet; R7 implements it and converts these stubs to real assertions.
1 parent ffc54c7 commit 1fdce71

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* T10 — PreviewAdapter contract (spec for R7).
3+
*
4+
* `createPreviewAdapter` does not exist yet. These stubs define the expected
5+
* interface so R7 has a concrete target. Convert from it.todo to real
6+
* assertions in the R7 PR.
7+
*
8+
* Hit-testing (elementAtPoint) in both linkedom and jsdom returns null for
9+
* all geometry calls — the real tests must inject a position-resolver stub
10+
* or mock elementFromPoint. The contract tested is filtering logic (root
11+
* exclusion, data-hf-id ancestor walk, opacity-at-playhead), not geometry.
12+
*/
13+
import { describe, it } from "vitest";
14+
15+
describe("T10 — PreviewAdapter contract (spec for R7)", () => {
16+
describe("elementAtPoint", () => {
17+
it.todo("returns null for the stage root (data-hf-root)");
18+
19+
it.todo("returns the nearest ancestor with data-hf-id");
20+
21+
it.todo("returns null when the hit element has no data-hf-id ancestor");
22+
23+
it.todo("skips elements whose computed opacity is 0 at the given playhead time");
24+
});
25+
26+
describe("applyDraft / revertDraft", () => {
27+
it.todo("applyDraft writes --hf-studio-* CSS props and sets the gesture marker");
28+
29+
it.todo("applyDraft accepts both move (dx/dy) and resize (w/h) payloads");
30+
31+
it.todo("revertDraft removes draft props and clears the gesture marker");
32+
33+
it.todo("revertDraft restores original translate when an original was recorded");
34+
});
35+
36+
describe("commitPreview", () => {
37+
it.todo("returns null when no gesture marker is present");
38+
39+
it.todo("derives a moveElement patch from draft markers on commit");
40+
41+
it.todo("derives a resize patch from draft markers on commit");
42+
43+
it.todo("clears the gesture marker after commit");
44+
});
45+
46+
describe("getElementTimings", () => {
47+
it.todo("reads authored absolute times from data-start / data-end");
48+
49+
it.todo("ignores elements without data-hf-id");
50+
});
51+
});

0 commit comments

Comments
 (0)