The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { expect, it } from "vite-plus/test"; |
| 2 | |
| 3 | import { render } from "../../../test/render"; |
| 4 | import { useComposerMultilinePrompt } from "./useComposerMultilinePrompt"; |
| 5 | |
| 6 | function Composer({ text }: { readonly text: string }) { |
| 7 | const [multiline, observeBody] = useComposerMultilinePrompt(); |
| 8 | return ( |
| 9 | <div ref={observeBody} style={{ width: 200, lineHeight: "20px" }}> |
| 10 | <div data-testid="composer-editor" contentEditable suppressContentEditableWarning> |
| 11 | {text} |
| 12 | </div> |
| 13 | <output>{multiline ? "multiline" : "single line"}</output> |
| 14 | </div> |
| 15 | ); |
| 16 | } |
| 17 | |
| 18 | it("notices when typing makes the prompt wrap", async () => { |
| 19 | await using screen = await render(<Composer text="short" />, { router: false }); |
| 20 | await expect.element(screen.getByText("single line")).toBeVisible(); |
| 21 | await screen.rerender(<Composer text={"a long prompt that wraps ".repeat(6)} />); |
| 22 | await expect.element(screen.getByText("multiline")).toBeVisible(); |
| 23 | }); |