mirror of
https://github.com/backnotprop/plannotator.git
synced 2026-09-14 14:17:26 +08:00
3b83557356
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.
27 lines
791 B
TypeScript
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);
|
|
});
|
|
});
|