|
2 | 2 | * Integration: app shell product skin — sticky, queue/steer/interrupt, overlay Esc. |
3 | 3 | */ |
4 | 4 | import { describe, expect, test } from "bun:test" |
5 | | -import { MouseEvent, type KeyEvent } from "@opentui/core" |
| 5 | +import type { KeyEvent } from "@opentui/core" |
6 | 6 | import { IDLE_TRANSCRIPT_FLOOR } from "./geometry/index" |
7 | 7 | import { focusOwner, scrollLease } from "./focus/index" |
8 | 8 | import { |
@@ -175,21 +175,22 @@ describe("createAppShell", () => { |
175 | 175 | expect(isTranscriptFollowing(shell)).toBe(true) |
176 | 176 | const followingTop = shell.transcript.scrollTop |
177 | 177 |
|
178 | | - const wheelUp = new MouseEvent(shell.prompt, { |
179 | | - type: "scroll", |
180 | | - button: 0, |
181 | | - x: 0, |
182 | | - y: 0, |
183 | | - modifiers: { shift: false, alt: false, ctrl: false }, |
184 | | - scroll: { direction: "up", delta: 3 }, |
185 | | - }) |
186 | | - ;( |
187 | | - shell.prompt as unknown as { onMouseEvent: (event: MouseEvent) => void } |
188 | | - ).onMouseEvent(wheelUp) |
| 178 | + // Locate the prompt's interior on screen and scroll through the |
| 179 | + // renderer's real SGR-mouse parse + hit-test dispatch, the same |
| 180 | + // path a live terminal drives — not a direct method call, which |
| 181 | + // would pass even if the renderer never routed the event here. |
| 182 | + const rows = h.captureCharFrame().split("\n") |
| 183 | + const borderRow = rows.findIndex((r) => r.includes("╭")) |
| 184 | + const promptX = rows[borderRow]!.indexOf("╭") + 2 |
| 185 | + const promptY = borderRow + 1 |
| 186 | + |
| 187 | + for (let i = 0; i < 5; i++) { |
| 188 | + await h.mockMouse.scroll(promptX, promptY, "up") |
| 189 | + } |
189 | 190 | await h.renderOnce() |
190 | 191 |
|
191 | | - // The wheel event was dispatched at the prompt, but the transcript |
192 | | - // moved and pinned — the prompt's own (empty) buffer never scrolled. |
| 192 | + // The wheel event landed on the prompt, but the transcript moved |
| 193 | + // and pinned — the prompt's own (empty) buffer never scrolled. |
193 | 194 | expect(shell.transcript.scrollTop).toBeLessThan(followingTop) |
194 | 195 | expect(isTranscriptFollowing(shell)).toBe(false) |
195 | 196 | expect(stickyMode(shell)).toBe("PINNED") |
|
0 commit comments