The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { describe, expect, it } from "vite-plus/test"; |
| 2 | |
| 3 | import { resolveWorkGroupScrollAnchor } from "./scrollAnchor.js"; |
| 4 | |
| 5 | describe("tool-group scroll anchors", () => { |
| 6 | const data = Array.from({ length: 18 }, (_, index) => ({ id: `call-${index}` })); |
| 7 | const state = { data, positionAtIndex: (index: number) => index * 33 }; |
| 8 | |
| 9 | it("returns to the top after a fast flick even when the cached start is five rows behind", () => { |
| 10 | const snapshot = { ...state, scroll: 0, start: 5 }; |
| 11 | expect(resolveWorkGroupScrollAnchor(snapshot)).toEqual({ |
| 12 | rowId: "call-0", |
| 13 | offsetWithinRow: 0, |
| 14 | scrollOffset: 0, |
| 15 | }); |
| 16 | }); |
| 17 | }); |