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

Function setup

lib/scrollElement.test.tsx:64–88  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62 const ROW_COUNT = 100;
63
64 function setup() {
65 const windowScroll = mockWindowScroll({ height: 100, width: 50 });
66
67 mockLayout((element) => {
68 if (element === document.documentElement) {
69 return {
70 height: 100,
71 left: 0,
72 scrollHeight: LIST_PAGE_TOP + ROW_HEIGHT * ROW_COUNT,
73 top: 0,
74 width: 50
75 };
76 }
77 if (element.getAttribute("role") === "list") {
78 return {
79 height: ROW_HEIGHT * ROW_COUNT,
80 left: 0,
81 top: LIST_PAGE_TOP - windowScroll.position.y,
82 width: 50
83 };
84 }
85 });
86
87 return windowScroll;
88 }
89
90 test("should render the rows visible within the window", () => {
91 const windowScroll = setup();

Callers 1

Calls 2

mockWindowScrollFunction · 0.90
mockLayoutFunction · 0.90

Tested by

no test coverage detected