From 25ff80427472fb11658a992bdad4cfa69a0f515e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Edstr=C3=B6m?= Date: Wed, 3 Jul 2024 12:20:45 +0200 Subject: [PATCH] Modified propname to be data-test and added unit test for custom data-testid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Simon Edström --- .../core-components/src/components/Select/Select.test.tsx | 8 ++++++++ packages/core-components/src/components/Select/Select.tsx | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) 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(', + ); + 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}