diff options
| author | Shoubhit Dash <[email protected]> | 2026-03-14 22:51:45 +0530 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-14 22:51:45 +0530 |
| commit | 689d9e14eade9001568c46c602092eb01fe7e746 (patch) | |
| tree | c4f4e4740526915f59b0f34e3f260d1745b30827 /packages/app/src/components/prompt-input/attachments.test.ts | |
| parent | 66e8c57ed1077814c9a150b858a53fdd7c758c0f (diff) | |
| download | opencode-689d9e14eade9001568c46c602092eb01fe7e746.tar.gz opencode-689d9e14eade9001568c46c602092eb01fe7e746.zip | |
fix(app): handle multiline web paste in prompt composer (#17509)
Diffstat (limited to 'packages/app/src/components/prompt-input/attachments.test.ts')
| -rw-r--r-- | packages/app/src/components/prompt-input/attachments.test.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/app/src/components/prompt-input/attachments.test.ts b/packages/app/src/components/prompt-input/attachments.test.ts index d8ae43d13..43f7d425b 100644 --- a/packages/app/src/components/prompt-input/attachments.test.ts +++ b/packages/app/src/components/prompt-input/attachments.test.ts @@ -1,5 +1,6 @@ import { describe, expect, test } from "bun:test" import { attachmentMime } from "./files" +import { pasteMode } from "./paste" describe("attachmentMime", () => { test("keeps PDFs when the browser reports the mime", async () => { @@ -22,3 +23,22 @@ describe("attachmentMime", () => { expect(await attachmentMime(file)).toBeUndefined() }) }) + +describe("pasteMode", () => { + test("uses native paste for short single-line text", () => { + expect(pasteMode("hello world")).toBe("native") + }) + + test("uses manual paste for multiline text", () => { + expect( + pasteMode(`{ + "ok": true +}`), + ).toBe("manual") + expect(pasteMode("a\r\nb")).toBe("manual") + }) + + test("uses manual paste for large text", () => { + expect(pasteMode("x".repeat(8000))).toBe("manual") + }) +}) |
