diff --git a/packages/react-bootstrap-table2/src/row-selection/selection-cell.js b/packages/react-bootstrap-table2/src/row-selection/selection-cell.js index 3c4da56..5e8b27c 100644 --- a/packages/react-bootstrap-table2/src/row-selection/selection-cell.js +++ b/packages/react-bootstrap-table2/src/row-selection/selection-cell.js @@ -43,12 +43,10 @@ export default class SelectionCell extends Component { selected, onRowSelect, disabled, - rowIndex, - clickToSelect + rowIndex } = this.props; - + e.stopPropagation(); if (disabled) return; - if (clickToSelect) return; const checked = inputType === Const.ROW_SELECT_SINGLE ? true diff --git a/packages/react-bootstrap-table2/test/row-selection/selection-cell.test.js b/packages/react-bootstrap-table2/test/row-selection/selection-cell.test.js index 85a6c00..ce332e3 100644 --- a/packages/react-bootstrap-table2/test/row-selection/selection-cell.test.js +++ b/packages/react-bootstrap-table2/test/row-selection/selection-cell.test.js @@ -147,7 +147,7 @@ describe('', () => { />, { bootstrap4: false } ); - wrapper.find('td').simulate('click'); + wrapper.find('td').simulate('click', { stopPropagation: jest.fn() }); }); it('should calling handleRowClicked', () => { @@ -173,7 +173,7 @@ describe('', () => { />, { bootstrap4: false } ); - wrapper.find('td').simulate('click'); + wrapper.find('td').simulate('click', { stopPropagation: jest.fn() }); }); it('should calling handleRowClicked', () => { @@ -201,7 +201,7 @@ describe('', () => { it('should be called with correct paramters', () => { // first click - wrapper.find('td').simulate('click'); + wrapper.find('td').simulate('click', { stopPropagation: jest.fn() }); expect(mockOnRowSelect.callCount).toBe(1); expect(mockOnRowSelect.calledWith(rowKey, true, rowIndex)).toBe(true); }); @@ -223,9 +223,9 @@ describe('', () => { it('should be called with correct parameters', () => { // first click - wrapper.find('td').simulate('click'); + wrapper.find('td').simulate('click', { stopPropagation: jest.fn() }); expect(mockOnRowSelect.callCount).toBe(1); - expect(mockOnRowSelect.calledWith(rowKey, false, rowIndex, undefined)).toBe(true); + expect(mockOnRowSelect.calledWith(rowKey, false, rowIndex)).toBe(true); }); }); });