The tab capped the browser column at the left cards' height bounded by the host scrollport's slice from the card's top edge; that slice added the scroll offset on top of rect coordinates, so a scrolled or short pane clamped the card far below the left column — an empty gap under the composition + trend cards. Cap the column at the left cards' measured span alone (first card top to last card bottom, rounded up): the row's stretch then makes it the card's height, so it ends flush with the two cards at every width where they sit side by side, while the DNA feed still scrolls inside the card. Drop the pane-fit plumbing and its now-dead scrollport observation, and replace the README's stale three-times claim.
26 lines
1.2 KiB
TypeScript
26 lines
1.2 KiB
TypeScript
import assert from 'node:assert/strict'
|
|
import { describe, test } from 'vitest'
|
|
import { browserCapOf } from '../../../src/client/components/contextView'
|
|
|
|
describe('browserCapOf — the Context browser column\'s height ceiling', () => {
|
|
test('the span from the first left card\'s top to the last card\'s bottom, rounded UP', () => {
|
|
assert.equal(browserCapOf([{ top: 100, bottom: 280.4 }, { top: 287.4, bottom: 609 }]), 509)
|
|
// A fractional span rounds up: the card is never shorter than the cards beside it.
|
|
assert.equal(browserCapOf([{ top: 100, bottom: 280.4 }, { top: 287.4, bottom: 609.4 }]), 510)
|
|
})
|
|
|
|
test('no measurable card (the loading frame) leaves the column uncapped', () => {
|
|
assert.equal(browserCapOf([]), null)
|
|
})
|
|
|
|
test('a degenerate span leaves the column uncapped', () => {
|
|
assert.equal(browserCapOf([{ top: 0, bottom: 0 }]), null)
|
|
assert.equal(browserCapOf([{ top: 10, bottom: 5 }]), null)
|
|
})
|
|
|
|
test('a non-finite rect (a layout-less stub) leaves the column uncapped, not NaN', () => {
|
|
assert.equal(browserCapOf([{ top: Number.NaN, bottom: 10 }]), null)
|
|
assert.equal(browserCapOf([{ top: 0, bottom: undefined as unknown as number }]), null)
|
|
})
|
|
})
|