The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { describe, expect, it } from "vite-plus/test"; |
| 2 | |
| 3 | import { deriveMenuVerticalPlacement } from "./menu-placement"; |
| 4 | |
| 5 | const base = { gap: 6, margin: 12, minHeight: 110 }; |
| 6 | |
| 7 | describe("deriveMenuVerticalPlacement", () => { |
| 8 | it.each([ |
| 9 | { |
| 10 | name: "anchor taller than the keyboard-free area stays on screen", |
| 11 | input: { anchorY: -100, anchorHeight: 1000, overlayHeight: 800, keyboardInset: 300 }, |
| 12 | expected: { maxHeight: 476, top: 12 }, |
| 13 | }, |
| 14 | { |
| 15 | name: "room below opens down", |
| 16 | input: { anchorY: 100, anchorHeight: 40, overlayHeight: 800, keyboardInset: 300 }, |
| 17 | expected: { maxHeight: 342, top: 146 }, |
| 18 | }, |
| 19 | { |
| 20 | name: "room above opens up", |
| 21 | input: { anchorY: 400, anchorHeight: 40, overlayHeight: 800, keyboardInset: 300 }, |
| 22 | expected: { maxHeight: 382, bottom: 406 }, |
| 23 | }, |
| 24 | ])("$name", ({ input, expected }) => { |
| 25 | expect(deriveMenuVerticalPlacement({ ...base, ...input })).toEqual(expected); |
| 26 | }); |
| 27 | }); |