[react-bootstrap-table-next] update tests

This commit is contained in:
Wlad Meixner
2020-03-15 21:08:54 +01:00
parent bc315cff97
commit f325fa557e
4 changed files with 20 additions and 18 deletions

View File

@@ -6,6 +6,7 @@ import BootstrapTable, {
HeaderFormatter,
ColumnDescription,
RowSelectionType,
ROW_SELECT_SINGLE,
} from 'react-bootstrap-table-next';
interface Product {
@@ -48,8 +49,8 @@ const priceFormatter: ColumnFormatter<Product, { indexSquare: number }> = (cell,
};
const productColumns: Array<ColumnDescription<Product>> = [
{ dataField: 'id', align: CellAlignment.center, sort: true, text: 'Product ID' },
{ dataField: 'name', align: CellAlignment.center, sort: true, text: 'Product Name' },
{ dataField: 'id', align: 'center', sort: true, text: 'Product ID' },
{ dataField: 'name', align: 'center', sort: true, text: 'Product Name' },
{
isDummyField: true,
dataField: '',
@@ -94,8 +95,8 @@ render(
hover={true}
keyField="id"
columns={[
{ dataField: 'id', align: CellAlignment.center, sort: true, text: 'Product ID' },
{ dataField: 'name', align: CellAlignment.center, sort: true, text: 'Product Name' },
{ dataField: 'id', align: 'center', sort: true, text: 'Product ID' },
{ dataField: 'name', align: 'center', sort: true, text: 'Product Name' },
{
isDummyField: true,
dataField: '',
@@ -115,6 +116,7 @@ render(
*/
{
isDummyField: true,
dataField: '',
sort: true,
formatter: priceFormatter,
text: 'Product Price',
@@ -152,7 +154,7 @@ render(
keyField="id"
columns={productColumns}
selectRow={{
mode: RowSelectionType.ROW_SELECT_SINGLE,
mode: ROW_SELECT_SINGLE,
}}
/>,
document.getElementById('app'),

View File

@@ -59,8 +59,8 @@ const priceFormatter: ColumnFormatter<Product, { indexSquare: number }> = (cell,
let priceFilter: any;
const productColumns: Array<ColumnDescription<Product>> = [
{ dataField: 'id', align: CellAlignment.center, sort: true, text: 'Product ID' },
{ dataField: 'name', align: CellAlignment.center, sort: true, text: 'Product Name' },
{ dataField: 'id', align: 'center', sort: true, text: 'Product ID' },
{ dataField: 'name', align: 'center', sort: true, text: 'Product Name' },
{
isDummyField: true,
dataField: '',
@@ -94,11 +94,9 @@ const productColumns: Array<ColumnDescription<Product>> = [
onFilter: filterValue => {},
}),
},
/**
* test optional dataField for dummyFields
*/
{
isDummyField: true,
dataField: '',
sort: true,
formatter: priceFormatter,
text: 'Product Price',
@@ -146,8 +144,8 @@ render(
keyField="id"
data={products}
columns={[
{ dataField: 'id', align: CellAlignment.center, sort: true, text: 'Product ID' },
{ dataField: 'name', align: CellAlignment.center, sort: true, text: 'Product Name' },
{ dataField: 'id', align: 'center', sort: true, text: 'Product ID' },
{ dataField: 'name', align: 'center', sort: true, text: 'Product Name' },
{
dataField: 'quality',
text: 'Product Quailty',
@@ -176,11 +174,11 @@ render(
keyField="id"
data={products}
columns={[
{ dataField: 'id', align: CellAlignment.center, sort: true, text: 'Product ID' },
{ dataField: 'id', align: 'center', sort: true, text: 'Product ID' },
{
dataField: 'name',
formatter: cell => cell,
align: CellAlignment.center,
align: 'center',
sort: true,
text: 'Product Name',
},

View File

@@ -49,8 +49,8 @@ const priceFormatter: ColumnFormatter<Product, { indexSquare: number }> = (cell,
};
const productColumns: Array<ColumnDescription<Product>> = [
{ dataField: 'id', align: CellAlignment.center, sort: true, text: 'Product ID' },
{ dataField: 'name', align: CellAlignment.center, sort: true, text: 'Product Name' },
{ dataField: 'id', align: 'center', sort: true, text: 'Product ID' },
{ dataField: 'name', align: 'center', sort: true, text: 'Product Name' },
{
isDummyField: true,
dataField: '',
@@ -69,6 +69,7 @@ const productColumns: Array<ColumnDescription<Product>> = [
*/
{
isDummyField: true,
dataField: '',
sort: true,
formatter: priceFormatter,
text: 'Product Price',

View File

@@ -50,8 +50,8 @@ const priceFormatter: ColumnFormatter<Product, { indexSquare: number }> = (cell,
};
const productColumns: Array<ColumnDescription<Product>> = [
{ dataField: 'id', align: CellAlignment.center, sort: true, text: 'Product ID' },
{ dataField: 'name', align: CellAlignment.center, sort: true, text: 'Product Name' },
{ dataField: 'id', align: 'center', sort: true, text: 'Product ID' },
{ dataField: 'name', align: 'center', sort: true, text: 'Product Name' },
{
isDummyField: true,
dataField: '',
@@ -70,6 +70,7 @@ const productColumns: Array<ColumnDescription<Product>> = [
*/
{
isDummyField: true,
dataField: '',
sort: true,
formatter: priceFormatter,
text: 'Product Price',