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

Function getRowTop

integrations/tests/tests/scroll-element.spec.tsx:72–84  ·  view source on GitHub ↗
(page: Page, index: number, scrollerSelector?: string)

Source from the content-addressed store, hash-verified

70}
71
72async function getRowTop(page: Page, index: number, scrollerSelector?: string) {
73 return page.evaluate(
74 ({ index, scrollerSelector }) => {
75 const row = document.querySelector(`[data-index="${index}"]`);
76 if (!row) return null;
77 const viewTop = scrollerSelector
78 ? document.querySelector(scrollerSelector)!.getBoundingClientRect().top
79 : 0;
80 return row.getBoundingClientRect().top - viewTop;
81 },
82 { index, scrollerSelector }
83 );
84}
85
86test.describe("List with window scrollElement", () => {
87 test("renders the rows visible within the window as the page scrolls", async ({

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected