diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx index 008ef908..2c070025 100644 --- a/src/components/Button/Button.tsx +++ b/src/components/Button/Button.tsx @@ -58,7 +58,7 @@ const Button: React.FC = ({ type={htmlType} onClick={isLoading || suffixIcon ? undefined : onClick} name={name} - data-testid={`button-${name}`} + data-testid={name && `button-${name}`} > {isLoading ? : prefixIcon} {children} diff --git a/src/components/Button/__snapshots__/Button.test.tsx.snap b/src/components/Button/__snapshots__/Button.test.tsx.snap index 04b22c49..4d9c3271 100644 --- a/src/components/Button/__snapshots__/Button.test.tsx.snap +++ b/src/components/Button/__snapshots__/Button.test.tsx.snap @@ -21,7 +21,6 @@ exports[`Button default snapshot 1`] = `