Skip to content

Commit

Permalink
Prettify files in preparation for release
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielliwerant committed Jul 14, 2019
1 parent 51ba140 commit 2a57aa9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/components/TableBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ class TableBody extends React.Component {
}

// Check if we should toggle row select when row is clicked anywhere
if (this.props.options.selectableRowsOnClick && this.props.options.selectableRows !== 'none' && this.isRowSelectable(data.dataIndex)) {
if (
this.props.options.selectableRowsOnClick &&
this.props.options.selectableRows !== 'none' &&
this.isRowSelectable(data.dataIndex)
) {
const selectRow = { index: data.rowIndex, dataIndex: data.dataIndex };
this.handleRowSelect(selectRow);
}
Expand All @@ -128,7 +132,10 @@ class TableBody extends React.Component {
}

// Don't trigger onRowClick if the event was actually a row selection
if (event.target.id && event.target.id.startsWith('MUIDataTableSelectCell') || this.props.options.selectableRowsOnClick) {
if (
(event.target.id && event.target.id.startsWith('MUIDataTableSelectCell')) ||
this.props.options.selectableRowsOnClick
) {
return;
}

Expand Down
6 changes: 5 additions & 1 deletion test/MUIDataTableBody.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,11 @@ describe('<TableBody />', function() {

it('should not gather selected row data when clicking row with selectableRowsOnClick=true when it is disabled with isRowSelectable.', () => {
let selectedRowData;
const options = { selectableRows: true, selectableRowsOnClick: true, isRowSelectable: dataIndex => dataIndex === 2 ? false : true };
const options = {
selectableRows: true,
selectableRowsOnClick: true,
isRowSelectable: dataIndex => (dataIndex === 2 ? false : true),
};
const selectRowUpdate = (type, data) => (selectedRowData = data);
const toggleExpandRow = spy();

Expand Down

0 comments on commit 2a57aa9

Please sign in to comment.