MCPcopy Create free account
hub / github.com/bvaughn/react-window / bounds

Function bounds

integrations/tests/tests/dynamic-scroll.spec.tsx:11–24  ·  view source on GitHub ↗
(page: Page, index: number)

Source from the content-addressed store, hash-verified

9}
10
11async function bounds(page: Page, index: number) {
12 return page.evaluate((index) => {
13 const list = document.querySelector('[role="list"]')!;
14 const row = list.querySelector(`[data-index="${index}"]`);
15 if (!row) return null;
16 const viewport = list.getBoundingClientRect();
17 const rect = row.getBoundingClientRect();
18 return {
19 top: rect.top - viewport.top,
20 bottom: rect.bottom - viewport.top,
21 center: (rect.top + rect.bottom) / 2 - viewport.top
22 };
23 }, index);
24}
25
26for (const scale of [0.5, 1, 2]) {
27 test(`settles promptly under ancestor scale ${scale}`, async ({ page }) => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected