Commit aca867a
committed
test(miner-ui): cover chat-scroll stick-to-bottom boundary and clamp (#7793)
apps/loopover-miner-ui/src/lib/chat-scroll.ts encodes the 80px near-bottom
threshold and the scroll clamp for the chat auto-scroll feature, but had no
direct test: its only consumer (components/chat/message-list.tsx) is covered
for DOM structure, and jsdom does not meaningfully simulate scrollTop /
scrollHeight there. This logic already needed one dedicated bug-fix pass
(#7229/#7298), which is exactly the kind of regression a unit test catches.
Adds chat-scroll.test.ts following the one-test-per-pure-module convention
demo-data.test.ts already establishes in the same directory:
- isChatViewportNearBottom: the <= boundary at exactly CHAT_NEAR_BOTTOM_PX,
one pixel past it, sitting exactly at the bottom, content shorter than the
viewport (negative distance), scrolled far up, and an explicit thresholdPx
overriding the default.
- scrollChatViewportToBottom: scrolls to the maximum offset, clamps to 0 when
the content is shorter than the viewport, and is idempotent once bottomed.
Test-only, no production change.1 parent 17ae3e6 commit aca867a
1 file changed
Lines changed: 63 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
0 commit comments