Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0bfe0d6

Browse files
feat: add tests for dynamic parameters (#18679)
<!-- This is an auto-generated comment: release notes by coderabbit.ai-->## Summary by CodeRabbit* **New Features*** Added support for a new testing attribute to the multi-select comboboxcomponent, improving testability.* Expanded mock data for dynamic parameters, covering a wider range ofinput types and validation scenarios.* **Bug Fixes*** Improved loader and error handling on the experimental workspacecreation page to better display WebSocket errors.* **Tests*** Introduced comprehensive tests for the experimental workspace creationpage, including dynamic parameter updates, error handling, and formsubmission scenarios.<!-- end of auto-generated comment: release notes by coderabbit.ai -->---------Co-authored-by: Michael Smith <throwawayclover@gmail.com>
1 parentb8c9192 commit0bfe0d6

File tree

6 files changed

+803
-12
lines changed

6 files changed

+803
-12
lines changed

‎site/src/components/Combobox/Combobox.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ interface ComboboxProps {
3434
onInputChange?:(value:string)=>void;
3535
onKeyDown?:KeyboardEventHandler<HTMLInputElement>;
3636
onSelect:(value:string)=>void;
37+
id?:string;
3738
}
3839

3940
typeComboboxOption={
@@ -53,6 +54,7 @@ export const Combobox: FC<ComboboxProps> = ({
5354
onInputChange,
5455
onKeyDown,
5556
onSelect,
57+
id,
5658
})=>{
5759
const[managedOpen,setManagedOpen]=useState(false);
5860
const[managedInputValue,setManagedInputValue]=useState("");
@@ -78,6 +80,7 @@ export const Combobox: FC<ComboboxProps> = ({
7880
<Popoveropen={isOpen}onOpenChange={handleOpenChange}>
7981
<PopoverTriggerasChild>
8082
<Button
83+
id={id}
8184
variant="outline"
8285
aria-expanded={isOpen}
8386
className="w-full justify-between group"

‎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
interfaceMultiSelectComboboxRef{
@@ -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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ const ParameterField: FC<ParameterFieldProps> = ({
453453
case"dropdown":{
454454
return(
455455
<Combobox
456+
id={id}
456457
value={value??""}
457458
onSelect={(value)=>onChange(value)}
458459
options={parameter.options.map((option)=>({
@@ -497,7 +498,10 @@ const ParameterField: FC<ParameterFieldProps> = ({
497498

498499
return(
499500
<MultiSelectCombobox
500-
inputProps={{ id}}
501+
inputProps={{
502+
id:id,
503+
}}
504+
data-testid={`multiselect-${parameter.name}`}
501505
options={options}
502506
defaultOptions={selectedOptions}
503507
onChange={(newValues)=>{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp