| 1 | import { describe, expect, it } from "vite-plus/test"; |
| 2 | |
| 3 | import { derivePendingUserInputMaxHeight } from "./pendingUserInputLayout"; |
| 4 | |
| 5 | describe("derivePendingUserInputMaxHeight", () => { |
| 6 | it("caps a tall portrait viewport", () => { |
| 7 | expect( |
| 8 | derivePendingUserInputMaxHeight({ |
| 9 | windowHeight: 932, |
| 10 | keyboardHeight: 0, |
| 11 | navigationHeaderHeight: 103, |
| 12 | composerOverlapHeight: 94, |
| 13 | }), |
| 14 | ).toBe(560); |
| 15 | }); |
| 16 | |
| 17 | it("subtracts the keyboard while editing a custom answer", () => { |
| 18 | expect( |
| 19 | derivePendingUserInputMaxHeight({ |
| 20 | windowHeight: 932, |
| 21 | keyboardHeight: 336, |
| 22 | navigationHeaderHeight: 103, |
| 23 | composerOverlapHeight: 94, |
| 24 | }), |
| 25 | ).toBe(387); |
| 26 | }); |
| 27 | |
| 28 | it("keeps the fixed action area usable in a short keyboard-open viewport", () => { |
| 29 | expect( |
| 30 | derivePendingUserInputMaxHeight({ |
| 31 | windowHeight: 375, |
| 32 | keyboardHeight: 240, |
| 33 | navigationHeaderHeight: 44, |
| 34 | composerOverlapHeight: 94, |
| 35 | }), |
| 36 | ).toBe(160); |
| 37 | }); |
| 38 | }); |