test(miner-ui): cover chat-scroll stick-to-bottom boundary and clamp (#7793) - #7848
test(miner-ui): cover chat-scroll stick-to-bottom boundary and clamp (#7793)#7848galuis116 wants to merge 1 commit into
Conversation
…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.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Caution 🛑 LoopOver review result - reject/close recommendedReview updated: 2026-07-21 15:07:22 UTC
Review summary Nits — 5 non-blocking
Why this is blocked
📋 Copy for AI agents — paste into your coding agentDecision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
LoopOver is closing this pull request on the maintainer's behalf (Linked issue overlaps another open PR; duplicate of open PR #7847). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
Summary
Closes #7793.
apps/loopover-miner-ui/src/lib/chat-scroll.tsencodes the<= 80pxnear-bottom threshold (CHAT_NEAR_BOTTOM_PX) and the clamp used by the chat stick-to-bottom auto-scroll, but had no direct test. Its only consumer,components/chat/message-list.tsx, is covered for DOM structure / StateBoundary branches only - and jsdom does not meaningfully simulatescrollTop/scrollHeightthere, so the scroll math was never actually exercised. Pergit logthis logic already needed one dedicated bug-fix pass (#7229/#7298), which is exactly the class of regression a unit test catches.Adds
chat-scroll.test.tsnext to the module, following the one-test-per-pure-module conventiondemo-data.test.tsalready establishes in the same directory:isChatViewportNearBottomCHAT_NEAR_BOTTOM_PX->true(the<=boundary that motivated the prior fix)falsetruetruefalsethresholdPxoverriding the default (both arms, including0where<=still admits distance 0)CHAT_NEAR_BOTTOM_PXis the documented80scrollChatViewportToBottom0when the content is shorter than the viewport (theMath.max(0, ...)arm)Test-only, no production change.
Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #7793).Validation
git diff --checknpm run actionlint- no workflow files touched.npm run ui:typecheck(clean across both UI workspaces)@loopover/ui-minersuite: 33 files / 378 tests pass, including the 10 new ones.npm run test:coverage/test:workers/build:mcp/test:mcp-pack/ui:openapi:check- not run: this adds a single test file underapps/loopover-miner-ui/and touches no backend, worker, MCP, or OpenAPI surface.npm audit --audit-level=moderate- no dependency changes.If any required check was skipped, explain why:
src/**lines modified, socodecov/patchhas no changed lines to score. Per the issue,apps/loopover-miner-uiis outside thesrc/**99% patch gate - this new test file is the issue's own coverage deliverable.ui:lintcould not be run meaningfully on this Windows checkout:core.autocrlf=truemakes prettier reportDelete CRon every file in the repo (including files this PR never touches), so its output is not a signal here. The new file is written with LF endings and is clean undereslintonce that CRLF noise is excluded.Safety
UI Evidencesection - n/a: this is a test-only change with no visible UI difference.Notes
HTMLElementrather than a real DOM node, because jsdom cannot setscrollHeight/clientHeighton a real element - which is precisely why the existingmessage-listtest could not cover this math.