From 8fadb84aa406b9a0d75f2bdb68c4d396b9b864c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Edstr=C3=B6m?= Date: Mon, 24 Jun 2024 22:03:10 +0200 Subject: [PATCH] Modified Select component to take in a testid parameter that sets the data-testid of the material ui Select component, ensuring backwards compatibility with default value corresponding to previously hardcoded parameter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Simon Edström --- packages/core-components/src/components/Select/Select.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/core-components/src/components/Select/Select.tsx b/packages/core-components/src/components/Select/Select.tsx index 924b49f640..5a758e6ca6 100644 --- a/packages/core-components/src/components/Select/Select.tsx +++ b/packages/core-components/src/components/Select/Select.tsx @@ -32,6 +32,7 @@ import React, { useEffect, useState } from 'react'; import ClosedDropdown from './static/ClosedDropdown'; import OpenedDropdown from './static/OpenedDropdown'; +import { string } from 'zod'; /** @public */ export type SelectInputBaseClassKey = 'root' | 'input'; @@ -136,6 +137,7 @@ export type SelectProps = { native?: boolean; disabled?: boolean; margin?: 'dense' | 'none'; + testid?: string; }; /** @public */ @@ -151,6 +153,7 @@ export function SelectComponent(props: SelectProps) { native = false, disabled = false, margin, + testid = 'select', } = props; const classes = useStyles(); const [value, setValue] = useState( @@ -203,7 +206,7 @@ export function SelectComponent(props: SelectProps) { value={value} native={native} disabled={disabled} - data-testid="select" + data-testid={testid} displayEmpty multiple={multiple} margin={margin}