8f2fe7a8e6
* feat(web): add agent message comments * fix(web): harden agent message comments * fix(web): address message comment review findings * fix(web): allow comments on legacy agent messages * fix(web): address latest message comment review * fix(web): address follow-up message comment review * fix(web): address remaining message comment review * fix(web): keep failed mobile comments open * fix(web): preserve selections over message comments
27 lines
921 B
TypeScript
27 lines
921 B
TypeScript
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
|
|
import { PlanSelectionPopover } from "./plan-selection-popover";
|
|
|
|
afterEach(cleanup);
|
|
|
|
describe("PlanSelectionPopover", () => {
|
|
it("keeps entered feedback open when the submitter rejects the save", () => {
|
|
const onClose = vi.fn();
|
|
render(
|
|
<PlanSelectionPopover
|
|
selectedText="settled answer"
|
|
position={{ x: 100, y: 100 }}
|
|
onAdd={() => false}
|
|
onClose={onClose}
|
|
/>,
|
|
);
|
|
|
|
const input = screen.getByPlaceholderText("Add your comment or instruction...");
|
|
fireEvent.change(input, { target: { value: "Keep this feedback" } });
|
|
fireEvent.click(screen.getByRole("button", { name: "Add" }));
|
|
|
|
expect(onClose).not.toHaveBeenCalled();
|
|
expect((input as HTMLTextAreaElement).value).toBe("Keep this feedback");
|
|
});
|
|
});
|