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

Function setup

lib/utils/scrollElement.test.ts:7–26  ·  view source on GitHub ↗
({
    overflow,
    scrollHeight
  }: {
    overflow: string;
    scrollHeight: number;
  })

Source from the content-addressed store, hash-verified

5
6describe("isSelfScrolling", () => {
7 function setup({
8 overflow,
9 scrollHeight
10 }: {
11 overflow: string;
12 scrollHeight: number;
13 }) {
14 const element = document.createElement("div");
15 // jsdom doesn't expand the overflow shorthand
16 element.style.overflowY = overflow;
17 document.body.appendChild(element);
18
19 mockLayout((target) =>
20 target === element
21 ? { height: 100, left: 0, scrollHeight, top: 0, width: 100 }
22 : undefined
23 );
24
25 return element;
26 }
27
28 test("should be true if content overflows a scrolling element", () => {
29 const element = setup({ overflow: "auto", scrollHeight: 200 });

Callers 1

Calls 1

mockLayoutFunction · 0.90

Tested by

no test coverage detected