Skip to content

Commit 6c330b4

Browse files
authored
feat: support name prop drilling (#576)
1 parent 99cdc3e commit 6c330b4

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/AjaxUploader.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ class AjaxUploader extends Component<UploadProps> {
269269
classNames = {},
270270
disabled,
271271
id,
272+
name,
272273
style,
273274
styles = {},
274275
multiple,
@@ -307,6 +308,11 @@ class AjaxUploader extends Component<UploadProps> {
307308
<input
308309
{...pickAttrs(otherProps, { aria: true, data: true })}
309310
id={id}
311+
/**
312+
* https://github.com/ant-design/ant-design/issues/50643,
313+
* https://github.com/react-component/upload/pull/575#issuecomment-2320646552
314+
*/
315+
name={name}
310316
disabled={disabled}
311317
type="file"
312318
ref={this.saveFileInput}

tests/uploader.spec.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ describe('uploader', () => {
152152
expect(container.querySelector('input')!.id).toBe('bamboo');
153153
});
154154

155+
// https://github.com/ant-design/ant-design/issues/50643
156+
it('with name', () => {
157+
const { container } = render(<Upload name="bamboo" />);
158+
expect(container.querySelector('input')!.name).toBe('bamboo');
159+
});
160+
155161
it('should pass through data & aria attributes', () => {
156162
const { container } = render(
157163
<Upload

0 commit comments

Comments
 (0)