MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / fakeIframe

Function fakeIframe

packages/studio/src/hooks/gsapRuntimeKeyframes.test.ts:10–20  ·  view source on GitHub ↗
(el: { id: string }, children: unknown[], now?: number)

Source from the content-addressed store, hash-verified

8// Build a fake preview iframe whose runtime timeline holds the given child tweens
9// and resolves `selector` to `el`.
10function fakeIframe(el: { id: string }, children: unknown[], now?: number): HTMLIFrameElement {
11 const timeline = {
12 getChildren: () => children,
13 duration: () => 14.6,
14 ...(now != null ? { time: () => now } : {}),
15 };
16 return {
17 contentWindow: { __timelines: { "index.html": timeline } },
18 contentDocument: { querySelector: (sel: string) => (sel === `#${el.id}` ? el : null) },
19 } as unknown as HTMLIFrameElement;
20}
21
22describe("readRuntimeKeyframes — zero-duration set must not shadow the keyframed tween", () => {
23 const el = { id: "puck-b" };

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected