import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, it, vi } from "vite-plus/test";
import { DiffCommentAnnotation } from "./DiffCommentAnnotation";
const callbacks = {
onTextChange: vi.fn(),
onCancel: vi.fn(),
onComment: vi.fn(),
onDelete: vi.fn(),
};
describe("DiffCommentAnnotation", () => {
it("renders the shared draft composer directly in the selected diff", () => {
const markup = renderToStaticMarkup(
,
);
expect(markup).toContain("font-sans");
expect(markup).not.toContain("chat-composer-glass");
expect(markup).not.toContain("font-mono");
expect(markup).not.toContain("Local comment");
expect(markup).not.toContain("on +78");
expect(markup).toContain("⌘/Ctrl Enter to send");
expect(markup).toContain("Add a comment…");
expect(markup).toContain(">Comment");
expect(markup).toContain("autofocus");
const textareaControl = markup.match(/]*data-slot="textarea-control"[^>]*>/)?.[0];
expect(textareaControl).toBeDefined();
expect(textareaControl).not.toContain("ring-ring");
expect(markup).toContain("cursor-text");
});
it("lets a pull-request diff configure actions without replacing the composer", () => {
const markup = renderToStaticMarkup(
,
);
expect(markup).toContain("Add a comment…");
expect(markup).toContain(">Add to review");
expect(markup.match(/