Skip to content
Source
Sign inSign up
Open History to see the last commit

fileLineReveal.test.ts

19 lines573 Bytes

1import { describe, expect, it } from "vite-plus/test";
2​
3import { resolveCenteredFileLineScrollTop } from "./fileLineReveal";
4​
5describe("resolveCenteredFileLineScrollTop", () => {
6 it("corrects a stale estimate from the rendered line geometry", () => {
7 expect(
8 resolveCenteredFileLineScrollTop({
9 scrollTop: 830,
10 scrollHeight: 2_000,
11 viewportTop: 100,
12 viewportHeight: 400,
13 fileTop: 20,
14 estimatedLine: { top: 1_000, height: 20 },
15 renderedLine: { top: 620, height: 20 },
16 }),
17 ).toBe(1_160);
18 });
19});