Skip to content

Commit 8d9fb90

Browse files
authored
feat(make-selectable): expose selectToggle function (#3109)
* feat(make-selectable): expose selectToggle function * feat(make-selectable): expose selectToggle function
1 parent 5d5b314 commit 8d9fb90

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/components/table/__tests__/makeSelectable.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,7 @@ describe('components/table/makeSelectable', () => {
12241224

12251225
const table = wrapper.find('Table');
12261226
expect(table.hasClass('is-selectable')).toBe(true);
1227+
expect(table.prop('onCheckboxClick')).toEqual(instance.onCheckboxClick);
12271228
expect(table.prop('onRowClick')).toEqual(wrapper.instance().handleRowClick);
12281229
expect(table.prop('onRowFocus')).toEqual(wrapper.instance().handleRowFocus);
12291230
expect(table.prop('focusedItem')).toEqual('b');

src/components/table/makeSelectable.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,10 @@ function makeSelectable(BaseTable) {
569569
}
570570
};
571571

572+
onCheckboxClick = (event, index) => {
573+
this.selectToggle(index);
574+
};
575+
572576
render() {
573577
const { className, data } = this.props;
574578
const { focusedIndex } = this.state;
@@ -581,6 +585,7 @@ function makeSelectable(BaseTable) {
581585
className={classNames(className, 'is-selectable')}
582586
focusedIndex={focusedIndex}
583587
focusedItem={focusedItem}
588+
onCheckboxClick={this.onCheckboxClick}
584589
onRowClick={this.handleRowClick}
585590
onRowFocus={this.handleRowFocus}
586591
onTableBlur={this.handleTableBlur}

0 commit comments

Comments
 (0)