Skip to content

Commit 2c6cc91

Browse files
committed
fix #932
1 parent a1457df commit 2c6cc91

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

packages/react-bootstrap-table2/src/row-selection/selection-cell.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,10 @@ export default class SelectionCell extends Component {
4343
selected,
4444
onRowSelect,
4545
disabled,
46-
rowIndex,
47-
clickToSelect
46+
rowIndex
4847
} = this.props;
49-
48+
e.stopPropagation();
5049
if (disabled) return;
51-
if (clickToSelect) return;
5250

5351
const checked = inputType === Const.ROW_SELECT_SINGLE
5452
? true

packages/react-bootstrap-table2/test/row-selection/selection-cell.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ describe('<SelectionCell />', () => {
147147
/>,
148148
{ bootstrap4: false }
149149
);
150-
wrapper.find('td').simulate('click');
150+
wrapper.find('td').simulate('click', { stopPropagation: jest.fn() });
151151
});
152152

153153
it('should calling handleRowClicked', () => {
@@ -173,7 +173,7 @@ describe('<SelectionCell />', () => {
173173
/>,
174174
{ bootstrap4: false }
175175
);
176-
wrapper.find('td').simulate('click');
176+
wrapper.find('td').simulate('click', { stopPropagation: jest.fn() });
177177
});
178178

179179
it('should calling handleRowClicked', () => {
@@ -201,7 +201,7 @@ describe('<SelectionCell />', () => {
201201

202202
it('should be called with correct paramters', () => {
203203
// first click
204-
wrapper.find('td').simulate('click');
204+
wrapper.find('td').simulate('click', { stopPropagation: jest.fn() });
205205
expect(mockOnRowSelect.callCount).toBe(1);
206206
expect(mockOnRowSelect.calledWith(rowKey, true, rowIndex)).toBe(true);
207207
});
@@ -223,9 +223,9 @@ describe('<SelectionCell />', () => {
223223

224224
it('should be called with correct parameters', () => {
225225
// first click
226-
wrapper.find('td').simulate('click');
226+
wrapper.find('td').simulate('click', { stopPropagation: jest.fn() });
227227
expect(mockOnRowSelect.callCount).toBe(1);
228-
expect(mockOnRowSelect.calledWith(rowKey, false, rowIndex, undefined)).toBe(true);
228+
expect(mockOnRowSelect.calledWith(rowKey, false, rowIndex)).toBe(true);
229229
});
230230
});
231231
});

0 commit comments

Comments
 (0)