Skip to content

Commit f98ab79

Browse files
committed
test(studio): a drag on a mixed tween is one write under the gesture key
1 parent cf7c53f commit f98ab79

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

‎packages/studio/src/hooks/gsapRuntimeBridge.sharedTween.test.ts‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ describe("tryGsapDragIntercept: which tweens a word's drag may use", () => {
121121
});
122122

123123
describe("tryGsapDragIntercept: one drag is one undo step", () => {
124-
it("records the split and the move under one gesture key", async () => {
124+
it("records the move under one gesture key, without splitting the mixed tween", async () => {
125125
document.body.innerHTML = `<div id="hero"></div>`;
126126
const hero = document.getElementById("hero")!;
127127
const mixed = {
@@ -133,23 +133,21 @@ describe("tryGsapDragIntercept: one drag is one undo step", () => {
133133
position: 0,
134134
resolvedStart: 0,
135135
duration: 1,
136+
ease: "none",
136137
} as unknown as GsapAnimation;
137-
const split = [
138-
{ ...mixed, id: "#hero-fromTo-0-position", propertyGroup: "position" },
139-
{ ...mixed, id: "#hero-fromTo-0-opacity", propertyGroup: "opacity" },
140-
] as GsapAnimation[];
141-
let fetches = 0;
142138
const commitMutation = vi.fn();
143139
await tryGsapDragIntercept(
144140
{ id: "hero", selector: "#hero", element: hero } as unknown as DomEditSelection,
145141
{ x: 20, y: 0 },
146142
[mixed],
147143
null,
148144
commitMutation,
149-
async () => (fetches++ === 0 ? [mixed] : split),
145+
async () => [mixed],
150146
);
147+
const types = commitMutation.mock.calls.map((call) => call[1].type);
151148
const options = commitMutation.mock.calls.map((call) => call[2]);
152-
expect(options.length).toBeGreaterThan(1);
149+
expect(types).not.toContain("split-into-property-groups");
150+
expect(options.length).toBeGreaterThan(0);
153151
expect(new Set(options.map((o) => o.coalesceKey)).size).toBe(1);
154152
expect(options[0].coalesceKey).toMatch(/^gsap:drag:/);
155153
expect(options.every((o) => o.coalesceMs === Number.POSITIVE_INFINITY)).toBe(true);

0 commit comments

Comments
 (0)