@hyperframes/studio 0.9.64 → 0.9.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/hyperframes-player-VGx6ow_e.js +573 -0
- package/dist/assets/{index-CVmmHGol.js → index-B8Xt_Oyw.js} +190 -186
- package/dist/assets/{index-DN167Uqf.js → index-BH18TdX9.js} +1 -1
- package/dist/assets/{pausedVideoDecoder-C8rhpGPx.js → pausedVideoDecoder-Bx3fGNkU.js} +1 -1
- package/dist/{chunk-VDDEXNVX.js → chunk-ESTBKVCB.js} +8 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.html +1 -1
- package/dist/index.js +1580 -882
- package/dist/player.js +1 -1
- package/package.json +8 -8
- package/src/captions/components/CaptionOverlay.sealed.test.ts +2 -25
- package/src/captions/hooks/useCaptionSync.ts +4 -1
- package/src/components/editor/LayersPanel.opaque.test.ts +4 -29
- package/src/components/editor/MotionPathOverlay.sealed.test.tsx +85 -0
- package/src/components/editor/MotionPathOverlay.tsx +26 -12
- package/src/components/editor/domEditOverlayCrop.ts +78 -15
- package/src/components/editor/domEditOverlayCropFrameLift.test.ts +64 -0
- package/src/components/editor/domEditOverlayStartGesture.ts +0 -14
- package/src/components/editor/gestureUndoRevert.ts +3 -6
- package/src/components/editor/gsapMoveSealedPreview.test.ts +247 -0
- package/src/components/editor/manualEditsSnapshot.ts +2 -0
- package/src/components/editor/manualOffsetDrag.ts +13 -18
- package/src/components/editor/plainTranslate.test.ts +22 -1
- package/src/components/editor/plainTranslate.ts +8 -6
- package/src/components/editor/previewDrafts.test.ts +13 -39
- package/src/components/editor/previewDrafts.ts +4 -0
- package/src/components/editor/previewGestureStartRead.test.ts +59 -32
- package/src/components/editor/previewGestureStartRead.ts +9 -0
- package/src/components/editor/previewLayers.test.ts +3 -20
- package/src/components/editor/previewOverlayRects.test.ts +3 -20
- package/src/components/editor/previewPointerTargets.test.ts +3 -20
- package/src/components/editor/previewSelection.test.ts +51 -35
- package/src/components/editor/previewSelection.ts +18 -0
- package/src/components/editor/useColorGradingController.sealed.test.ts +5 -30
- package/src/components/editor/useMotionPathData.reply.test.ts +40 -0
- package/src/components/editor/useMotionPathData.sealed.test.ts +57 -0
- package/src/components/editor/useMotionPathData.test.tsx +1 -1
- package/src/components/editor/useMotionPathData.ts +83 -33
- package/src/components/nle/CompositionBreadcrumb.tsx +2 -5
- package/src/components/nle/NLEContext.drillDown.test.ts +85 -0
- package/src/components/nle/NLEContext.tsx +21 -23
- package/src/components/nle/NLEPreview.test.ts +18 -3
- package/src/components/nle/NLEPreview.tsx +10 -1
- package/src/components/nle/audioSealedPreview.test.ts +5 -32
- package/src/components/panels/motionBlurPanelModel.sealed.test.ts +30 -0
- package/src/components/panels/motionBlurPanelModel.ts +37 -7
- package/src/hooks/appHotkeysDispatch.ts +38 -1
- package/src/hooks/domEditCommits.sealed.test.ts +191 -0
- package/src/hooks/domStyleCommit.ts +18 -7
- package/src/hooks/draggedGsapPosition.ts +20 -0
- package/src/hooks/gsapEditOutcome.ts +3 -0
- package/src/hooks/gsapFrameSnapshot.test.ts +113 -0
- package/src/hooks/gsapFrameSnapshot.ts +246 -0
- package/src/hooks/gsapParsedTween.ts +16 -9
- package/src/hooks/gsapResizeIntercept.ts +7 -2
- package/src/hooks/gsapRuntimeBridge.ts +4 -0
- package/src/hooks/gsapRuntimeKeyframes.ts +23 -15
- package/src/hooks/gsapShared.ts +4 -0
- package/src/hooks/gsapSnapshotReply.ts +105 -0
- package/src/hooks/useAppHotkeys.previewForwarding.test.tsx +134 -0
- package/src/hooks/useAppHotkeys.ts +36 -1
- package/src/hooks/useDomEditAttributeCommits.ts +43 -19
- package/src/hooks/useDomEditCommits.test.tsx +1 -1
- package/src/hooks/useDomEditPreviewSync.test.ts +36 -1
- package/src/hooks/useDomEditPreviewSync.ts +3 -3
- package/src/hooks/useEditorSave.ts +2 -1
- package/src/hooks/useEnableKeyframes.sealed.test.ts +70 -0
- package/src/hooks/useEnableKeyframes.ts +9 -2
- package/src/hooks/useGsapTweenCache.ts +9 -3
- package/src/hooks/usePreviewPersistence.ts +18 -11
- package/src/hooks/useSdkSession.lifecycle.test.tsx +1 -0
- package/src/hooks/useSdkSession.ts +2 -0
- package/src/hooks/useSlideshowTabState.test.ts +47 -3
- package/src/hooks/useSlideshowTabState.ts +32 -16
- package/src/player/hooks/timelinePlayerTestHarness.ts +2 -1
- package/src/player/hooks/usePlaybackKeyboard.ts +1 -1
- package/src/player/hooks/useTimelineSyncCallbacks.sealed.test.ts +2 -29
- package/src/player/lib/previewChannel.test.ts +10 -0
- package/src/player/lib/previewChannel.ts +9 -0
- package/src/player/lib/previewElements.test.ts +34 -1
- package/src/player/lib/previewElements.ts +101 -18
- package/src/player/lib/sealedPreviewFrame.test-helpers.ts +38 -0
- package/src/player/lib/timelineIframeHelpers.ts +1 -1
- package/src/telemetry/client.ts +4 -2
- package/src/telemetry/eventShape.test.ts +189 -0
- package/src/telemetry/eventShape.ts +192 -0
- package/src/utils/blockInstaller.test.ts +82 -48
- package/src/utils/blockInstaller.ts +6 -14
- package/src/utils/domEditSaveQueue.test.ts +12 -2
- package/src/utils/domEditSaveQueue.ts +4 -4
- package/src/utils/previewCompositionSize.test.ts +61 -0
- package/src/utils/previewCompositionSize.ts +21 -1
- package/src/utils/sdkEditTransaction.ts +6 -2
- package/src/utils/sdkResolverShadow.ts +16 -15
- package/src/utils/studioSaveDiagnostics.test.ts +21 -3
- package/src/utils/studioSaveDiagnostics.ts +71 -6
- package/src/utils/studioTelemetry.ts +6 -1
- package/dist/assets/hyperframes-player-mSF_GvRs.js +0 -573
- package/src/components/editor/motionPathHome.ts +0 -75
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @vitest-environment happy-dom
|
|
2
2
|
|
|
3
3
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
4
|
-
|
|
5
|
-
import { installMarkedEditingAgent } from "../../../../core/src/runtime/editingAgent.test-helpers";
|
|
4
|
+
import type { GsapAnimation } from "@hyperframes/core/gsap-parser";
|
|
6
5
|
import { makeSelection } from "../../hooks/domSelectionTestHarness";
|
|
7
6
|
import { computeDraggedGsapPosition } from "../../hooks/draggedGsapPosition";
|
|
7
|
+
import { tryGsapResizeIntercept } from "../../hooks/gsapResizeIntercept";
|
|
8
8
|
import { watchPreviewFrame } from "../../player/lib/bridgePlayback";
|
|
9
9
|
import { describePreviewElements, queryPreviewElements } from "../../player/lib/previewElements";
|
|
10
10
|
import { detachedFakeIframe } from "../../player/hooks/timelinePlayerTestHarness";
|
|
@@ -15,10 +15,14 @@ import {
|
|
|
15
15
|
createManualOffsetDragMember,
|
|
16
16
|
restoreManualOffsetDragMembers,
|
|
17
17
|
} from "./manualOffsetDrag";
|
|
18
|
-
import {
|
|
19
|
-
|
|
18
|
+
import {
|
|
19
|
+
gestureStartLayout,
|
|
20
|
+
measurePreviewGestureStart,
|
|
21
|
+
type PreviewGestureStart,
|
|
22
|
+
} from "./previewGestureStartRead";
|
|
20
23
|
import { standInFor } from "./previewSelection";
|
|
21
24
|
import { collectSnapContext } from "./snapTargetCollection";
|
|
25
|
+
import { sealedPreviewFrame } from "../../player/lib/sealedPreviewFrame.test-helpers";
|
|
22
26
|
|
|
23
27
|
const FIXTURE = `
|
|
24
28
|
<div data-composition-id="main" data-width="1920" data-height="1080">
|
|
@@ -86,24 +90,8 @@ function liveFrame() {
|
|
|
86
90
|
|
|
87
91
|
/** A frame Studio cannot read, whose runtime is the real editing agent over this document. */
|
|
88
92
|
function opaqueFrame() {
|
|
89
|
-
const
|
|
90
|
-
const iframe = sized(
|
|
91
|
-
Object.defineProperty(iframe, "contentDocument", { value: null });
|
|
92
|
-
Object.defineProperty(frame, "document", {
|
|
93
|
-
get: () => {
|
|
94
|
-
throw new DOMException("blocked", "SecurityError");
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
const parent = {
|
|
98
|
-
postMessage: (data: unknown, _origin: string, ports: MessagePort[]) =>
|
|
99
|
-
window.dispatchEvent(
|
|
100
|
-
new MessageEvent("message", { source: frame as unknown as Window, data, ports }),
|
|
101
|
-
),
|
|
102
|
-
} as unknown as Window;
|
|
103
|
-
const agent = installMarkedEditingAgent(parent);
|
|
104
|
-
frame.postMessage = (data: unknown) =>
|
|
105
|
-
window.dispatchEvent(new MessageEvent("message", { source: parent, data }));
|
|
106
|
-
closers.push(() => agent.dispose());
|
|
93
|
+
const { iframe: sealed, frame } = sealedPreviewFrame();
|
|
94
|
+
const iframe = sized(sealed, [100, 50, 960, 540]) as HTMLIFrameElement;
|
|
107
95
|
watchPreviewFrame(iframe);
|
|
108
96
|
window.dispatchEvent(
|
|
109
97
|
new MessageEvent("message", {
|
|
@@ -242,16 +230,6 @@ describe("starting a gesture from what an opaque frame read", () => {
|
|
|
242
230
|
restoreManualOffsetDragMembers(g.pathOffsetMember ? [g.pathOffsetMember] : []);
|
|
243
231
|
});
|
|
244
232
|
|
|
245
|
-
it("refuses a drag of a layer a tween moves, which this preview cannot save yet", () => {
|
|
246
|
-
const element = document.createElement("div");
|
|
247
|
-
const selection = makeSelection("card", element);
|
|
248
|
-
const opts = gestureOpts(selection);
|
|
249
|
-
const moving = { ...START, gsap: { x: 0, y: 0, moving: true } };
|
|
250
|
-
expect(startGesture("drag", press(), opts, { start: moving })).toBe(false);
|
|
251
|
-
expect(opts.onBlockedMoveRef.current).toHaveBeenCalledWith(selection, MOVING_LAYER_UNREADABLE);
|
|
252
|
-
expect(opts.gestureRef.current).toBeNull();
|
|
253
|
-
});
|
|
254
|
-
|
|
255
233
|
it("drags a group from each member's GSAP position, snapping with the targets it read", () => {
|
|
256
234
|
const items = ["a", "b"].map((key, i) => {
|
|
257
235
|
const element = document.createElement("div");
|
|
@@ -277,3 +255,52 @@ describe("starting a gesture from what an opaque frame read", () => {
|
|
|
277
255
|
restoreManualOffsetDragMembers(g.members);
|
|
278
256
|
});
|
|
279
257
|
});
|
|
258
|
+
|
|
259
|
+
describe("a resize in a preview Studio cannot script", () => {
|
|
260
|
+
it.each([-5, 1e-9, 1e9])("keeps no start box for a frame-reported width of %s", async (width) => {
|
|
261
|
+
const iframe = opaqueFrame();
|
|
262
|
+
Object.defineProperty(document.querySelector("#last"), "offsetWidth", {
|
|
263
|
+
value: width,
|
|
264
|
+
configurable: true,
|
|
265
|
+
});
|
|
266
|
+
const handle = (await queryPreviewElements(iframe, "#last"))!.matches[0]!.handle;
|
|
267
|
+
await measurePreviewGestureStart(iframe, overlayEl(), [handle]);
|
|
268
|
+
expect(gestureStartLayout(handle)).toBeNull();
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
it("scales from the box its gesture started from, not a 200 px fallback", async () => {
|
|
272
|
+
const iframe = opaqueFrame();
|
|
273
|
+
const handle = (await queryPreviewElements(iframe, "#last"))!.matches[0]!.handle;
|
|
274
|
+
const standIn = standInFor(iframe, (await describePreviewElements(iframe, [handle]))![0]!);
|
|
275
|
+
await measurePreviewGestureStart(iframe, overlayEl(), [handle]);
|
|
276
|
+
const scaleKeys = {
|
|
277
|
+
id: "#last-scale",
|
|
278
|
+
targetSelector: "#last",
|
|
279
|
+
propertyGroup: "scale",
|
|
280
|
+
method: "to",
|
|
281
|
+
properties: { scale: 1 },
|
|
282
|
+
position: 0,
|
|
283
|
+
resolvedStart: 0,
|
|
284
|
+
duration: 1,
|
|
285
|
+
keyframes: {
|
|
286
|
+
keyframes: [
|
|
287
|
+
{ percentage: 0, properties: { scale: 1 } },
|
|
288
|
+
{ percentage: 100, properties: { scale: 1 } },
|
|
289
|
+
],
|
|
290
|
+
},
|
|
291
|
+
} as unknown as GsapAnimation;
|
|
292
|
+
const commitMutation = vi.fn();
|
|
293
|
+
|
|
294
|
+
await tryGsapResizeIntercept(
|
|
295
|
+
{ ...makeSelection("last", standIn), handle },
|
|
296
|
+
{ width: 240, height: 120 },
|
|
297
|
+
[scaleKeys],
|
|
298
|
+
iframe,
|
|
299
|
+
commitMutation,
|
|
300
|
+
);
|
|
301
|
+
|
|
302
|
+
const scales = JSON.stringify(commitMutation.mock.calls.map((call) => call[1]));
|
|
303
|
+
// It measured 120 x 60 at the press, so 240 x 120 is a scale of 2; the 200 px fallback gave 1.2.
|
|
304
|
+
expect(scales).toMatch(/"scale":2\b/);
|
|
305
|
+
});
|
|
306
|
+
});
|
|
@@ -20,6 +20,10 @@ export interface PreviewGestureStarts {
|
|
|
20
20
|
snap: SnapContext;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
const startLayouts = new Map<string, PreviewGestureStart["layout"]>();
|
|
24
|
+
|
|
25
|
+
export const gestureStartLayout = (handle: string) => startLayouts.get(handle) ?? null;
|
|
26
|
+
|
|
23
27
|
/** Everything a gesture on `handles` reads from the frame, in one request; null when it cannot answer. */
|
|
24
28
|
export async function measurePreviewGestureStart(
|
|
25
29
|
iframe: HTMLIFrameElement,
|
|
@@ -27,6 +31,11 @@ export async function measurePreviewGestureStart(
|
|
|
27
31
|
handles: string[],
|
|
28
32
|
): Promise<PreviewGestureStarts | null> {
|
|
29
33
|
const reply = await previewGestureStart(iframe, handles);
|
|
34
|
+
startLayouts.clear();
|
|
35
|
+
reply?.elements.forEach((start, i) => {
|
|
36
|
+
const { width = 0, height = 0 } = start?.layout ?? {};
|
|
37
|
+
if (width >= 1 && height >= 1) startLayouts.set(handles[i]!, { width, height });
|
|
38
|
+
});
|
|
30
39
|
const scale = reply && computeOverlayRootScale(overlayEl, iframe, null);
|
|
31
40
|
if (!reply || !scale) return null;
|
|
32
41
|
const { iframeRect, overlayRect, rootScaleX: sx, rootScaleY: sy } = scale;
|
|
@@ -4,8 +4,6 @@ import { act, createElement, useRef } from "react";
|
|
|
4
4
|
import { MAX_QUERY_MATCHES } from "@hyperframes/core/runtime/editing-port";
|
|
5
5
|
import { createRoot } from "react-dom/client";
|
|
6
6
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
7
|
-
// The frame's real runtime agent, serving the opaque frame from this document.
|
|
8
|
-
import { installMarkedEditingAgent } from "../../../../core/src/runtime/editingAgent.test-helpers";
|
|
9
7
|
import { installReactActEnvironment } from "../../hooks/domSelectionTestHarness";
|
|
10
8
|
import { watchPreviewFrame } from "../../player/lib/bridgePlayback";
|
|
11
9
|
import { getElementZIndex } from "../../player/lib/layerOrdering";
|
|
@@ -21,6 +19,7 @@ import { useMarqueeGestures } from "./marqueeCommit";
|
|
|
21
19
|
import { collectPreviewLayerItems, layerDataAttribute } from "./previewLayers";
|
|
22
20
|
import { findPreviewElementForSelection, resolvePreviewSelection } from "./previewSelection";
|
|
23
21
|
import { isLayerDraggable } from "./useLayerDrag";
|
|
22
|
+
import { sealedPreviewFrame } from "../../player/lib/sealedPreviewFrame.test-helpers";
|
|
24
23
|
|
|
25
24
|
installReactActEnvironment();
|
|
26
25
|
HTMLElement.prototype.setPointerCapture ??= () => {};
|
|
@@ -83,24 +82,8 @@ function liveFrame() {
|
|
|
83
82
|
|
|
84
83
|
/** A frame Studio cannot read, whose runtime is the real editing agent over this document. */
|
|
85
84
|
function opaqueFrame() {
|
|
86
|
-
const
|
|
87
|
-
const iframe = sized(
|
|
88
|
-
Object.defineProperty(iframe, "contentDocument", { value: null });
|
|
89
|
-
Object.defineProperty(frame, "document", {
|
|
90
|
-
get: () => {
|
|
91
|
-
throw new DOMException("blocked", "SecurityError");
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
const parent = {
|
|
95
|
-
postMessage: (data: unknown, _origin: string, ports: MessagePort[]) =>
|
|
96
|
-
window.dispatchEvent(
|
|
97
|
-
new MessageEvent("message", { source: frame as unknown as Window, data, ports }),
|
|
98
|
-
),
|
|
99
|
-
} as unknown as Window;
|
|
100
|
-
const agent = installMarkedEditingAgent(parent);
|
|
101
|
-
frame.postMessage = (data: unknown) =>
|
|
102
|
-
window.dispatchEvent(new MessageEvent("message", { source: parent, data }));
|
|
103
|
-
closers.push(() => agent.dispose());
|
|
85
|
+
const { iframe: sealed, frame } = sealedPreviewFrame();
|
|
86
|
+
const iframe = sized(sealed, FRAME) as HTMLIFrameElement;
|
|
104
87
|
watchPreviewFrame(iframe);
|
|
105
88
|
window.dispatchEvent(
|
|
106
89
|
new MessageEvent("message", {
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
import React, { act } from "react";
|
|
4
4
|
import { createRoot } from "react-dom/client";
|
|
5
5
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
6
|
-
// The frame's real runtime agent, serving the opaque frame from this document.
|
|
7
|
-
import { installMarkedEditingAgent } from "../../../../core/src/runtime/editingAgent.test-helpers";
|
|
8
6
|
import { makeSelection, installReactActEnvironment } from "../../hooks/domSelectionTestHarness";
|
|
9
7
|
import { watchPreviewFrame } from "../../player/lib/bridgePlayback";
|
|
10
8
|
import { queryPreviewElements } from "../../player/lib/previewElements";
|
|
@@ -14,6 +12,7 @@ import { orientedGroupAwareOverlayRect, type OverlayRect } from "./domEditOverla
|
|
|
14
12
|
import type { UseDomEditOverlayGesturesOptions } from "./domEditOverlayGestures";
|
|
15
13
|
import { createPreviewGestureStarts } from "./previewGestureStarts";
|
|
16
14
|
import { useDomEditOverlayRects } from "./useDomEditOverlayRects";
|
|
15
|
+
import { sealedPreviewFrame } from "../../player/lib/sealedPreviewFrame.test-helpers";
|
|
17
16
|
|
|
18
17
|
const frames = vi.hoisted(() => new Set<() => void>());
|
|
19
18
|
vi.mock("./overlayFrameLoop", () => ({
|
|
@@ -117,24 +116,8 @@ function liveFrame() {
|
|
|
117
116
|
|
|
118
117
|
/** A frame Studio cannot read, whose runtime is the real editing agent over this document. */
|
|
119
118
|
function opaqueFrame() {
|
|
120
|
-
const
|
|
121
|
-
const iframe = sized(
|
|
122
|
-
Object.defineProperty(iframe, "contentDocument", { value: null });
|
|
123
|
-
Object.defineProperty(frame, "document", {
|
|
124
|
-
get: () => {
|
|
125
|
-
throw new DOMException("blocked", "SecurityError");
|
|
126
|
-
},
|
|
127
|
-
});
|
|
128
|
-
const parent = {
|
|
129
|
-
postMessage: (data: unknown, _origin: string, ports: MessagePort[]) =>
|
|
130
|
-
window.dispatchEvent(
|
|
131
|
-
new MessageEvent("message", { source: frame as unknown as Window, data, ports }),
|
|
132
|
-
),
|
|
133
|
-
} as unknown as Window;
|
|
134
|
-
const agent = installMarkedEditingAgent(parent);
|
|
135
|
-
frame.postMessage = (data: unknown) =>
|
|
136
|
-
window.dispatchEvent(new MessageEvent("message", { source: parent, data }));
|
|
137
|
-
closers.push(() => agent.dispose());
|
|
119
|
+
const { iframe: sealed, frame } = sealedPreviewFrame();
|
|
120
|
+
const iframe = sized(sealed, [100, 50, 960, 540]) as HTMLIFrameElement;
|
|
138
121
|
// The size the runtime posts for its composition, as Studio mirrors it.
|
|
139
122
|
watchPreviewFrame(iframe);
|
|
140
123
|
window.dispatchEvent(
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
import React, { act } from "react";
|
|
4
4
|
import { createRoot } from "react-dom/client";
|
|
5
5
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
6
|
-
// The frame's real runtime agent, serving the opaque frame from this document.
|
|
7
|
-
import { installMarkedEditingAgent } from "../../../../core/src/runtime/editingAgent.test-helpers";
|
|
8
6
|
import {
|
|
9
7
|
getAllPreviewTargetsFromPointer,
|
|
10
8
|
getPreviewTargetFromPointer,
|
|
@@ -23,6 +21,7 @@ import { useDomSelection } from "../../hooks/useDomSelection";
|
|
|
23
21
|
import { usePreviewInteraction } from "../../hooks/usePreviewInteraction";
|
|
24
22
|
import { useCanvasContextMenuState } from "./useCanvasContextMenuState";
|
|
25
23
|
import type { TimelineElement } from "../../player";
|
|
24
|
+
import { sealedPreviewFrame } from "../../player/lib/sealedPreviewFrame.test-helpers";
|
|
26
25
|
|
|
27
26
|
installReactActEnvironment();
|
|
28
27
|
|
|
@@ -92,24 +91,8 @@ function liveFrame(): HTMLIFrameElement {
|
|
|
92
91
|
|
|
93
92
|
/** A frame Studio cannot read, whose runtime is the real editing agent over this document. */
|
|
94
93
|
function opaqueFrame(): HTMLIFrameElement {
|
|
95
|
-
const
|
|
96
|
-
const iframe = sized(
|
|
97
|
-
Object.defineProperty(iframe, "contentDocument", { value: null });
|
|
98
|
-
Object.defineProperty(frame, "document", {
|
|
99
|
-
get: () => {
|
|
100
|
-
throw new DOMException("blocked", "SecurityError");
|
|
101
|
-
},
|
|
102
|
-
});
|
|
103
|
-
const parent = {
|
|
104
|
-
postMessage: (data: unknown, _origin: string, ports: MessagePort[]) =>
|
|
105
|
-
window.dispatchEvent(
|
|
106
|
-
new MessageEvent("message", { source: frame as unknown as Window, data, ports }),
|
|
107
|
-
),
|
|
108
|
-
} as unknown as Window;
|
|
109
|
-
const agent = installMarkedEditingAgent(parent);
|
|
110
|
-
frame.postMessage = (data: unknown) =>
|
|
111
|
-
window.dispatchEvent(new MessageEvent("message", { source: parent, data }));
|
|
112
|
-
closers.push(() => agent.dispose());
|
|
94
|
+
const { iframe: sealed } = sealedPreviewFrame();
|
|
95
|
+
const iframe = sized(sealed, FRAME) as HTMLIFrameElement;
|
|
113
96
|
return iframe;
|
|
114
97
|
}
|
|
115
98
|
|
|
@@ -4,8 +4,6 @@ import React, { act } from "react";
|
|
|
4
4
|
import { createRoot } from "react-dom/client";
|
|
5
5
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
6
6
|
import { EDITING_ELEMENT_HANDLE, MAX_ELEMENT_TEXT } from "@hyperframes/core/runtime/editing-port";
|
|
7
|
-
// The frame's real runtime agent, serving the opaque frame from this document.
|
|
8
|
-
import { installMarkedEditingAgent } from "../../../../core/src/runtime/editingAgent.test-helpers";
|
|
9
7
|
import {
|
|
10
8
|
findElementForSelection,
|
|
11
9
|
findElementForTimelineElement,
|
|
@@ -13,6 +11,7 @@ import {
|
|
|
13
11
|
type DomEditSelection,
|
|
14
12
|
} from "./domEditing";
|
|
15
13
|
import { setCompositionSourceMap } from "./domEditingDom";
|
|
14
|
+
import { dropElementCropLift, liftElementCrop, readElementCropInsets } from "./domEditOverlayCrop";
|
|
16
15
|
import { domEditSelectionToFacts } from "./domEditingLayers";
|
|
17
16
|
import {
|
|
18
17
|
findPreviewElementForSelection,
|
|
@@ -29,6 +28,7 @@ import { detachedFakeIframe } from "../../player/hooks/timelinePlayerTestHarness
|
|
|
29
28
|
import { installReactActEnvironment } from "../../hooks/domSelectionTestHarness";
|
|
30
29
|
import { useDomSelection } from "../../hooks/useDomSelection";
|
|
31
30
|
import type { TimelineElement } from "../../player";
|
|
31
|
+
import { sealedPreviewFrame } from "../../player/lib/sealedPreviewFrame.test-helpers";
|
|
32
32
|
|
|
33
33
|
installReactActEnvironment();
|
|
34
34
|
|
|
@@ -52,29 +52,6 @@ function liveFrame(): HTMLIFrameElement {
|
|
|
52
52
|
return iframe;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
/** A frame Studio cannot read, whose runtime is the real editing agent over this document. */
|
|
56
|
-
function opaqueFrame(): HTMLIFrameElement {
|
|
57
|
-
const frame: Record<string, unknown> = {};
|
|
58
|
-
const iframe = detachedFakeIframe(frame);
|
|
59
|
-
Object.defineProperty(iframe, "contentDocument", { value: null });
|
|
60
|
-
Object.defineProperty(frame, "document", {
|
|
61
|
-
get: () => {
|
|
62
|
-
throw new DOMException("blocked", "SecurityError");
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
const parent = {
|
|
66
|
-
postMessage: (data: unknown, _origin: string, ports: MessagePort[]) =>
|
|
67
|
-
window.dispatchEvent(
|
|
68
|
-
new MessageEvent("message", { source: frame as unknown as Window, data, ports }),
|
|
69
|
-
),
|
|
70
|
-
} as unknown as Window;
|
|
71
|
-
const agent = installMarkedEditingAgent(parent);
|
|
72
|
-
frame.postMessage = (data: unknown) =>
|
|
73
|
-
window.dispatchEvent(new MessageEvent("message", { source: parent, data }));
|
|
74
|
-
closers.push(() => agent.dispose());
|
|
75
|
-
return iframe;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
55
|
const CONTEXT: PreviewSelectionOptions = {
|
|
79
56
|
activeCompositionPath: "index.html",
|
|
80
57
|
isMasterView: false,
|
|
@@ -101,7 +78,7 @@ async function describedOnOpaque(iframe: HTMLIFrameElement, element: Element) {
|
|
|
101
78
|
}
|
|
102
79
|
|
|
103
80
|
async function bothPaths(element: HTMLElement, options: PreviewSelectionOptions = CONTEXT) {
|
|
104
|
-
const opaque =
|
|
81
|
+
const opaque = sealedPreviewFrame().iframe;
|
|
105
82
|
const live = await resolveDomEditSelection(element, options);
|
|
106
83
|
const remote = await resolvePreviewSelection(
|
|
107
84
|
opaque,
|
|
@@ -183,7 +160,7 @@ describe("opaque frame selections match same-origin ones", () => {
|
|
|
183
160
|
it("follows a drilled-into group: its nested group, then its children, else the top level", async () => {
|
|
184
161
|
document.body.innerHTML = FIXTURE;
|
|
185
162
|
const member = document.querySelector<HTMLElement>("[data-hf-id=m1]")!;
|
|
186
|
-
const opaque =
|
|
163
|
+
const opaque = sealedPreviewFrame().iframe;
|
|
187
164
|
const described = await describedOnOpaque(opaque, member);
|
|
188
165
|
const outerLive = document.querySelector<HTMLElement>('[data-hf-group="outer"]')!;
|
|
189
166
|
const innerLive = document.querySelector<HTMLElement>('[data-hf-group="inner"]')!;
|
|
@@ -224,7 +201,11 @@ describe("opaque frame selections match same-origin ones", () => {
|
|
|
224
201
|
])("finds an element for a selection %s", async (_name, selection) => {
|
|
225
202
|
document.body.innerHTML = FIXTURE;
|
|
226
203
|
const live = findElementForSelection(document, selection, "index.html");
|
|
227
|
-
const found = await findPreviewElementForSelection(
|
|
204
|
+
const found = await findPreviewElementForSelection(
|
|
205
|
+
sealedPreviewFrame().iframe,
|
|
206
|
+
selection,
|
|
207
|
+
"index.html",
|
|
208
|
+
);
|
|
228
209
|
expect(live === null ? null : nameOf(live)).toBe(found === null ? null : found && named(found));
|
|
229
210
|
if (selection.selector !== ".missing" && selection.selector !== "p[")
|
|
230
211
|
expect(live).not.toBeNull();
|
|
@@ -243,7 +224,11 @@ describe("opaque frame selections match same-origin ones", () => {
|
|
|
243
224
|
document.body.innerHTML = FIXTURE;
|
|
244
225
|
const options = { activeCompositionPath: "index.html", isMasterView };
|
|
245
226
|
const live = findElementForTimelineElement(document, element, options);
|
|
246
|
-
const found = await findPreviewElementForTimelineElement(
|
|
227
|
+
const found = await findPreviewElementForTimelineElement(
|
|
228
|
+
sealedPreviewFrame().iframe,
|
|
229
|
+
element,
|
|
230
|
+
options,
|
|
231
|
+
);
|
|
247
232
|
expect(live && nameOf(live)).toBe(expected);
|
|
248
233
|
expect(found && named(found)).toBe(expected);
|
|
249
234
|
});
|
|
@@ -268,7 +253,7 @@ describe("opaque frame selection handles", () => {
|
|
|
268
253
|
|
|
269
254
|
it("builds nothing for a removed element, and finds nothing the runtime cannot name", async () => {
|
|
270
255
|
document.body.innerHTML = FIXTURE;
|
|
271
|
-
const opaque =
|
|
256
|
+
const opaque = sealedPreviewFrame().iframe;
|
|
272
257
|
const locked = document.querySelector("#locked")!;
|
|
273
258
|
const described = await describedOnOpaque(opaque, locked);
|
|
274
259
|
// A description whose parent is not the element its runtime names as the parent.
|
|
@@ -300,7 +285,7 @@ describe("opaque frame selection handles", () => {
|
|
|
300
285
|
it("says it cannot tell when a capped query does not reach the index", async () => {
|
|
301
286
|
document.body.innerHTML = "<i class='n'></i>".repeat(2_049);
|
|
302
287
|
const found = await findPreviewElementForSelection(
|
|
303
|
-
|
|
288
|
+
sealedPreviewFrame().iframe,
|
|
304
289
|
{ selector: ".n", selectorIndex: 2_048 },
|
|
305
290
|
"index.html",
|
|
306
291
|
);
|
|
@@ -357,7 +342,7 @@ describe("opaque frame selections read only what arrived whole", () => {
|
|
|
357
342
|
|
|
358
343
|
it("builds nothing when the frame cannot read computed styles or the composition root", async () => {
|
|
359
344
|
document.body.innerHTML = FIXTURE;
|
|
360
|
-
const opaque =
|
|
345
|
+
const opaque = sealedPreviewFrame().iframe;
|
|
361
346
|
const locked = await describedOnOpaque(opaque, document.querySelector("#locked")!);
|
|
362
347
|
const bg = await describedOnOpaque(opaque, document.querySelector("#bg")!);
|
|
363
348
|
expect(await resolvePreviewSelection(opaque, bg, CONTEXT)).not.toBeNull();
|
|
@@ -419,7 +404,7 @@ describe("useDomSelection on an opaque frame", () => {
|
|
|
419
404
|
it("selects a timeline clip, refreshes it, and drops it once the frame no longer has it", async () => {
|
|
420
405
|
document.body.innerHTML = FIXTURE;
|
|
421
406
|
const liveHook = renderSelection(liveFrame());
|
|
422
|
-
const hook = renderSelection(
|
|
407
|
+
const hook = renderSelection(sealedPreviewFrame().iframe);
|
|
423
408
|
await act(() => liveHook().handleTimelineElementSelect(clip("#locked")));
|
|
424
409
|
await act(() => hook().handleTimelineElementSelect(clip("#locked")));
|
|
425
410
|
const selected = hook().domEditSelection!;
|
|
@@ -438,7 +423,7 @@ describe("useDomSelection on an opaque frame", () => {
|
|
|
438
423
|
|
|
439
424
|
it("re-finds every group member on refresh", async () => {
|
|
440
425
|
document.body.innerHTML = FIXTURE;
|
|
441
|
-
const hook = renderSelection(
|
|
426
|
+
const hook = renderSelection(sealedPreviewFrame().iframe);
|
|
442
427
|
await act(() => hook().handleTimelineElementSelect(clip("#locked")));
|
|
443
428
|
const first = hook().domEditSelection!;
|
|
444
429
|
await act(() => hook().handleTimelineElementSelect(clip("#plain")));
|
|
@@ -454,7 +439,7 @@ describe("useDomSelection on an opaque frame", () => {
|
|
|
454
439
|
|
|
455
440
|
it("leaves a group the user changed while its refresh was reading the frame", async () => {
|
|
456
441
|
document.body.innerHTML = FIXTURE;
|
|
457
|
-
const hook = renderSelection(
|
|
442
|
+
const hook = renderSelection(sealedPreviewFrame().iframe);
|
|
458
443
|
await act(() => hook().handleTimelineElementSelect(clip("#plain")));
|
|
459
444
|
const plain = hook().domEditSelection!;
|
|
460
445
|
await act(() => hook().handleTimelineElementSelect(clip("#locked")));
|
|
@@ -479,3 +464,34 @@ describe("useDomSelection on an opaque frame", () => {
|
|
|
479
464
|
expect(hook().domEditGroupSelections.map((s) => s.id)).toEqual(["scene"]);
|
|
480
465
|
});
|
|
481
466
|
});
|
|
467
|
+
|
|
468
|
+
describe("an opaque frame selection's crop", () => {
|
|
469
|
+
it("reads the clip-path the frame renders, as a scriptable frame's does", async () => {
|
|
470
|
+
document.body.innerHTML = FIXTURE;
|
|
471
|
+
const plain = document.querySelector<HTMLElement>("#plain")!;
|
|
472
|
+
plain.style.clipPath = "inset(10px 20px 30px 40px)";
|
|
473
|
+
const { live, remote } = await bothPaths(plain);
|
|
474
|
+
|
|
475
|
+
expect(readElementCropInsets(remote!.element)).toEqual(readElementCropInsets(live!.element));
|
|
476
|
+
expect(readElementCropInsets(remote!.element)).toMatchObject({
|
|
477
|
+
top: 10,
|
|
478
|
+
right: 20,
|
|
479
|
+
bottom: 30,
|
|
480
|
+
left: 40,
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
it("shows the element uncropped in the frame while selected, and crops it again after", async () => {
|
|
485
|
+
document.body.innerHTML = FIXTURE;
|
|
486
|
+
const plain = document.querySelector<HTMLElement>("#plain")!;
|
|
487
|
+
plain.style.clipPath = "inset(10px 20px 30px 40px)";
|
|
488
|
+
const { remote } = await bothPaths(plain);
|
|
489
|
+
const shown = () => window.getComputedStyle(plain).clipPath;
|
|
490
|
+
|
|
491
|
+
liftElementCrop(remote!.element);
|
|
492
|
+
await vi.waitFor(() => expect(shown()).toBe("none"));
|
|
493
|
+
expect(readElementCropInsets(remote!.element)).toMatchObject({ top: 10, left: 40 });
|
|
494
|
+
dropElementCropLift(remote!.element);
|
|
495
|
+
await vi.waitFor(() => expect(shown()).toBe("inset(10px 20px 30px 40px)"));
|
|
496
|
+
});
|
|
497
|
+
});
|
|
@@ -26,8 +26,10 @@ import {
|
|
|
26
26
|
previewElementSelectorIndex,
|
|
27
27
|
previewPointerTargets,
|
|
28
28
|
previewElementSourceFile,
|
|
29
|
+
editPreviewElement,
|
|
29
30
|
queryPreviewElements,
|
|
30
31
|
type PreviewElement,
|
|
32
|
+
type PreviewElementEdit,
|
|
31
33
|
} from "../../player/lib/previewElements";
|
|
32
34
|
import { coversCompositionRoot } from "./domEditingRootLayer";
|
|
33
35
|
import {
|
|
@@ -72,6 +74,7 @@ import {
|
|
|
72
74
|
STUDIO_WIDTH_PROP,
|
|
73
75
|
} from "./manualEditsTypes";
|
|
74
76
|
import { rememberFrameTranslate, TRANSLATE_PX_PROPERTIES, translatePx } from "./plainTranslate";
|
|
77
|
+
import { rememberFrameClipPath } from "./domEditOverlayCrop";
|
|
75
78
|
|
|
76
79
|
let inertDocument: Document | undefined;
|
|
77
80
|
const inert = () => (inertDocument ??= document.implementation.createHTMLDocument(""));
|
|
@@ -354,9 +357,15 @@ export async function resolvePreviewSelection(
|
|
|
354
357
|
]);
|
|
355
358
|
if (!styles) return null;
|
|
356
359
|
// The stand-in has no box to size a % or em against: a move starts from what the frame renders.
|
|
360
|
+
rememberFrameClipPath(
|
|
361
|
+
element,
|
|
362
|
+
current.inlineStyles["clip-path"] ?? "",
|
|
363
|
+
styles["clip-path"] ?? "",
|
|
364
|
+
);
|
|
357
365
|
rememberFrameTranslate(
|
|
358
366
|
element,
|
|
359
367
|
translatePx(styles.translate ?? "none", (p) => styles[p] ?? ""),
|
|
368
|
+
styles.translate ?? "none",
|
|
360
369
|
);
|
|
361
370
|
const computedStyles = Object.fromEntries(
|
|
362
371
|
CURATED_STYLE_PROPERTIES.flatMap((p) => (p in styles ? [[p, styles[p]!]] : [])),
|
|
@@ -511,6 +520,15 @@ export async function findPointerTargets(
|
|
|
511
520
|
return (described ?? []).filter((element) => element !== null);
|
|
512
521
|
}
|
|
513
522
|
|
|
523
|
+
export function editSealedSelection(
|
|
524
|
+
iframe: HTMLIFrameElement | null | undefined,
|
|
525
|
+
selection: DomEditSelection,
|
|
526
|
+
edit: Parameters<typeof editPreviewElement>[2],
|
|
527
|
+
): PreviewElementEdit | null {
|
|
528
|
+
if (!iframe || !selection.handle || !previewFrameOpaque(iframe)) return null;
|
|
529
|
+
return editPreviewElement(iframe, selection.handle, edit);
|
|
530
|
+
}
|
|
531
|
+
|
|
514
532
|
/** A stand-in is never connected: an opaque frame's selection stands until it is replaced. */
|
|
515
533
|
export const selectionElementLive = (selection: DomEditSelection) =>
|
|
516
534
|
selection.handle !== undefined || selection.element.isConnected;
|
|
@@ -4,12 +4,10 @@ import React, { act } from "react";
|
|
|
4
4
|
import { createRoot } from "react-dom/client";
|
|
5
5
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
6
6
|
import { normalizeHfColorGrading } from "@hyperframes/core/color-grading";
|
|
7
|
-
// The frame's real runtime agent, serving the opaque frame from this document.
|
|
8
|
-
import { installMarkedEditingAgent } from "../../../../core/src/runtime/editingAgent.test-helpers";
|
|
9
7
|
import { installReactActEnvironment } from "../../hooks/domSelectionTestHarness";
|
|
10
|
-
import { detachedFakeIframe } from "../../player/hooks/timelinePlayerTestHarness";
|
|
11
8
|
import type { DomEditSelection } from "./domEditing";
|
|
12
9
|
import { useColorGradingController } from "./useColorGradingController";
|
|
10
|
+
import { sealedPreviewFrame } from "../../player/lib/sealedPreviewFrame.test-helpers";
|
|
13
11
|
|
|
14
12
|
installReactActEnvironment();
|
|
15
13
|
|
|
@@ -20,29 +18,6 @@ afterEach(() => {
|
|
|
20
18
|
document.body.innerHTML = "";
|
|
21
19
|
});
|
|
22
20
|
|
|
23
|
-
/** A frame Studio cannot read, whose runtime is the real editing agent over this document. */
|
|
24
|
-
function opaqueFrame(): HTMLIFrameElement {
|
|
25
|
-
const frame: Record<string, unknown> = {};
|
|
26
|
-
const iframe = detachedFakeIframe(frame);
|
|
27
|
-
Object.defineProperty(iframe, "contentDocument", { value: null });
|
|
28
|
-
Object.defineProperty(frame, "document", {
|
|
29
|
-
get: () => {
|
|
30
|
-
throw new DOMException("blocked", "SecurityError");
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
const parent = {
|
|
34
|
-
postMessage: (data: unknown, _origin: string, ports: MessagePort[]) =>
|
|
35
|
-
window.dispatchEvent(
|
|
36
|
-
new MessageEvent("message", { source: frame as unknown as Window, data, ports }),
|
|
37
|
-
),
|
|
38
|
-
} as unknown as Window;
|
|
39
|
-
const agent = installMarkedEditingAgent(parent);
|
|
40
|
-
frame.postMessage = (data: unknown) =>
|
|
41
|
-
window.dispatchEvent(new MessageEvent("message", { source: parent, data }));
|
|
42
|
-
closers.push(() => agent.dispose());
|
|
43
|
-
return iframe;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
21
|
/** The frame's colour grading runtime, on the window the agent serves. */
|
|
47
22
|
function installFrameGrading() {
|
|
48
23
|
const stopPlayback = vi.fn();
|
|
@@ -109,7 +84,7 @@ const settle = (check: () => void) =>
|
|
|
109
84
|
describe("grade preview sealed", () => {
|
|
110
85
|
it("reads the frame's grading status over the editing port", async () => {
|
|
111
86
|
const { grading } = installFrameGrading();
|
|
112
|
-
const state = renderController(
|
|
87
|
+
const state = renderController(sealedPreviewFrame().iframe);
|
|
113
88
|
|
|
114
89
|
await settle(() =>
|
|
115
90
|
expect(state().runtimeStatus).toEqual({ state: "active", message: "Shader active" }),
|
|
@@ -119,7 +94,7 @@ describe("grade preview sealed", () => {
|
|
|
119
94
|
|
|
120
95
|
it("draws preset cards the frame renders, and drops any that are not image data", async () => {
|
|
121
96
|
const { grading } = installFrameGrading();
|
|
122
|
-
const state = renderController(
|
|
97
|
+
const state = renderController(sealedPreviewFrame().iframe);
|
|
123
98
|
|
|
124
99
|
act(() => state().requestPresetPreviews());
|
|
125
100
|
await settle(() => expect(state().presetPreviews.images["bright-pop"]).toBeDefined());
|
|
@@ -135,7 +110,7 @@ describe("grade preview sealed", () => {
|
|
|
135
110
|
|
|
136
111
|
it("plays the hovered card in the frame and stops it when the hover ends", async () => {
|
|
137
112
|
const { grading, stopPlayback } = installFrameGrading();
|
|
138
|
-
const state = renderController(
|
|
113
|
+
const state = renderController(sealedPreviewFrame().iframe);
|
|
139
114
|
const look = normalizeHfColorGrading({ preset: "bright-pop", intensity: 1 })!;
|
|
140
115
|
|
|
141
116
|
act(() =>
|
|
@@ -157,7 +132,7 @@ describe("grade preview sealed", () => {
|
|
|
157
132
|
|
|
158
133
|
it("captures a graded frame from the frame", async () => {
|
|
159
134
|
installFrameGrading();
|
|
160
|
-
const state = renderController(
|
|
135
|
+
const state = renderController(sealedPreviewFrame().iframe);
|
|
161
136
|
|
|
162
137
|
const frame = await act(() => state().captureGradedFrame());
|
|
163
138
|
expect(frame).toEqual({ dataUrl: "data:image/png;base64,capture", width: 160, height: 90 });
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// @vitest-environment happy-dom
|
|
2
|
+
import { afterEach, expect, it, vi } from "vitest";
|
|
3
|
+
|
|
4
|
+
const request = vi.hoisted(() => vi.fn());
|
|
5
|
+
vi.mock("../../player/lib/previewChannel", async (importOriginal) => ({
|
|
6
|
+
...(await importOriginal<typeof import("../../player/lib/previewChannel")>()),
|
|
7
|
+
previewRequest: request,
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
import { sealedMotionPathHome } from "./useMotionPathData";
|
|
11
|
+
|
|
12
|
+
const HOME = { x: 60, y: 45, w: 100, h: 50, ax: 0.5, ay: 0.5 };
|
|
13
|
+
|
|
14
|
+
afterEach(() => request.mockReset());
|
|
15
|
+
|
|
16
|
+
it("holds a well-formed home from the frame", async () => {
|
|
17
|
+
request.mockResolvedValue({ home: HOME, perspective: 2, visible: true, plugin: true });
|
|
18
|
+
|
|
19
|
+
const read = await sealedMotionPathHome(document.createElement("iframe"), "#box");
|
|
20
|
+
|
|
21
|
+
expect(read).toEqual({ home: HOME, perspective: 2, visible: true, plugin: true });
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it.each([
|
|
25
|
+
["a field that is text", { ...HOME, x: "60" }],
|
|
26
|
+
["a field that is not finite", { ...HOME, y: Number.NaN }],
|
|
27
|
+
["an endless size", { ...HOME, w: Number.POSITIVE_INFINITY }],
|
|
28
|
+
])("counts a home with %s as no home", async (_name, home) => {
|
|
29
|
+
request.mockResolvedValue({ home, perspective: Number.NaN, visible: true, plugin: true });
|
|
30
|
+
|
|
31
|
+
const read = await sealedMotionPathHome(document.createElement("iframe"), "#box");
|
|
32
|
+
|
|
33
|
+
expect(read).toEqual({ home: null, perspective: 1, visible: true, plugin: true });
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("answers nothing for a reply that is off its shape", async () => {
|
|
37
|
+
request.mockResolvedValue({ home: HOME, perspective: 1, visible: "yes", plugin: true });
|
|
38
|
+
|
|
39
|
+
expect(await sealedMotionPathHome(document.createElement("iframe"), "#box")).toBeNull();
|
|
40
|
+
});
|