Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const FileUploaderInput = (props: SpiritFileUploaderInputProps) => {
linkText,
maxFileSize = DEFAULT_FILE_SIZE_LIMIT,
maxUploadedFiles = DEFAULT_FILE_QUEUE_LIMIT,
name,
onError,
queueLimitBehavior = 'none',
validationState,
Expand Down Expand Up @@ -97,6 +98,7 @@ const FileUploaderInput = (props: SpiritFileUploaderInputProps) => {
accept={accept}
id={id}
ref={inputRef}
name={name}
className={classProps.input.input}
onChange={onChange}
multiple={isMultiple}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,16 @@ describe('FileUploaderInput', () => {
expect(element).toHaveTextContent('Upload File');
expect(element.innerHTML).toBe('Upload <b>File</b>');
});

it('should not have `name` attribute on root div element', () => {
render(<FileUploaderInput id="test-uploader" name="test-uploader" label="upload" data-testid="test" />);

const elements = screen.getAllByTestId('test');
const rootDiv = elements[0];
const input = document.querySelector('input[type="file"]') as HTMLInputElement;

expect(rootDiv).not.toHaveAttribute('name');
expect(rootDiv.localName).toBe('div');
expect(input).toHaveAttribute('name', 'test-uploader');
});
});
2 changes: 1 addition & 1 deletion packages/web/src/scss/components/FileUploader/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2248,7 +2248,7 @@ <h2 class="docs-Heading">Example of JS-Controlled Form</h2>
<use xlink:href="/assets/icons/svg/sprite.svg#upload" />
</svg>
<label
for="file-uploader-in-form"
for="file-upload-in-form"
class="FileUploaderInput__dropZoneLabel"
>
<span class="FileUploaderInput__link link-primary link-underlined">Upload your file</span>
Expand Down
Loading