import { describe, expect, it } from "vitest"; import { paneTitleAttr, paneTitleHtml } from "./paneTitle.js"; describe("paneTitleHtml", () => { it("falls back to a short session id when there is no info yet", () => { expect(paneTitleHtml("abcdef12-3456-7890-abcd-ef1234567890")).toContain("abcdef12"); }); it("shows the name alone when command matches it", () => { const html = paneTitleHtml("s1", { name: "claude", command: "claude" }); expect(html).toContain("claude"); expect(html).not.toContain("at-cmd"); }); it("escapes a name that looks like markup", () => { const html = paneTitleHtml("s1", { name: "", command: "claude" }); expect(html).not.toContain(" { it("escapes the attribute form too", () => { const attr = paneTitleAttr("s1", { name: '"quoted"', command: "claude" }); expect(attr).not.toContain('"quoted"'); expect(attr).toContain(""quoted""); }); });