diff --git a/components/transfer/__tests__/index.test.js b/components/transfer/__tests__/index.test.js index 4d2261d65e..73fa4a3130 100644 --- a/components/transfer/__tests__/index.test.js +++ b/components/transfer/__tests__/index.test.js @@ -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( + , + ); + 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(); diff --git a/components/transfer/renderListBody.tsx b/components/transfer/renderListBody.tsx index bbe6f17517..111baaf28f 100644 --- a/components/transfer/renderListBody.tsx +++ b/components/transfer/renderListBody.tsx @@ -68,7 +68,14 @@ class ListBody extends React.Component { render() { const { mounted } = this.state; - const { prefixCls, onScroll, filteredRenderItems, lazy, selectedKeys } = this.props; + const { + prefixCls, + onScroll, + filteredRenderItems, + lazy, + selectedKeys, + disabled: globalDisabled, + } = this.props; return ( { return (