Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit 0e1d527

Browse files
committed
fix: add missing Checkbox, Input, and Textarea mocks to test files
1 parent d5f422b commit 0e1d527

4 files changed

Lines changed: 103 additions & 0 deletions

File tree

webview-ui/src/components/settings/__tests__/CreateSkillDialog.spec.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,27 @@ vi.mock("@/components/ui", () => ({
3434
{children}
3535
</button>
3636
),
37+
Input: ({ value, onChange, placeholder, id, type, className, ...props }: any) => (
38+
<input
39+
type={type || "text"}
40+
value={value}
41+
onChange={onChange}
42+
placeholder={placeholder}
43+
id={id}
44+
className={className}
45+
{...props}
46+
/>
47+
),
48+
Textarea: ({ value, onChange, placeholder, id, className, ...props }: any) => (
49+
<textarea
50+
value={value}
51+
onChange={onChange}
52+
placeholder={placeholder}
53+
id={id}
54+
className={className}
55+
{...props}
56+
/>
57+
),
3758
Dialog: ({ children, open }: any) => (
3859
<div data-testid="dialog" data-open={open}>
3960
{open && children}

webview-ui/src/components/settings/__tests__/SettingsView.change-detection.spec.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,37 @@ vi.mock("@src/components/ui", () => ({
3333
Toggle
3434
</button>
3535
),
36+
Input: ({ value, onChange, placeholder, id, type, className, ...props }: any) => (
37+
<input
38+
type={type || "text"}
39+
value={value}
40+
onChange={onChange}
41+
placeholder={placeholder}
42+
id={id}
43+
className={className}
44+
{...props}
45+
/>
46+
),
47+
Textarea: ({ value, onChange, placeholder, id, className, ...props }: any) => (
48+
<textarea
49+
value={value}
50+
onChange={onChange}
51+
placeholder={placeholder}
52+
id={id}
53+
className={className}
54+
{...props}
55+
/>
56+
),
57+
Checkbox: ({ checked, onCheckedChange, id, className, ...props }: any) => (
58+
<input
59+
type="checkbox"
60+
checked={checked}
61+
onChange={(e) => onCheckedChange?.(e.target.checked)}
62+
id={id}
63+
className={className}
64+
{...props}
65+
/>
66+
),
3667
AlertDialog: ({ open, children }: any) => (open ? <div data-testid="alert-dialog">{children}</div> : null),
3768
AlertDialogContent: ({ children }: any) => <div>{children}</div>,
3869
AlertDialogTitle: ({ children }: any) => <div data-testid="alert-title">{children}</div>,

webview-ui/src/components/settings/__tests__/SettingsView.spec.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,26 @@ vi.mock("@/components/ui", () => ({
121121
Toggle
122122
</button>
123123
),
124+
Checkbox: ({ checked, onCheckedChange, id, className, ...props }: any) => (
125+
<input
126+
type="checkbox"
127+
checked={checked}
128+
onChange={(e) => onCheckedChange?.(e.target.checked)}
129+
id={id}
130+
className={className}
131+
{...props}
132+
/>
133+
),
134+
Textarea: ({ value, onChange, placeholder, id, className, ...props }: any) => (
135+
<textarea
136+
value={value}
137+
onChange={onChange}
138+
placeholder={placeholder}
139+
id={id}
140+
className={className}
141+
{...props}
142+
/>
143+
),
124144
Popover: ({ children }: any) => <div data-testid="popover">{children}</div>,
125145
PopoverTrigger: ({ children }: any) => <div data-testid="popover-trigger">{children}</div>,
126146
PopoverContent: ({ children }: any) => <div data-testid="popover-content">{children}</div>,

webview-ui/src/components/settings/__tests__/SettingsView.unsaved-changes.spec.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,37 @@ vi.mock("@src/components/ui", () => ({
3434
Toggle
3535
</button>
3636
),
37+
Input: ({ value, onChange, placeholder, id, type, className, ...props }: any) => (
38+
<input
39+
type={type || "text"}
40+
value={value}
41+
onChange={onChange}
42+
placeholder={placeholder}
43+
id={id}
44+
className={className}
45+
{...props}
46+
/>
47+
),
48+
Textarea: ({ value, onChange, placeholder, id, className, ...props }: any) => (
49+
<textarea
50+
value={value}
51+
onChange={onChange}
52+
placeholder={placeholder}
53+
id={id}
54+
className={className}
55+
{...props}
56+
/>
57+
),
58+
Checkbox: ({ checked, onCheckedChange, id, className, ...props }: any) => (
59+
<input
60+
type="checkbox"
61+
checked={checked}
62+
onChange={(e) => onCheckedChange?.(e.target.checked)}
63+
id={id}
64+
className={className}
65+
{...props}
66+
/>
67+
),
3768
AlertDialog: ({ children }: any) => <div>{children}</div>,
3869
AlertDialogContent: ({ children }: any) => <div>{children}</div>,
3970
AlertDialogTitle: ({ children }: any) => <div>{children}</div>,

0 commit comments

Comments
 (0)