From 7579d5f06055f831898a9b263622f8bf9d3f27c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9D=91=BE=F0=9D=92=96=F0=9D=92=99=F0=9D=92=89?= Date: Fri, 30 Aug 2024 09:32:18 +0800 Subject: [PATCH 1/3] chore: add unit test --- tests/uploader.spec.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/uploader.spec.tsx b/tests/uploader.spec.tsx index efcb70d..bb94dd1 100644 --- a/tests/uploader.spec.tsx +++ b/tests/uploader.spec.tsx @@ -152,6 +152,12 @@ describe('uploader', () => { expect(container.querySelector('input')!.id).toBe('bamboo'); }); + // https://github.com/ant-design/ant-design/issues/50643 + it('with name', () => { + const { container } = render(); + expect(container.querySelector('input')!.name).toBe('bamboo'); + }); + it('should pass through data & aria attributes', () => { const { container } = render( Date: Fri, 30 Aug 2024 09:33:14 +0800 Subject: [PATCH 2/3] feat: support `name` prop --- src/AjaxUploader.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/AjaxUploader.tsx b/src/AjaxUploader.tsx index c8d4b9a..aded078 100644 --- a/src/AjaxUploader.tsx +++ b/src/AjaxUploader.tsx @@ -269,6 +269,7 @@ class AjaxUploader extends Component { classNames = {}, disabled, id, + name, style, styles = {}, multiple, @@ -307,6 +308,7 @@ class AjaxUploader extends Component { Date: Fri, 30 Aug 2024 09:55:41 +0800 Subject: [PATCH 3/3] chore: remove `name` defaultprop --- src/Upload.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Upload.tsx b/src/Upload.tsx index 23541e3..45c9d85 100644 --- a/src/Upload.tsx +++ b/src/Upload.tsx @@ -11,7 +11,6 @@ class Upload extends Component { prefixCls: 'rc-upload', data: {}, headers: {}, - name: 'file', multipart: false, onStart: empty, onError: empty,