[test] test for RowSelectionWrapper#componentWillReceiveProps

This commit is contained in:
Chun-MingChen 2018-03-17 17:25:20 +08:00
parent ceebdf5a13
commit d80ae13513

View File

@ -68,7 +68,18 @@ describe('RowSelectionWrapper', () => {
expect(wrapper.props().onAllRowsSelect).toBeDefined();
});
describe('when selectRow.selected is defiend', () => {
describe('componentWillReceiveProps', () => {
const nextSelected = [0];
const nextProps = { store: { selected: nextSelected } };
it('should update state.selectedRowKeys with next selected rows', () => {
wrapper.instance().componentWillReceiveProps(nextProps);
expect(wrapper.state('selectedRowKeys')).toEqual(nextSelected);
});
});
describe('when selectRow.selected is defined', () => {
beforeEach(() => {
selectRow.mode = 'checkbox';
selectRow.selected = [1, 3];