diff --git a/frontend/src/App.tool-center.test.ts b/frontend/src/App.tool-center.test.ts index 712369d..dbd869d 100644 --- a/frontend/src/App.tool-center.test.ts +++ b/frontend/src/App.tool-center.test.ts @@ -158,6 +158,13 @@ describe('tool center menu entries', () => { expect(appSource).toContain('handleCreateConnection, handleManualResetWindowZoom'); expect(appSource).toContain('setTheme, toggleAIPanel, useNativeMacWindowControls'); }); + + it('listens for command search query-tab events and routes them through handleNewQuery', () => { + expect(appSource).toContain("window.addEventListener('gonavi:create-query-tab', handleCreateQueryTabEvent as EventListener);"); + expect(appSource).toContain("window.removeEventListener('gonavi:create-query-tab', handleCreateQueryTabEvent as EventListener);"); + expect(appSource).toContain('const handleCreateQueryTabEvent = () => {'); + expect(appSource).toContain('handleNewQuery();'); + }); }); describe('global appearance tokens', () => { diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index c0179c6..c7d12ad 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -2665,6 +2665,16 @@ function App() { }; }, []); + useEffect(() => { + const handleCreateQueryTabEvent = () => { + handleNewQuery(); + }; + window.addEventListener('gonavi:create-query-tab', handleCreateQueryTabEvent as EventListener); + return () => { + window.removeEventListener('gonavi:create-query-tab', handleCreateQueryTabEvent as EventListener); + }; + }, [handleNewQuery]); + useEffect(() => { if (!isMacRuntime || !useNativeMacWindowControls) { return;