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

Function setupColSpan

test/browser/column/colSpan.test.ts:7–38  ·  view source on GitHub ↗
(colCount = 15)

Source from the content-addressed store, hash-verified

5
6describe('colSpan', () => {
7 function setupColSpan(colCount = 15) {
8 type Row = number;
9 const columns: Column<Row, Row>[] = [];
10 const rows: readonly Row[] = Array.from({ length: 10 }, (_, i) => i);
11
12 for (let i = 0; i < colCount; i++) {
13 const key = String(i);
14 columns.push({
15 key,
16 name: key,
17 width: 80,
18 frozen: i < 5,
19 colSpan(args) {
20 if (args.type === 'ROW') {
21 if (key === '2' && args.row === 2) return 3;
22 if (key === '4' && args.row === 4) return 6; // Will not work as colspan includes both frozen and regular columns
23 if (key === '0' && args.row === 5) return 5;
24 if (key === `${colCount - 3}` && args.row === 8) return 3;
25 if (key === '6' && args.row < 8) return 2;
26 }
27 if (args.type === 'HEADER' && key === '8') {
28 return 3;
29 }
30 if (args.type === 'SUMMARY' && key === '7' && args.row === 1) {
31 return 2;
32 }
33 return undefined;
34 }
35 });
36 }
37 return setup({ columns, rows, bottomSummaryRows: [1, 2], topSummaryRows: [1, 2] });
38 }
39
40 it('should merges cells', async () => {
41 await setupColSpan();

Callers 1

colSpan.test.tsFile · 0.85

Calls 1

setupFunction · 0.90

Tested by

no test coverage detected