( tableId: Id = 't1', cellIdSuffix = '', stringSuffix = '', numberPrefix = '', )
| 17 | }); |
| 18 | |
| 19 | const setCells = ( |
| 20 | tableId: Id = 't1', |
| 21 | cellIdSuffix = '', |
| 22 | stringSuffix = '', |
| 23 | numberPrefix = '', |
| 24 | ) => { |
| 25 | const cellId = (cellId: Id) => `${cellId}${cellIdSuffix}`; |
| 26 | const string = (string: Id) => `${string}${stringSuffix}`; |
| 27 | const number = (number: number) => |
| 28 | numberPrefix === '' ? number : `${numberPrefix}${number}`; |
| 29 | |
| 30 | const r1 = { |
| 31 | [cellId('c1')]: string('one'), |
| 32 | [cellId('c2')]: string('odd'), |
| 33 | [cellId('c3')]: number(1), |
| 34 | }; |
| 35 | |
| 36 | if (store.hasTables()) { |
| 37 | store.setRow(tableId, 'r1', r1); |
| 38 | } else { |
| 39 | store.setTables({[tableId]: {r1}}); |
| 40 | } |
| 41 | store |
| 42 | .setTable(tableId, { |
| 43 | r2: { |
| 44 | [cellId('c1')]: string('two'), |
| 45 | [cellId('c2')]: string('even'), |
| 46 | [cellId('c3')]: number(2), |
| 47 | }, |
| 48 | r3: { |
| 49 | [cellId('c1')]: string('three'), |
| 50 | [cellId('c2')]: string('odd'), |
| 51 | [cellId('c3')]: number(3), |
| 52 | }, |
| 53 | }) |
| 54 | .setRow(tableId, 'r1', r1) |
| 55 | .setCell(tableId, 'r4', cellId('c1'), string('four')) |
| 56 | .setCell(tableId, 'r4', cellId('c2'), string('even')) |
| 57 | .setCell(tableId, 'r4', cellId('c3'), number(4)); |
| 58 | }; |
| 59 | |
| 60 | const delCells = (tableId: Id = 't1') => { |
| 61 | const cellId = (cellId: Id, cellIdSuffix = '') => `${cellId}${cellIdSuffix}`; |
no test coverage detected
searching dependent graphs…