F12: inline editable proposed-change diff in the Markdown editor + Accept/Reject control parity (#64) (#66)
This commit was merged in pull request #66.
This commit is contained in:
@@ -9,7 +9,7 @@ import {
|
||||
type Proposal,
|
||||
} from "../src/model";
|
||||
import { CoauthorStore } from "../src/store";
|
||||
import { addProposal, proposalBody, removeProposal } from "../src/proposalModel";
|
||||
import { addProposal, proposalBody, removeProposal, setProposalApplied } from "../src/proposalModel";
|
||||
|
||||
const agent = {
|
||||
kind: "agent" as const,
|
||||
@@ -104,4 +104,19 @@ describe("proposalModel helpers (spec §6.4)", () => {
|
||||
expect(body).toContain("- old line two");
|
||||
expect(body).toContain("+ new only line");
|
||||
});
|
||||
|
||||
it("setProposalApplied stores original and re-anchors the fingerprint to the applied text", () => {
|
||||
const a = emptyArtifact("docs/x.md");
|
||||
const { proposalId, anchorId } = addProposal(
|
||||
a,
|
||||
{ text: "old", before: "", after: "", lineHint: 0 },
|
||||
"new",
|
||||
{ kind: "agent", id: "claude", agent: { sdk: "x", model: "m", sessionId: "s" } },
|
||||
{ granularity: "block" },
|
||||
);
|
||||
setProposalApplied(a, proposalId, { text: "new", before: "", after: "", lineHint: 0 }, "old");
|
||||
const p = a.proposals.find((x) => x.id === proposalId)!;
|
||||
expect(p.original).toBe("old");
|
||||
expect(a.anchors[anchorId].fingerprint.text).toBe("new");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user