Skip to content

Commit d1c06a7

Browse files
committed
chore: add data-testid for multiselect component
1 parent 8493de7 commit d1c06a7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

site/src/components/MultiSelectCombobox/MultiSelectCombobox.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ interface MultiSelectComboboxProps {
104104
>;
105105
/** hide or show the button that clears all the selected options. */
106106
hideClearAllButton?: boolean;
107+
/** Test ID for testing purposes */
108+
"data-testid"?: string;
107109
}
108110

109111
interface MultiSelectComboboxRef {
@@ -205,6 +207,7 @@ export const MultiSelectCombobox = forwardRef<
205207
commandProps,
206208
inputProps,
207209
hideClearAllButton = false,
210+
"data-testid": dataTestId,
208211
}: MultiSelectComboboxProps,
209212
ref,
210213
) => {
@@ -454,6 +457,7 @@ export const MultiSelectCombobox = forwardRef<
454457
<Command
455458
ref={dropdownRef}
456459
{...commandProps}
460+
data-testid={dataTestId}
457461
onKeyDown={(e) => {
458462
handleKeyDown(e);
459463
commandProps?.onKeyDown?.(e);

site/src/modules/workspaces/DynamicParameter/DynamicParameter.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,10 @@ const ParameterField: FC<ParameterFieldProps> = ({
506506

507507
return (
508508
<MultiSelectCombobox
509-
inputProps={{ id }}
509+
inputProps={{
510+
id: id,
511+
}}
512+
data-testid={`multiselect-${parameter.name}`}
510513
options={options}
511514
defaultOptions={selectedOptions}
512515
onChange={(newValues) => {

0 commit comments

Comments
 (0)