diff --git a/src/Dropzone/components/DropzoneButtons/DropzoneButtons.tsx b/src/Dropzone/components/DropzoneButtons/DropzoneButtons.tsx index a8c787a..0a2f963 100644 --- a/src/Dropzone/components/DropzoneButtons/DropzoneButtons.tsx +++ b/src/Dropzone/components/DropzoneButtons/DropzoneButtons.tsx @@ -79,8 +79,15 @@ const DropzoneButtons: React.FC = ( (actionButtonProps: ActionButtonItem, index: number) => { - const { children, label, resetStyles, className, style, onClick } = - actionButtonProps; + const { + disabled, + children, + label, + resetStyles, + className, + style, + onClick, + } = actionButtonProps; return ( { describe("Dropzone actionButtons", () => { test.each([ - [{ uploadButton: { onClick: console.log } }, "Upload"], - [{ uploadButton: { label: undefined, onClick: console.log } }, "Upload"], - [{ uploadButton: { label: null, onClick: console.log } }, "Upload"], - [{ uploadButton: { label: "my label", onClick: console.log } }, "my label"], - [{ deleteButton: { label: null, onClick: console.log } }, "Delete"], - [ - { deleteButton: { label: "my delete label", onClick: console.log } }, - "my delete label", - ], + [{ uploadButton: { onClick: console.log } }, false], + [{ uploadButton: { onClick: console.log, disabled: false } }, false], + [{ uploadButton: { onClick: console.log, disabled: true } }, true], + [{ deleteButton: { onClick: console.log } }, false], + [{ deleteButton: { onClick: console.log, disabled: false } }, false], + [{ deleteButton: { onClick: console.log, disabled: true } }, true], // abortButton and cleanButton need more interaction - ])("label %s -> %s", (config, expected) => { + ])("disabled %s -> %s", (config, expected) => { const { container } = render( , ); expect( - container.querySelector(".files-ui-buttons-container button").textContent, + ( + container.querySelector( + ".files-ui-buttons-container button", + ) as HTMLInputElement + ).disabled, ).toBe(expected); }); });