F10 SLICE-2: extract colorByAuthor from renderAuthorship sentinels (#29)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ben Stull
2026-06-12 00:08:10 -07:00
parent 831710ed0c
commit ebe3d4bab5
2 changed files with 30 additions and 4 deletions
+13 -2
View File
@@ -1,5 +1,5 @@
import { describe, it, expect } from "vitest";
import { splitBlocks, splitBlocksWithRanges, diffBlocks, renderTrackChanges, renderAuthorship, type AuthorSpan } from "../src/trackChangesModel";
import { describe, it, test, expect } from "vitest";
import { splitBlocks, splitBlocksWithRanges, diffBlocks, renderTrackChanges, renderAuthorship, colorByAuthor, type AuthorSpan } from "../src/trackChangesModel";
describe("splitBlocks", () => {
it("splits prose paragraphs on blank lines, dropping empties", () => {
@@ -235,6 +235,17 @@ describe("renderAuthorship", () => {
});
});
describe("colorByAuthor", () => {
test("colorByAuthor wraps human-authored prose in cw-by-human spans", () => {
const raw = "hello world";
const spans: AuthorSpan[] = [{ start: 0, end: 5, author: "human" }];
const render = (src: string) => `<p>${src}</p>`;
const html = colorByAuthor(raw, 0, spans, render);
expect(html).toContain('<span class="cw-by-human">hello</span>');
expect(html).toContain("world");
});
});
import { renderTrackChanges as rtc2 } from "../src/trackChangesModel";
describe("renderTrackChanges — intra-diagram mermaid (#22)", () => {