This commit is contained in:
ZacharyZhang-NY committed 2026-04-18 22:45:41 -04:00
1 parent 1261c2431f
commit dac59f56c2
680 files changed
+192574

No files matched your search

@@ -0,0 +1,25 @@
import { describe, expect, test } from "vitest";
import { UserMessageComponent } from "../src/modes/interactive/components/user-message.js";
import { initTheme } from "../src/modes/interactive/theme/theme.js";
const OSC133_ZONE_START = "\x1b]133;A\x07";
const OSC133_ZONE_END = "\x1b]133;B\x07";
const OSC133_ZONE_FINAL = "\x1b]133;C\x07";
const BG_RESET = "\x1b[49m";
describe("UserMessageComponent", () => {
test("keeps user message height stable while moving closing OSC markers off line end", () => {
initTheme("dark");
const component = new UserMessageComponent("hello");
const lines = component.render(20);
expect(lines).toHaveLength(3);
expect(lines[0]).toContain(OSC133_ZONE_START);
expect(lines[0].endsWith(BG_RESET)).toBe(true);
expect(lines[0]).not.toContain(OSC133_ZONE_END);
expect(lines[1]).toContain("hello");
expect(lines[2].startsWith(OSC133_ZONE_END + OSC133_ZONE_FINAL)).toBe(true);
expect(lines[2].endsWith(BG_RESET)).toBe(true);
});
});