MCPcopy
hub / github.com/Comcast/react-data-grid / setupGrid

Function setupGrid

test/browser/virtualization.test.ts:6–36  ·  view source on GitHub ↗
(
  enableVirtualization: boolean,
  columnCount: number,
  rowCount: number,
  frozenColumnCount = 0,
  summaryRowCount = 0
)

Source from the content-addressed store, hash-verified

4const rowHeight = 35;
5
6function setupGrid(
7 enableVirtualization: boolean,
8 columnCount: number,
9 rowCount: number,
10 frozenColumnCount = 0,
11 summaryRowCount = 0
12) {
13 const columns: Column<unknown>[] = [];
14 const rows = new Array(rowCount);
15 const topSummaryRows = new Array(summaryRowCount).fill(null);
16 const bottomSummaryRows = new Array(summaryRowCount).fill(null);
17
18 for (let i = 0; i < columnCount; i++) {
19 const key = String(i);
20 columns.push({
21 key,
22 name: key,
23 width: 100 + ((i * 10) % 50),
24 frozen: i < frozenColumnCount
25 });
26 }
27
28 return setup({
29 columns,
30 rows,
31 topSummaryRows,
32 bottomSummaryRows,
33 rowHeight,
34 enableVirtualization
35 });
36}
37
38function assertElements(
39 elements: Element[],

Callers 1

Calls 1

setupFunction · 0.90

Tested by

no test coverage detected