Files
Michael Ramos 3b83557356 Keep annotation panel closed when adding annotations
Stop added annotations from forcing the annotation panel open, and keep dirty annotation comment popovers open on outside click so typed feedback is not lost.
2026-06-15 23:50:36 -07:00

27 lines
791 B
TypeScript

import { describe, expect, test } from "bun:test";
import { hasUnsavedCommentContent } from "./commentContent";
import type { ImageAttachment } from "../types";
const image: ImageAttachment = {
path: "/tmp/mock.png",
name: "mock",
};
describe("hasUnsavedCommentContent", () => {
test("returns false for empty text and no images", () => {
expect(hasUnsavedCommentContent("")).toBe(false);
});
test("returns false for whitespace-only text and no images", () => {
expect(hasUnsavedCommentContent(" \n\t ")).toBe(false);
});
test("returns true for non-whitespace text", () => {
expect(hasUnsavedCommentContent("note")).toBe(true);
});
test("returns true for images without text", () => {
expect(hasUnsavedCommentContent("", [image])).toBe(true);
});
});