F10 SLICE-2: fix renderReview author-coloring for duplicate blocks; tidy renderReviewOp + escape proposal id (#29)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ben Stull
2026-06-12 00:13:54 -07:00
parent d59f22b22f
commit bcacbf062d
2 changed files with 23 additions and 10 deletions
+12
View File
@@ -295,6 +295,18 @@ describe("renderReview", () => {
expect(html).toContain("mermaid");
expect(html).not.toContain("cw-by-");
});
test("renderReview: author-colors the correct block when two paragraphs are identical", () => {
// Two identical paragraphs; baseline has only the first, so the SECOND is an
// added block authored by human. Its span must color THAT block, not the first.
const baseline = "Hello world";
const current = "Hello world\n\nHello world";
// second "Hello world" starts at offset 13; "world" at 19..24
const spans = [{ start: 19, end: 24, author: "human" as const }];
const html = renderReview(baseline, current, spans, []);
// exactly one cw-by-human span (the added second block's "world"), not zero, not on the first.
const count = (html.match(/cw-by-human/g) ?? []).length;
expect(count).toBe(1);
});
});
import { renderTrackChanges as rtc2 } from "../src/trackChangesModel";