Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions packages/cli/src/utils/gsapTweenTails.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,29 @@ describe("collectTweenRecords", () => {
expect(findTweenTails(records)).toHaveLength(1);
});

it("ignores rendering flags when finding shared tween properties", () => {
const target = {};
const main = fakeTimeline(0);
fakeTween(main, target, { x: 200, duration: 1, force3D: false, autoRound: false }, 0);
fakeTween(main, target, { opacity: 0.5, duration: 0.4, force3D: false, autoRound: false }, 0.5);
(window as unknown as { __timelines: Record<string, unknown> }).__timelines = { main };

expect(collectTweenRecords().map(({ properties }) => properties)).toEqual([["x"], ["opacity"]]);
expect(findTweenTails(collectTweenRecords())).toEqual([]);
});

it("still reports a shared animated property when rendering flags are present", () => {
const target = {};
const main = fakeTimeline(0);
fakeTween(main, target, { opacity: 1, duration: 1, force3D: false, autoRound: false }, 0);
fakeTween(main, target, { opacity: 0.5, duration: 0.4, force3D: false, autoRound: false }, 0.5);
(window as unknown as { __timelines: Record<string, unknown> }).__timelines = { main };

expect(findTweenTails(collectTweenRecords())).toEqual([
expect.objectContaining({ properties: ["opacity"] }),
]);
});

it("returns nothing when no timeline is registered", () => {
expect(collectTweenRecords()).toEqual([]);
});
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/utils/gsapTweenTails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ export function collectTweenRecords(): TweenRecord[] {
};
const NOT_PROPERTIES = new Set([
"duration",
"force3D",
"autoRound",
"delay",
"ease",
"repeat",
Expand Down
Loading