mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-07 01:56:04 +00:00
fix(core): preserve position edit fold detection during seeks
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
EDIT_BASE_X_ATTR,
|
||||
EDIT_BASE_Y_ATTR,
|
||||
@@ -211,6 +211,28 @@ describe("installPositionEditsSeekReapply", () => {
|
||||
el.remove();
|
||||
});
|
||||
|
||||
it("wraps __hf.seek and a seek function assigned after installation", () => {
|
||||
vi.useFakeTimers();
|
||||
const el = makeElement({ "data-x": "8", "data-y": "0", "data-hf-edit-base-x": "0" });
|
||||
const calls: number[] = [];
|
||||
// @ts-expect-error test global
|
||||
window.__hf = {};
|
||||
|
||||
installPositionEditsSeekReapply(window as Window & typeof globalThis);
|
||||
// @ts-expect-error test global
|
||||
window.__hf.seek = (time: number) => calls.push(time);
|
||||
vi.advanceTimersByTime(50);
|
||||
// @ts-expect-error test global
|
||||
window.__hf.seek(3);
|
||||
|
||||
expect(calls).toEqual([3]);
|
||||
expect(el.style.getPropertyValue("translate")).toBe("8px 0px");
|
||||
// @ts-expect-error test global
|
||||
delete window.__hf;
|
||||
el.remove();
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it("does not throw when neither seek global exists", () => {
|
||||
expect(() =>
|
||||
installPositionEditsSeekReapply(window as Window & typeof globalThis),
|
||||
|
||||
Reference in New Issue
Block a user