File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed
webview-ui/src/components/chat Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -185,7 +185,14 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
185185 cursor : "pointer" ,
186186 } }
187187 onClick = { toggleExpanded } >
188- < div onClick = { ( e ) => e . stopPropagation ( ) } >
188+ < div
189+ onClick = { ( e ) => {
190+ e . stopPropagation ( )
191+ // If no options are selected, clicking the checkbox area should expand the menu
192+ if ( ! hasEnabledOptions ) {
193+ setIsExpanded ( true )
194+ }
195+ } } >
189196 < StandardTooltip
190197 content = { ! hasEnabledOptions ? t ( "chat:autoApprove.selectOptionsFirst" ) : undefined } >
191198 < VSCodeCheckbox
@@ -202,7 +209,7 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
202209 setAutoApprovalEnabled ( newValue )
203210 vscode . postMessage ( { type : "autoApprovalEnabled" , bool : newValue } )
204211 }
205- // If no options enabled, do nothing
212+ // If no options enabled, the onClick handler above will expand the menu
206213 } }
207214 />
208215 </ StandardTooltip >
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ describe("AutoApproveMenu", () => {
115115 expect ( screen . getByText ( "Read-only operations" ) ) . toBeInTheDocument ( )
116116 } )
117117
118- it ( "should not allow toggling master checkbox when no options are selected" , ( ) => {
118+ it ( "should expand menu when clicking checkbox area with no options selected" , async ( ) => {
119119 ; ( useExtensionState as ReturnType < typeof vi . fn > ) . mockReturnValue ( {
120120 ...defaultExtensionState ,
121121 autoApprovalEnabled : false ,
@@ -124,12 +124,18 @@ describe("AutoApproveMenu", () => {
124124
125125 render ( < AutoApproveMenu /> )
126126
127- // Click on the master checkbox
127+ // Click on the checkbox container (since the checkbox itself is disabled)
128128 const masterCheckbox = screen . getByRole ( "checkbox" )
129- fireEvent . click ( masterCheckbox )
129+ const checkboxContainer = masterCheckbox . parentElement
130+ fireEvent . click ( checkboxContainer ! )
130131
131132 // Should not send any message since no options are selected
132133 expect ( mockPostMessage ) . not . toHaveBeenCalled ( )
134+
135+ // But should expand the menu to show options
136+ await waitFor ( ( ) => {
137+ expect ( screen . getByTestId ( "always-allow-readonly-toggle" ) ) . toBeInTheDocument ( )
138+ } )
133139 } )
134140
135141 it ( "should toggle master checkbox when options are selected" , ( ) => {
You can’t perform that action at this time.
0 commit comments