// @vitest-environment happy-dom import { describe, it, expect, vi } from "vitest"; import { applySoftReload, ensureMotionPathPluginLoaded } from "./gsapSoftReload"; const SCRIPT_TEXT = ` window.__timelines = window.__timelines || {}; const tl = gsap.timeline({ paused: true }); tl.to("#box", { opacity: 0.8 }); window.__timelines["root"] = tl; `; const MOTION_PATH_SCRIPT_TEXT = ` window.__timelines = window.__timelines || {}; const tl = gsap.timeline({ paused: true }); tl.to("#box", { motionPath: { path: [{ x: 0, y: 0 }, { x: 100, y: 50 }] } }); window.__timelines["root"] = tl; `; function buildMockIframe(overrides: Record = {}) { const scriptEl = document.createElement("script"); scriptEl.textContent = 'const tl = gsap.timeline({ paused: true }); tl.to("#box", { opacity: 0.5 });'; const container = document.createElement("div"); container.appendChild(scriptEl); const mockTimeline = { kill: vi.fn(), pause: vi.fn() }; const contentWindow = { gsap: { timeline: vi.fn() }, __hfForceTimelineRebind: vi.fn(), __timelines: { root: mockTimeline } as Record, __player: { getTime: () => 2.0, seek: vi.fn() }, __hfStudioManualEditsApply: vi.fn(), __hfSuppressSceneMutations: undefined as undefined | ((fn: () => T) => T), ...overrides, }; // Intercept appendChild: when a