feat(render): INV-50 render-once — diff against current-minus-pending (#64)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -375,6 +375,23 @@ describe("renderReview", () => {
|
||||
const b = renderReview(doc, doc, [], proposals);
|
||||
expect(a).toBe(b);
|
||||
});
|
||||
|
||||
test("renderReview renders an applied proposal ONCE, not also as a landed diff (INV-50)", () => {
|
||||
const baseline = "# T\n\nThe brown fox.\n";
|
||||
const current = "# T\n\nThe red fox.\n"; // proposal already optimistically applied
|
||||
const proposals: ProposalView[] = [{
|
||||
id: "pr_1",
|
||||
anchorStart: current.indexOf("The red fox."),
|
||||
anchorEnd: current.indexOf("The red fox.") + "The red fox.".length,
|
||||
replaced: "The brown fox.", // original
|
||||
replacement: "The red fox.",
|
||||
}];
|
||||
const html = renderReview(baseline, current, [], proposals);
|
||||
// exactly one proposal block
|
||||
expect((html.match(/cw-proposal/g) ?? []).length).toBe(1);
|
||||
// the applied paragraph is NOT also emitted as a word-merged changed block
|
||||
expect(html).not.toContain("<del>brown</del>"); // no double-render of the change as a baseline diff
|
||||
});
|
||||
});
|
||||
|
||||
import { renderTrackChanges as rtc2 } from "../src/trackChangesModel";
|
||||
|
||||
Reference in New Issue
Block a user