mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 03:29:39 +08:00
fix: Transfer disabled should work correctly
* fix: fix #18848 * chore: add test case
This commit is contained in:
parent
1acd7e2249
commit
7404a7ea32
@ -144,6 +144,18 @@ describe('Transfer', () => {
|
||||
expect(handleSelectChange).toHaveBeenLastCalledWith(['a'], ['b']);
|
||||
});
|
||||
|
||||
it('should not check checkbox when component disabled', () => {
|
||||
const handleSelectChange = jest.fn();
|
||||
const wrapper = mount(
|
||||
<Transfer {...listCommonProps} disabled onSelectChange={handleSelectChange} />,
|
||||
);
|
||||
wrapper
|
||||
.find(TransferItem)
|
||||
.filterWhere(n => n.prop('item').key === 'a')
|
||||
.simulate('click');
|
||||
expect(handleSelectChange).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not check checkbox when click on disabled item', () => {
|
||||
const handleSelectChange = jest.fn();
|
||||
const wrapper = mount(<Transfer {...listCommonProps} onSelectChange={handleSelectChange} />);
|
||||
|
@ -68,7 +68,14 @@ class ListBody extends React.Component<TransferListBodyProps> {
|
||||
|
||||
render() {
|
||||
const { mounted } = this.state;
|
||||
const { prefixCls, onScroll, filteredRenderItems, lazy, selectedKeys } = this.props;
|
||||
const {
|
||||
prefixCls,
|
||||
onScroll,
|
||||
filteredRenderItems,
|
||||
lazy,
|
||||
selectedKeys,
|
||||
disabled: globalDisabled,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<Animate
|
||||
@ -84,7 +91,7 @@ class ListBody extends React.Component<TransferListBodyProps> {
|
||||
|
||||
return (
|
||||
<ListItem
|
||||
disabled={disabled}
|
||||
disabled={globalDisabled || disabled}
|
||||
key={item.key}
|
||||
item={item}
|
||||
lazy={lazy}
|
||||
|
Loading…
Reference in New Issue
Block a user