add csv tests

This commit is contained in:
Wlad Meixner
2020-04-09 21:56:01 +02:00
parent 0f8eab439d
commit cbd3b79dee
2 changed files with 38 additions and 1 deletions
+4 -1
View File
@@ -139,7 +139,10 @@ export interface ColumnDescription<T extends object = any, E = any> {
/**
* CSV Column options only used with the toolkit provider
*/
csvType?: String | Number;
/**
* export csv cell type can be Number or String
*/
csvType?: object;
csvFormatter?: ColumnFormatter<T, E>;
/**
* csvText defaults to column.text
@@ -107,6 +107,40 @@ render(
* Toolkit CSV export test
*/
const csvColumns: Array<ColumnDescription<Product>> = [
{ dataField: 'id', align: 'center', sort: true, text: 'Product ID' },
{ dataField: 'name', align: 'center', sort: true, text: 'Product Name' },
{
isDummyField: true,
dataField: '',
sort: true,
text: 'Product Name',
},
{
dataField: 'price',
sort: true,
formatter: priceFormatter,
text: 'Product Price',
headerFormatter: priceHeaderFormatter,
csvExport: false,
},
/**
* test optional dataField for dummyFields
*/
{
isDummyField: true,
dataField: '',
sort: true,
formatter: priceFormatter,
text: 'Product Price',
headerFormatter: priceHeaderFormatter,
csvType: Number,
csvFormatter: value => value,
csvText: 'Price',
csvExport: true,
},
];
render(
<ToolkitProvider
data={products}