Skip to content

Commit

Permalink
Add test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrzej Skrodzki authored and Andrzej Skrodzki committed Aug 10, 2019
1 parent e44fa14 commit f2681f8
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/MUIDataTableBody.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,4 +493,32 @@ describe('<TableBody />', function() {

expect(html).to.contain('Test_Text');
});

it('should not call onRowClick when maxSelectedRows rows is reached', () => {
const options = { selectableRows: true, maxSelectedRows: 1 };
const selectedIndex = 0;
const selectedRows = { data: [selectedIndex], lookup: {[selectedIndex]: true }};

const mountWrapper = mount(
<TableBody
data={displayData}
count={displayData.length}
columns={columns}
page={0}
rowsPerPage={10}
selectedRows={selectedRows}
expandedRows={[]}
options={options}
searchText={''}
filterList={[]}
/>,
);

const tableSelectCellsProps = mountWrapper.find('TableSelectCell').map(t => t.props());

tableSelectCellsProps.forEach((props, i) => {
assert.equal(props.checked, i === selectedIndex);
assert.equal(props.isRowSelectable, i === selectedIndex);
});
});
});

0 comments on commit f2681f8

Please sign in to comment.