diff --git a/packages/core-components/src/components/Select/Select.test.tsx b/packages/core-components/src/components/Select/Select.test.tsx
index 71159150e4..3c05c6bcaf 100644
--- a/packages/core-components/src/components/Select/Select.test.tsx
+++ b/packages/core-components/src/components/Select/Select.test.tsx
@@ -66,4 +66,12 @@ describe('', () => {
expect(getByTestId('select').textContent).toBe('All results');
});
+
+ it('should function correctly when a custom data-testid is provided', async () => {
+ const { getByTestId } = render(
+ ,
+ );
+ const input = getByTestId('custom-select');
+ expect(input.textContent).toBe('All results');
+ });
});
diff --git a/packages/core-components/src/components/Select/Select.tsx b/packages/core-components/src/components/Select/Select.tsx
index 9c0d4e4dfe..b78693213f 100644
--- a/packages/core-components/src/components/Select/Select.tsx
+++ b/packages/core-components/src/components/Select/Select.tsx
@@ -136,7 +136,7 @@ export type SelectProps = {
native?: boolean;
disabled?: boolean;
margin?: 'dense' | 'none';
- testid?: string;
+ 'data-testid'?: string;
};
/** @public */
@@ -152,7 +152,7 @@ export function SelectComponent(props: SelectProps) {
native = false,
disabled = false,
margin,
- testid = 'select',
+ 'data-testid': dataTestId = 'select',
} = props;
const classes = useStyles();
const [value, setValue] = useState(
@@ -205,7 +205,7 @@ export function SelectComponent(props: SelectProps) {
value={value}
native={native}
disabled={disabled}
- data-testid={testid}
+ data-testid={dataTestId}
displayEmpty
multiple={multiple}
margin={margin}