Skip to content

Commit

Permalink
fix(Upload): disabling delete button when loading (#4348)
Browse files Browse the repository at this point in the history
Will disable the delete button when file is loading
  • Loading branch information
langz authored Dec 2, 2024
2 parents d2522fd + 87b142d commit 85445b4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ const UploadFileListCell = ({
variant="tertiary"
onClick={onDeleteHandler}
icon_position="left"
disabled={isLoading}
>
{deleteButtonText}
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,21 @@ describe('UploadFileListCell', () => {
).toBeInTheDocument()
})

it('renders the delete button as disabled when loading state', () => {
render(
<UploadFileListCell
{...defaultProps}
uploadFile={{
file: createMockFile('file.png', 100, 'image/png'),
isLoading: true,
}}
/>
)
const element = screen.getByRole('button')

expect(element).toBeDisabled()
})

it('does not render the loading state when not loading', () => {
render(
<UploadFileListCell
Expand Down

0 comments on commit 85445b4

Please sign in to comment.