fix(app): home page scroll target (#36664)
Co-authored-by: Jay V <air@live.ca> Co-authored-by: Brendan Allan <git@brendonovich.dev>
This commit is contained in:
@@ -72,4 +72,19 @@ describe("scrollTopFromThumbPointer", () => {
|
||||
expect(scrollTopFromThumbPointer({ ...input, pointer: 0 })).toBe(0)
|
||||
expect(scrollTopFromThumbPointer({ ...input, pointer: 1_000 })).toBe(5_400)
|
||||
})
|
||||
|
||||
test("uses scrollClientHeight when the thumb track differs from the viewport", () => {
|
||||
const input = {
|
||||
pointer: 400,
|
||||
viewportTop: 100,
|
||||
grabOffset: 0,
|
||||
clientHeight: 400,
|
||||
scrollClientHeight: 800,
|
||||
scrollHeight: 8_000,
|
||||
thumbHeight: 40,
|
||||
}
|
||||
// track usable = 400 - 16 - 40 = 344; thumbTop = 400 - 100 - 8 = 292
|
||||
// maxScroll = 8000 - 800 = 7200 → 292/344 * 7200
|
||||
expect(scrollTopFromThumbPointer(input)).toBeCloseTo((292 / 344) * 7200)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user