Skip to content

Commit

Permalink
fix: button acting as anchor
Browse files Browse the repository at this point in the history
  • Loading branch information
MellyGray committed Dec 11, 2023
1 parent 5b352ee commit c0644b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,15 @@ export function DownloadFilesButton({ files, fileSelection }: DownloadFilesButto

return (
<>
<Button
variant="secondary"
icon={<Download className={styles.icon} />}
withSpacing
onClick={onClick}
href={getDownloadUrl(FileDownloadMode.ORIGINAL)}>
{t('actions.downloadFiles.title')}
</Button>
<a href={getDownloadUrl(FileDownloadMode.ORIGINAL)}>
<Button
variant="secondary"
icon={<Download className={styles.icon} />}
withSpacing
onClick={onClick}>
{t('actions.downloadFiles.title')}
</Button>
</a>
<NoSelectedFilesModal
show={showNoFilesSelectedModal}
handleClose={() => setShowNoFilesSelectedModal(false)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,9 @@ describe('DownloadFilesButton', () => {
</MultipleFileDownloadProvider>
)

cy.findByRole('button', { name: 'Download' }).should(
'have.attr',
'href',
'https://some-download-url'
)
cy.findByRole('button', { name: 'Download' })
.parent('a')
.should('have.attr', 'href', 'https://some-download-url')
})

it('renders the download url for the selected files when some files are selected and there are tabular files', () => {
Expand Down

0 comments on commit c0644b1

Please sign in to comment.