@@ -192,7 +192,15 @@ vi.mock("./ModelSelector", () => ({
192192} ) ) ;
193193
194194vi . mock ( "./components/ChatActionGroup" , ( ) => ( {
195- default : ( ) => < div data-testid = "action-group" /> ,
195+ default : ( props : any ) => (
196+ < div data-testid = "action-group" >
197+ < button
198+ data-testid = "toggle-tool-calls"
199+ data-show-tool-calls = { String ( props . showToolCalls ) }
200+ onClick = { props . onToggleToolCalls }
201+ />
202+ </ div >
203+ ) ,
196204} ) ) ;
197205
198206vi . mock ( "./components/ChatHeaderTitle" , ( ) => ( {
@@ -501,6 +509,7 @@ vi.mock("./utils", async () => {
501509describe ( "ChatPage coverage" , ( ) => {
502510 beforeEach ( ( ) => {
503511 chatExtensions . __resetForTests ( ) ;
512+ localStorage . clear ( ) ;
504513 capturedOptions = null ;
505514 mockListProviders . mockResolvedValue ( [
506515 {
@@ -1417,6 +1426,35 @@ describe("ChatPage coverage", () => {
14171426 expect ( typeof capturedOptions . customToolRenderConfig ) . toBe ( "object" ) ;
14181427 } ) ;
14191428
1429+ it ( "disables tool call rendering from the chat action toggle" , async ( ) => {
1430+ renderWithProviders ( < ChatPage /> , {
1431+ initialEntries : [ "/chat/test-session" ] ,
1432+ } ) ;
1433+ await screen . findByTestId ( "chat-ui" ) ;
1434+
1435+ expect ( screen . getByTestId ( "toggle-tool-calls" ) ) . toHaveAttribute (
1436+ "data-show-tool-calls" ,
1437+ "true" ,
1438+ ) ;
1439+
1440+ await act ( async ( ) => {
1441+ screen
1442+ . getByTestId ( "toggle-tool-calls" )
1443+ . dispatchEvent ( new MouseEvent ( "click" , { bubbles : true } ) ) ;
1444+ } ) ;
1445+
1446+ expect ( screen . getByTestId ( "toggle-tool-calls" ) ) . toHaveAttribute (
1447+ "data-show-tool-calls" ,
1448+ "false" ,
1449+ ) ;
1450+ expect (
1451+ capturedOptions . customToolRenderConfig . any_tool_name ( {
1452+ data : { content : [ ] } ,
1453+ } ) ,
1454+ ) . toBeNull ( ) ;
1455+ expect ( localStorage . getItem ( "qwenpaw_show_tool_calls" ) ) . toBe ( "false" ) ;
1456+ } ) ;
1457+
14201458 // ── cards config ───────────────────────────────────────────────────────
14211459 it ( "cards config has host wrappers" , async ( ) => {
14221460 renderWithProviders ( < ChatPage /> , {
0 commit comments