fix(app): stabilize session timeline layout continuity (#34533)

This commit is contained in:
Luke Parker
2026-07-02 12:36:47 +10:00
committed by GitHub
parent f9ec0e2962
commit 24cb30e931
57 changed files with 6159 additions and 142 deletions
+22 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test"
import { scrollKey, scrollTopFromThumbPointer } from "./scroll-view"
import { canScrollKey, scrollKey, scrollTopFromThumbPointer } from "./scroll-view"
describe("scrollKey", () => {
test("maps plain navigation keys", () => {
@@ -16,6 +16,27 @@ describe("scrollKey", () => {
expect(scrollKey({ key: "PageUp", altKey: false, ctrlKey: true, metaKey: false, shiftKey: false })).toBeUndefined()
expect(scrollKey({ key: "End", altKey: false, ctrlKey: false, metaKey: false, shiftKey: true })).toBeUndefined()
})
test("maps space and shift-space directions", () => {
expect(scrollKey({ key: " ", altKey: false, ctrlKey: false, metaKey: false, shiftKey: false })).toBe("page-down")
expect(scrollKey({ key: " ", altKey: false, ctrlKey: false, metaKey: false, shiftKey: true })).toBe("page-up")
})
})
describe("canScrollKey", () => {
const element = (scrollTop: number, clientHeight = 100, scrollHeight = 300) =>
({ scrollTop, clientHeight, scrollHeight }) as HTMLElement
test("owns upward keys only above the top boundary", () => {
expect(canScrollKey(element(50), "page-up")).toBe(true)
expect(canScrollKey(element(0), "page-up")).toBe(false)
})
test("owns downward keys only before the bottom boundary", () => {
expect(canScrollKey(element(50), "page-down")).toBe(true)
expect(canScrollKey(element(200), "page-down")).toBe(false)
expect(canScrollKey(element(0, 100, 100), "page-down")).toBe(false)
})
})
describe("scrollTopFromThumbPointer", () => {