mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2026-07-01 14:40:02 +00:00
should recieve newest selectRow.selected
This commit is contained in:
@@ -30,8 +30,9 @@ export default Base =>
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
nextProps.store.selected = nextProps.selectRow.selected || [];
|
||||
this.setState(() => ({
|
||||
selectedRowKeys: nextProps.store.selected
|
||||
selectedRowKeys: nextProps.selectRow.selected
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -70,11 +70,19 @@ describe('RowSelectionWrapper', () => {
|
||||
|
||||
describe('componentWillReceiveProps', () => {
|
||||
const nextSelected = [0];
|
||||
const nextProps = { store: { selected: nextSelected } };
|
||||
const nextProps = {
|
||||
store: {
|
||||
selected: nextSelected
|
||||
},
|
||||
selectRow: {
|
||||
mode: 'checkbox',
|
||||
selected: nextSelected
|
||||
}
|
||||
};
|
||||
|
||||
it('should update state.selectedRowKeys with next selected rows', () => {
|
||||
wrapper.instance().componentWillReceiveProps(nextProps);
|
||||
|
||||
expect(nextProps.store.selected).toEqual(nextSelected);
|
||||
expect(wrapper.state('selectedRowKeys')).toEqual(nextSelected);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user