Skip to content

Write HTML. Render video. Built for agents.

test(core,studio): add T3+T7 hfId targeting stubs (spec for R1) (#1267)

Vance Ingalls1e705b110740
diff --git a/packages/core/src/studio-api/helpers/sourceMutation.test.ts b/packages/core/src/studio-api/helpers/sourceMutation.test.ts
index 8774fffcde..0b4d998d8a 100644
--- a/packages/core/src/studio-api/helpers/sourceMutation.test.ts
+++ b/packages/core/src/studio-api/helpers/sourceMutation.test.ts
@@ -361,3 +361,12 @@ describe("probeElementInSource", () => {
expect(probeElementInSource(sourceHtml, { id: "canvas" })).toBe(true);
});
});
+
+// T7 — data-hf-id targeting (spec for R1).
+// R1 adds `hfId?: string` to SourceMutationTarget and a `[data-hf-id="…"]` branch
+// in findTargetElement (sourceMutation.ts:34). Convert from it.todo in the R1 PR.
+describe("T7 — data-hf-id targeting (spec for R1)", () => {
+ it.todo("patches element by data-hf-id when no HTML id attribute is present");
+
+ it.todo("data-hf-id attribute survives the patch (can be targeted again)");
+});
diff --git a/packages/studio/src/utils/sourcePatcher.test.ts b/packages/studio/src/utils/sourcePatcher.test.ts
index 8bc64e1b80..7697d24e61 100644
--- a/packages/studio/src/utils/sourcePatcher.test.ts
+++ b/packages/studio/src/utils/sourcePatcher.test.ts
@@ -516,3 +516,18 @@ describe("motion attribute round-trip via sourcePatcher", () => {
expect(JSON.parse(readBack!)).toEqual(motion);
});
});
+
+// T3 — id-based targeting (spec for R1).
+// R1 adds `hfId?: string` to PatchTarget and a `[data-hf-id="…"]` lookup branch
+// in findTagByTarget. Convert from it.todo to real assertions in the R1 PR.
+describe("T3 — hfId targeting (spec for R1)", () => {
+ it.todo("updates inline style by data-hf-id");
+
+ it.todo("updates text content by data-hf-id");
+
+ it.todo("updates attribute by data-hf-id");
+
+ it.todo("data-hf-id attribute is preserved after a style patch");
+
+ it.todo("hfId lookup falls through to selector when hfId not found");
+});