mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-10 22:20:14 +00:00
fix(studio): add GSAP 3D inspector metadata (#1250)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { SUPPORTED_PROPS } from "@hyperframes/core/gsap-constants";
|
||||
import { buildTweenSummary } from "./gsapAnimationHelpers";
|
||||
import { PROP_LABELS } from "./gsapAnimationConstants";
|
||||
import type { GsapAnimation } from "@hyperframes/core/gsap-parser";
|
||||
|
||||
function anim(overrides: Partial<GsapAnimation>): GsapAnimation {
|
||||
@@ -23,6 +25,27 @@ describe("buildTweenSummary", () => {
|
||||
expect(s).toContain("move x");
|
||||
});
|
||||
|
||||
it("describes 3D transform tweens with labels and units", () => {
|
||||
const s = buildTweenSummary(
|
||||
anim({
|
||||
properties: {
|
||||
z: 120,
|
||||
rotationX: 45,
|
||||
rotationY: -30,
|
||||
rotationZ: 90,
|
||||
perspective: 800,
|
||||
transformOrigin: "50% 50%",
|
||||
},
|
||||
}),
|
||||
);
|
||||
expect(s).toContain("move z to 120px");
|
||||
expect(s).toContain("rotate x to 45°");
|
||||
expect(s).toContain("rotate y to -30°");
|
||||
expect(s).toContain("rotate z to 90°");
|
||||
expect(s).toContain("perspective to 800px");
|
||||
expect(s).toContain("transform origin to 50% 50%");
|
||||
});
|
||||
|
||||
it("describes a from tween", () => {
|
||||
const s = buildTweenSummary(anim({ method: "from", properties: { opacity: 0 } }));
|
||||
expect(s).toContain("enters from");
|
||||
@@ -65,3 +88,9 @@ describe("buildTweenSummary", () => {
|
||||
expect(s).toContain("no properties yet");
|
||||
});
|
||||
});
|
||||
|
||||
describe("PROP_LABELS", () => {
|
||||
it("provides labels for every inspector-supported GSAP property", () => {
|
||||
expect(SUPPORTED_PROPS.filter((prop) => !PROP_LABELS[prop])).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user