fix: editor renders standalone committed deletions neutral; doc/comment cleanups (final review)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -286,6 +286,21 @@ test("committed change with NO shared prefix: current offsets + deleted text bot
|
||||
expect(plan.deletions.some((d) => d.text.includes("alpha"))).toBe(true); // deletion not lost
|
||||
});
|
||||
|
||||
test("standalone committed deletion → plan has no insertions (controller routes del to neutral)", () => {
|
||||
// current = "keep word" (baseline had "this " between "keep " and "word" — standalone deletion)
|
||||
const [h] = wordEditHunks("keep word", "keep this word");
|
||||
const plan = decorationPlan(h.start, h.replacement, "keep word".slice(h.start, h.end));
|
||||
expect(plan.insertions.length).toBe(0);
|
||||
expect(plan.deletions.some((d) => d.text.includes("this"))).toBe(true);
|
||||
});
|
||||
|
||||
test("paired committed replace → plan has insertions (deletion inherits author, not neutral)", () => {
|
||||
// current = "the dark mode", baseline = "the light mode" — replacement, so paired
|
||||
const [h] = wordEditHunks("the dark mode", "the light mode");
|
||||
const plan = decorationPlan(h.start, h.replacement, "the dark mode".slice(h.start, h.end));
|
||||
expect(plan.insertions.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
describe("renderPlain", () => {
|
||||
test("renderPlain renders current buffer as plain markdown (no marks)", () => {
|
||||
const html = renderPlain("# Title\n\nhello");
|
||||
|
||||
Reference in New Issue
Block a user