Mailspring/app/spec/fixtures/table-data.ts

54 lines
1.2 KiB
TypeScript
Raw Normal View History

2017-09-27 02:46:00 +08:00
import { Table } from 'mailspring-component-kit';
export const testData = {
columns: ['col1', 'col2', 'col3'],
2017-09-27 02:33:08 +08:00
rows: [[1, 2, 3], [4, 5, 6], [7, 8, 9]],
};
export const testDataUneven = {
columns: ['col1', 'col2', 'col3'],
2017-09-27 02:33:08 +08:00
rows: [[1, 2], [4, 5, 6], [7, 8]],
};
export const testDataEmpty = {
columns: ['col1', 'col2', ''],
2017-09-27 02:33:08 +08:00
rows: [[1, 2], [4, 5, 6], ['', ''], []],
};
class TestSource extends Table.TableDataSource {
setRows(rows) {
const data = {
rows: [...rows],
columns: this.columns(),
2017-09-27 02:33:08 +08:00
};
return new TestSource(data);
}
}
2017-09-27 02:33:08 +08:00
export const testDataSource = new TestSource(testData);
2017-09-27 02:33:08 +08:00
export const testDataSourceUneven = new TestSource(testDataUneven);
2017-09-27 02:33:08 +08:00
export const testDataSourceEmpty = new TestSource(testDataEmpty);
2017-09-27 02:33:08 +08:00
export const selection = { colIdx: 0, rowIdx: 0, key: null };
2017-09-27 02:33:08 +08:00
export const cellProps = {
tableDataSource: testDataSource,
selection,
colIdx: 0,
rowIdx: 0,
onSetSelection: () => {},
onCellEdited: () => {},
};
2017-09-27 02:33:08 +08:00
export const rowProps = { tableDataSource: testDataSource, selection, rowIdx: 0 };
2017-09-27 02:33:08 +08:00
export const tableProps = {
tableDataSource: testDataSource,
selection,
onSetSelection: () => {},
onShiftSelection: () => {},
onCellEdited: () => {},
};