32 lines · 901 B · TypeScript
RawDownload
import { describe, expect, it } from "vite-plus/test"; import { resolveCenteredFileLineScrollTop } from "./fileLineReveal"; describe("resolveCenteredFileLineScrollTop", () => {  it("centers an estimated virtualized line position", () => {    expect(      resolveCenteredFileLineScrollTop({        scrollTop: 0,        scrollHeight: 2_000,        viewportTop: 100,        viewportHeight: 400,        fileTop: 20,        estimatedLine: { top: 1_000, height: 20 },      }),    ).toBe(830);  });   it("corrects a stale estimate from the rendered line geometry", () => {    expect(      resolveCenteredFileLineScrollTop({        scrollTop: 830,        scrollHeight: 2_000,        viewportTop: 100,        viewportHeight: 400,        fileTop: 20,        estimatedLine: { top: 1_000, height: 20 },        renderedLine: { top: 620, height: 20 },      }),    ).toBe(1_160);  });});

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t