diff --git a/components/upload/UploadList/index.tsx b/components/upload/UploadList/index.tsx index db1ad1ffe4..57b6961244 100644 --- a/components/upload/UploadList/index.tsx +++ b/components/upload/UploadList/index.tsx @@ -136,10 +136,9 @@ const InternalUploadList: React.ForwardRefRenderFunction { unmount(); }); - it('disabled should not affect preview and download icon', () => { + describe('disabled should not affect preview and download icon', () => { const list = [ { name: 'image', @@ -618,7 +618,18 @@ describe('Upload List', () => { }, ]; - const { container: wrapper, unmount } = render( + const check = (wrapper: HTMLElement) => { + const actionEls = wrapper.querySelectorAll('.ant-upload-list-item-actions > *'); + expect(actionEls).toHaveLength(3); + // preview icon + expect(actionEls[0]).not.toBeDisabled(); + // download icon + expect(actionEls[1]).not.toBeDisabled(); + // delete icon + expect(actionEls[2]).toBeDisabled(); + }; + + const InnerUploadList = (props: Partial) => ( { showDownloadIcon: true, showRemoveIcon: true, }} - disabled + {...props} > - , + ); - // preview icon - expect( - wrapper.querySelectorAll('.ant-upload-list-item-actions > *')[0].hasAttribute('disabled'), - ).toBeFalsy(); - // download icon - expect( - wrapper.querySelectorAll('.ant-upload-list-item-actions > *')[1].hasAttribute('disabled'), - ).toBeFalsy(); - // delete icon - expect( - wrapper.querySelectorAll('.ant-upload-list-item-actions > *')[2].hasAttribute('disabled'), - ).toBeTruthy(); - unmount(); + // https://github.com/ant-design/ant-design/issues/46171 + it('normal', () => { + const { container: wrapper } = render(); + check(wrapper); + }); + + // https://github.com/ant-design/ant-design/issues/53503 + it('in Form', () => { + const { container: wrapper } = render( +
+ + + +
, + ); + check(wrapper); + }); }); it('should support custom onClick in custom icon', async () => {