From d32a29093b238356503d20639a12a63e248ad88c 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 10:28:27 +0800 Subject: [PATCH] feat: support `name` prop (#574) (cherry picked from commit d94d644f61457098a1c57542519337d20acc91d9) --- src/AjaxUploader.tsx | 2 ++ src/Upload.tsx | 1 - tests/uploader.spec.tsx | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) 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 { { prefixCls: 'rc-upload', data: {}, headers: {}, - name: 'file', multipart: false, onStart: empty, onError: empty, diff --git a/tests/uploader.spec.tsx b/tests/uploader.spec.tsx index 68a8208..344a61d 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(