Files
2026-10-19 16:47:33 +02:00

17 lines
784 B
TypeScript

import { expect, test } from "bun:test"
import { takeDraft } from "../src/component/prompt/draft-stash"
import { createAppFixture } from "./fixture/app"
test("the prompt keeps pasted control characters and drops escape sequences", async () => {
// Other app tests can leave a home draft in the process-wide stash.
takeDraft(undefined)
await using setup = await createAppFixture()
await setup.ready
await setup.waitForFrame((frame) => frame.includes("commands"))
await setup.mockInput.typeText("x")
await setup.waitForFrame((frame) => frame.includes("x"))
await setup.mockInput.pasteBracketedText("a\fb\u001b[31mc\u0000d")
await setup.waitForFrame((frame) => frame.includes("xa^Lbc^@d"))
expect(setup.renderer.currentFocusedEditor?.plainText).toBe("xa\fbc\0d")
})