Skip to content

Commit

Permalink
fix(Upload): support special file extensions like .dat
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Jan 19, 2023
1 parent 957acaa commit b07bebb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const UploadFileListCell = ({
const { file, errorMessage, isLoading } = uploadFile
const { name, type } = file

const fileType = type.split('/')[1]
const fileType = type.split('/')[1] || ''

const hasWarning = errorMessage != null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@ describe('UploadFileListCell', () => {
expect(element.className).toMatch('dnb-upload__file-cell--warning')
})

it('supports special file extensions', async () => {
render(
<UploadFileListCell
{...defaultProps}
uploadFile={{ file: createMockFile('file.dat', 100, 'dat') }}
/>
)

const element = document.querySelector('.dnb-upload__file-cell__title')

expect(element.textContent).toMatch('file.dat')
})

it('renders the no error styling', () => {
render(
<UploadFileListCell
Expand Down

0 comments on commit b07bebb

Please sign in to comment.