Skip to content

Commit

Permalink
Add test for disableToolbarSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielliwerant committed Sep 25, 2019
1 parent 4aaa9ee commit 5400cbb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/MUIDataTable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import MUIDataTable from '../src/MUIDataTable';
import TableFilterList from '../src/components/TableFilterList';
import TablePagination from '../src/components/TablePagination';
import TableToolbar from '../src/components/TableToolbar';
import TableToolbarSelect from '../src/components/TableToolbarSelect';
import textLabels from '../src/textLabels';
import Chip from '@material-ui/core/Chip';
import Cities from '../examples/component/cities';
Expand Down Expand Up @@ -540,6 +541,18 @@ describe('<MUIDataTable />', function() {
assert.lengthOf(actualResult, 0);
});

it('should not render select toolbar when disableToolbarSelect=true', () => {
const options = { disableToolbarSelect: true };
const shallowWrapper = shallow(<MUIDataTable columns={columns} data={data} options={options} />).dive();
const instance = shallowWrapper.instance();

// Simulate a selection
instance.selectRowUpdate('cell', { index: 0, dataIndex: 0 });

const actualResult = shallowWrapper.find(TableToolbarSelect);
assert.lengthOf(actualResult, 0);
});

it('should properly set internal filterList when calling filterUpdate method with type=checkbox', () => {
const shallowWrapper = shallow(<MUIDataTable columns={columns} data={data} />);
const table = shallowWrapper.dive();
Expand Down

0 comments on commit 5400cbb

Please sign in to comment.