@@ -177,14 +177,12 @@ describe("ToolsTab", () => {
177177 execution : { taskSupport : "required" } ,
178178 } ;
179179
180- it ( "should not show Run as task checkbox when server does not support task tool calls" , ( ) => {
180+ it ( "should not show Run as task switch when server does not support task tool calls" , ( ) => {
181181 renderToolsTab ( {
182182 selectedTool : mockTools [ 0 ] ,
183183 serverSupportsTaskToolCalls : false ,
184184 } ) ;
185- expect (
186- screen . queryByRole ( "checkbox" , { name : / r u n a s t a s k / i } ) ,
187- ) . toBeNull ( ) ;
185+ expect ( screen . queryByRole ( "switch" , { name : / r u n a s t a s k / i } ) ) . toBeNull ( ) ;
188186 } ) ;
189187
190188 it ( "should show Run as task control when server supports task tool calls and a tool is selected" , ( ) => {
@@ -193,56 +191,60 @@ describe("ToolsTab", () => {
193191 serverSupportsTaskToolCalls : true ,
194192 } ) ;
195193 expect (
196- screen . getByRole ( "checkbox " , { name : / r u n a s t a s k / i } ) ,
194+ screen . getByRole ( "switch " , { name : / r u n a s t a s k / i } ) ,
197195 ) . toBeInTheDocument ( ) ;
198196 } ) ;
199197
200- it ( "should show checkbox unchecked and enabled when tool taskSupport is optional" , async ( ) => {
198+ it ( "should show switch unchecked and enabled when tool taskSupport is optional" , async ( ) => {
201199 renderToolsTab ( {
202200 selectedTool : toolWithOptionalTask ,
203201 serverSupportsTaskToolCalls : true ,
204202 } ) ;
205- const checkbox = screen . getByRole ( "checkbox" , { name : / r u n a s t a s k / i } ) ;
206- expect ( checkbox ) . not . toBeChecked ( ) ;
207- expect ( checkbox ) . not . toBeDisabled ( ) ;
203+ const runAsTaskSwitch = screen . getByRole ( "switch" , {
204+ name : / r u n a s t a s k / i,
205+ } ) ;
206+ expect ( runAsTaskSwitch ) . not . toBeChecked ( ) ;
207+ expect ( runAsTaskSwitch ) . not . toBeDisabled ( ) ;
208208 } ) ;
209209
210- it ( "should show Run as Task: Forbidden when tool taskSupport is forbidden" , ( ) => {
210+ it ( "should show switch off and disabled when tool taskSupport is forbidden" , ( ) => {
211211 renderToolsTab ( {
212212 selectedTool : toolWithForbiddenTask ,
213213 serverSupportsTaskToolCalls : true ,
214214 } ) ;
215- expect ( screen . getByText ( / r u n a s t a s k : f o r b i d d e n / i) ) . toBeInTheDocument ( ) ;
216- expect (
217- screen . queryByRole ( "checkbox" , { name : / r u n a s t a s k / i } ) ,
218- ) . toBeNull ( ) ;
215+ const runAsTaskSwitch = screen . getByRole ( "switch" , {
216+ name : / r u n a s t a s k / i,
217+ } ) ;
218+ expect ( runAsTaskSwitch ) . not . toBeChecked ( ) ;
219+ expect ( runAsTaskSwitch ) . toBeDisabled ( ) ;
219220 } ) ;
220221
221- it ( "should show Run as Task: Required when tool taskSupport is required" , ( ) => {
222+ it ( "should show switch on and disabled when tool taskSupport is required" , ( ) => {
222223 renderToolsTab ( {
223224 selectedTool : toolWithRequiredTask ,
224225 serverSupportsTaskToolCalls : true ,
225226 } ) ;
226- expect ( screen . getByText ( / r u n a s t a s k : r e q u i r e d / i) ) . toBeInTheDocument ( ) ;
227- expect (
228- screen . queryByRole ( "checkbox" , { name : / r u n a s t a s k / i } ) ,
229- ) . toBeNull ( ) ;
227+ const runAsTaskSwitch = screen . getByRole ( "switch" , {
228+ name : / r u n a s t a s k / i,
229+ } ) ;
230+ expect ( runAsTaskSwitch ) . toBeChecked ( ) ;
231+ expect ( runAsTaskSwitch ) . toBeDisabled ( ) ;
230232 } ) ;
231233
232- it ( "should call callTool with runAsTask true when optional and checkbox is checked and Run Tool clicked" , async ( ) => {
234+ it ( "should call callTool with runAsTask true when optional and switch is on and Run Tool clicked" , async ( ) => {
233235 const mockCallTool = vi . fn ( async ( ) => { } ) ;
234236 renderToolsTab ( {
235237 selectedTool : toolWithOptionalTask ,
236238 serverSupportsTaskToolCalls : true ,
237239 callTool : mockCallTool ,
238240 } ) ;
239- const runAsTaskCheckbox = screen . getByRole ( "checkbox " , {
241+ const runAsTaskSwitch = screen . getByRole ( "switch " , {
240242 name : / r u n a s t a s k / i,
241243 } ) ;
242244 await act ( async ( ) => {
243- fireEvent . click ( runAsTaskCheckbox ) ;
245+ fireEvent . click ( runAsTaskSwitch ) ;
244246 } ) ;
245- expect ( runAsTaskCheckbox ) . toBeChecked ( ) ;
247+ expect ( runAsTaskSwitch ) . toBeChecked ( ) ;
246248 const runButton = screen . getByRole ( "button" , { name : / r u n t o o l / i } ) ;
247249 await act ( async ( ) => {
248250 fireEvent . click ( runButton ) ;
0 commit comments