|
|
@ -252,6 +252,33 @@ describe('Table.rowSelection', () => { |
|
|
|
expect(dropdownWrapper.find('.ant-dropdown-menu-item').length).toBe(2); |
|
|
|
}); |
|
|
|
|
|
|
|
it('handle custom selection onSelect correctly when hide default selection options', () => { |
|
|
|
const handleSelectOdd = jest.fn(); |
|
|
|
const handleSelectEven = jest.fn(); |
|
|
|
const rowSelection = { |
|
|
|
hideDefaultSelections: true, |
|
|
|
selections: [{ |
|
|
|
key: 'odd', |
|
|
|
text: '奇数项', |
|
|
|
onSelect: handleSelectOdd, |
|
|
|
}, { |
|
|
|
key: 'even', |
|
|
|
text: '偶数项', |
|
|
|
onSelect: handleSelectEven, |
|
|
|
}], |
|
|
|
}; |
|
|
|
const wrapper = mount(createTable({ rowSelection })); |
|
|
|
|
|
|
|
const dropdownWrapper = mount(wrapper.find('Trigger').node.getComponent()); |
|
|
|
expect(dropdownWrapper.find('.ant-dropdown-menu-item').length).toBe(2); |
|
|
|
|
|
|
|
dropdownWrapper.find('.ant-dropdown-menu-item > div').at(0).simulate('click'); |
|
|
|
expect(handleSelectOdd).toBeCalledWith([0, 1, 2, 3]); |
|
|
|
|
|
|
|
dropdownWrapper.find('.ant-dropdown-menu-item > div').at(1).simulate('click'); |
|
|
|
expect(handleSelectEven).toBeCalledWith([0, 1, 2, 3]); |
|
|
|
}); |
|
|
|
|
|
|
|
// https://github.com/ant-design/ant-design/issues/4245
|
|
|
|
it('handles disabled checkbox correctly when dataSource changes', () => { |
|
|
|
const rowSelection = { |
|
|
|