Skip to content

Commit

Permalink
feat: support name prop (#574)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wxh16144 authored Aug 30, 2024
1 parent aa2e1dd commit d94d644
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/AjaxUploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ class AjaxUploader extends Component<UploadProps> {
classNames = {},
disabled,
id,
name,
style,
styles = {},
multiple,
Expand Down Expand Up @@ -307,6 +308,7 @@ class AjaxUploader extends Component<UploadProps> {
<input
{...pickAttrs(otherProps, { aria: true, data: true })}
id={id}
name={name}
disabled={disabled}
type="file"
ref={this.saveFileInput}
Expand Down
1 change: 0 additions & 1 deletion src/Upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class Upload extends Component<UploadProps> {
prefixCls: 'rc-upload',
data: {},
headers: {},
name: 'file',
multipart: false,
onStart: empty,
onError: empty,
Expand Down
6 changes: 6 additions & 0 deletions tests/uploader.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<Upload name="bamboo" />);
expect(container.querySelector('input')!.name).toBe('bamboo');
});

it('should pass through data & aria attributes', () => {
const { container } = render(
<Upload
Expand Down

0 comments on commit d94d644

Please sign in to comment.