Skip to content

The agent that grows with you

test(desktop): prove the status bar keeps its own right-click menu

Brooklyn Nicholsonbfcfdb30d118
diff --git a/apps/desktop/src/app/context-menu/app-context-menu.test.tsx b/apps/desktop/src/app/context-menu/app-context-menu.test.tsx
index 08494f14636..9d889686e95 100644
--- a/apps/desktop/src/app/context-menu/app-context-menu.test.tsx
+++ b/apps/desktop/src/app/context-menu/app-context-menu.test.tsx
@@ -359,22 +359,6 @@ describe('AppContextMenu', () => {
expect($contextMenu.get()).toBeNull()
})
- it('leaves asChild radix triggers alone when the child overwrites data-slot', () => {
- installBridge()
- mountMenu()
- // Status bar: ContextMenuTrigger asChild over a footer whose data-slot
- // is "statusbar". The coordinator must still recognize the dedicated
- // marker — otherwise the window-verbs fallback eats the gesture.
- const host = attach(
- '<footer data-slot="statusbar" data-hermes-context-menu-trigger=""><span>meter</span></footer>'
- )
-
- fireEvent.contextMenu(host.querySelector('span')!)
-
- expect($contextMenu.get()).toBeNull()
- expect(screen.queryByText('Settings')).toBeNull()
- })
-
it('shows the terminal menu through a registered handle', async () => {
installBridge()
mountMenu()
diff --git a/apps/desktop/src/app/shell/statusbar-context-menu.test.tsx b/apps/desktop/src/app/shell/statusbar-context-menu.test.tsx
new file mode 100644
index 00000000000..dcce183c9ac
--- /dev/null
+++ b/apps/desktop/src/app/shell/statusbar-context-menu.test.tsx
@@ -0,0 +1,60 @@
+import { cleanup, fireEvent, render, screen } from '@testing-library/react'
+import { MemoryRouter } from 'react-router'
+import { afterEach, beforeAll, describe, expect, it, vi } from 'vitest'
+
+import { AppContextMenu } from '@/app/context-menu/app-context-menu'
+import { $contextMenu } from '@/app/context-menu/store'
+import { StatusbarControls } from '@/app/shell/statusbar-controls'
+import { $statusbarHiddenIds, STATUSBAR_HIDDEN_BY_DEFAULT } from '@/store/statusbar-prefs'
+
+class TestResizeObserver {
+ observe() {}
+ unobserve() {}
+ disconnect() {}
+}
+
+beforeAll(() => {
+ vi.stubGlobal('ResizeObserver', TestResizeObserver)
+ Element.prototype.hasPointerCapture ??= () => false
+ Element.prototype.setPointerCapture ??= () => undefined
+ Element.prototype.releasePointerCapture ??= () => undefined
+ HTMLElement.prototype.scrollIntoView ??= () => undefined
+})
+
+afterEach(() => {
+ cleanup()
+ $contextMenu.set(null)
+ $statusbarHiddenIds.set([...STATUSBAR_HIDDEN_BY_DEFAULT])
+})
+
+// End-to-end companion to the ContextMenuTrigger unit test: that one proves
+// the marker survives the Slot merge, this one proves the real status bar and
+// the real coordinator agree, so the default-hidden items stay reachable.
+describe('statusbar context menu coordination', () => {
+ it('lets the statusbar Radix menu handle right-clicks instead of the app fallback (#89953)', async () => {
+ render(
+ <MemoryRouter>
+ <AppContextMenu />
+ <StatusbarControls
+ items={[
+ {
+ id: 'context-usage',
+ label: 'Context meter',
+ toggleLabel: 'Context meter',
+ variant: 'menu'
+ }
+ ]}
+ />
+ </MemoryRouter>
+ )
+
+ const statusbar = screen.getByRole('contentinfo')
+
+ fireEvent.pointerDown(statusbar, { button: 2, ctrlKey: false, pointerType: 'mouse' })
+ fireEvent.contextMenu(statusbar, { button: 2 })
+
+ expect(await screen.findByRole('menuitemcheckbox', { name: 'Context meter' })).toBeTruthy()
+ expect(screen.queryByText('Settings')).toBeNull()
+ expect($contextMenu.get()).toBeNull()
+ })
+})