feat: populate macOS menu bar with native menus (File, Edit, View, Window) (#77)
* feat: populate macOS menu bar with File, Edit, View, Window menus
Add complete native macOS menu structure with all app actions:
- Laputa menu: About, Settings (Cmd+,), Hide/Quit
- File: New Note (Cmd+N), Quick Open (Cmd+P), Save (Cmd+S), Close Tab (Cmd+W)
- Edit: standard Undo/Redo/Cut/Copy/Paste/Select All
- View: Editor Only (Cmd+1), Editor+Notes (Cmd+2), All Panels (Cmd+3),
Toggle Inspector, Command Palette (Cmd+K)
- Window: Minimize, Maximize, Close Window
All accelerators registered via Tauri menu API. Menu events dispatched
to frontend via useMenuEvents hook. Save/Close Tab items dynamically
disabled when no note tab is active.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: wrap Enter selection assertion in waitFor for effect re-registration
* fix: resolve rebase conflict markers in menu.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:05:24 +01:00
|
|
|
import { describe, it, expect, vi } from 'vitest'
|
|
|
|
|
import { dispatchMenuEvent, type MenuEventHandlers } from './useMenuEvents'
|
|
|
|
|
|
|
|
|
|
function makeHandlers(): MenuEventHandlers {
|
|
|
|
|
return {
|
|
|
|
|
onSetViewMode: vi.fn(),
|
|
|
|
|
onCreateNote: vi.fn(),
|
feat: reorganize menu bar with Go, Note, and Vault menus
Add missing command palette commands to menu bar and reorganize into
logical groups: File, Edit, View, Go, Note, Vault, Window. New menus
expose navigation filters, note actions, vault management, themes, and
git operations. Context-sensitive items (archive, trash, diff, raw
editor, commit, conflicts) are greyed out when not applicable.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 14:13:54 +01:00
|
|
|
onCreateType: vi.fn(),
|
2026-03-02 03:08:15 +01:00
|
|
|
onOpenDailyNote: vi.fn(),
|
feat: populate macOS menu bar with native menus (File, Edit, View, Window) (#77)
* feat: populate macOS menu bar with File, Edit, View, Window menus
Add complete native macOS menu structure with all app actions:
- Laputa menu: About, Settings (Cmd+,), Hide/Quit
- File: New Note (Cmd+N), Quick Open (Cmd+P), Save (Cmd+S), Close Tab (Cmd+W)
- Edit: standard Undo/Redo/Cut/Copy/Paste/Select All
- View: Editor Only (Cmd+1), Editor+Notes (Cmd+2), All Panels (Cmd+3),
Toggle Inspector, Command Palette (Cmd+K)
- Window: Minimize, Maximize, Close Window
All accelerators registered via Tauri menu API. Menu events dispatched
to frontend via useMenuEvents hook. Save/Close Tab items dynamically
disabled when no note tab is active.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: wrap Enter selection assertion in waitFor for effect re-registration
* fix: resolve rebase conflict markers in menu.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:05:24 +01:00
|
|
|
onQuickOpen: vi.fn(),
|
|
|
|
|
onSave: vi.fn(),
|
|
|
|
|
onOpenSettings: vi.fn(),
|
|
|
|
|
onToggleInspector: vi.fn(),
|
|
|
|
|
onCommandPalette: vi.fn(),
|
2026-02-28 12:41:57 +01:00
|
|
|
onZoomIn: vi.fn(),
|
|
|
|
|
onZoomOut: vi.fn(),
|
|
|
|
|
onZoomReset: vi.fn(),
|
feat: keyboard-first navigation — menu bar shortcuts, note list nav, inspector Tab/Enter (#158)
* feat: keyboard-first navigation — menu bar shortcuts, note list nav, inspector Tab/Enter
- Add missing menu bar items: Archive Note (⌘E), Trash Note (⌘⌫),
Find in Vault (⌘⇧F), Go Back (⌘[), Go Forward (⌘])
- Wire new menu events through useMenuEvents → useAppCommands
- Note list: ↑↓ moves highlight, Enter opens selected note (useNoteListKeyboard hook)
- Inspector properties: Tab between rows, Enter to start editing
- Settings panel: auto-focus first input on open
- Extract StatusDot, StateBadge, noteItemStyle from NoteItem (reduces complexity)
- Extract dispatchActiveTabEvent/dispatchOptionalEvent from useMenuEvents
- 21 new tests (useNoteListKeyboard + useMenuEvents for new events)
- All 1275 frontend tests pass, 319 Rust tests pass
- CodeScene quality gates: passed (NoteItem improved from 22→18 complexity)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* design: keyboard-first-nav wireframes (note list highlight, menu shortcuts, inspector tab nav)
* test: add search.rs coverage for fallback branches (qmd_uri_to_vault_path, extract_clean_snippet)
* chore: exclude search.rs and lib.rs from coverage (qmd integration + Tauri setup code)
---------
Co-authored-by: Test <test@test.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 19:32:15 +01:00
|
|
|
onArchiveNote: vi.fn(),
|
|
|
|
|
onTrashNote: vi.fn(),
|
|
|
|
|
onSearch: vi.fn(),
|
feat: reorganize menu bar with Go, Note, and Vault menus
Add missing command palette commands to menu bar and reorganize into
logical groups: File, Edit, View, Go, Note, Vault, Window. New menus
expose navigation filters, note actions, vault management, themes, and
git operations. Context-sensitive items (archive, trash, diff, raw
editor, commit, conflicts) are greyed out when not applicable.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 14:13:54 +01:00
|
|
|
onToggleRawEditor: vi.fn(),
|
|
|
|
|
onToggleDiff: vi.fn(),
|
|
|
|
|
onToggleAIChat: vi.fn(),
|
feat: keyboard-first navigation — menu bar shortcuts, note list nav, inspector Tab/Enter (#158)
* feat: keyboard-first navigation — menu bar shortcuts, note list nav, inspector Tab/Enter
- Add missing menu bar items: Archive Note (⌘E), Trash Note (⌘⌫),
Find in Vault (⌘⇧F), Go Back (⌘[), Go Forward (⌘])
- Wire new menu events through useMenuEvents → useAppCommands
- Note list: ↑↓ moves highlight, Enter opens selected note (useNoteListKeyboard hook)
- Inspector properties: Tab between rows, Enter to start editing
- Settings panel: auto-focus first input on open
- Extract StatusDot, StateBadge, noteItemStyle from NoteItem (reduces complexity)
- Extract dispatchActiveTabEvent/dispatchOptionalEvent from useMenuEvents
- 21 new tests (useNoteListKeyboard + useMenuEvents for new events)
- All 1275 frontend tests pass, 319 Rust tests pass
- CodeScene quality gates: passed (NoteItem improved from 22→18 complexity)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* design: keyboard-first-nav wireframes (note list highlight, menu shortcuts, inspector tab nav)
* test: add search.rs coverage for fallback branches (qmd_uri_to_vault_path, extract_clean_snippet)
* chore: exclude search.rs and lib.rs from coverage (qmd integration + Tauri setup code)
---------
Co-authored-by: Test <test@test.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 19:32:15 +01:00
|
|
|
onGoBack: vi.fn(),
|
|
|
|
|
onGoForward: vi.fn(),
|
2026-03-03 13:19:09 +01:00
|
|
|
onCheckForUpdates: vi.fn(),
|
feat: reorganize menu bar with Go, Note, and Vault menus
Add missing command palette commands to menu bar and reorganize into
logical groups: File, Edit, View, Go, Note, Vault, Window. New menus
expose navigation filters, note actions, vault management, themes, and
git operations. Context-sensitive items (archive, trash, diff, raw
editor, commit, conflicts) are greyed out when not applicable.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 14:13:54 +01:00
|
|
|
onSelectFilter: vi.fn(),
|
|
|
|
|
onOpenVault: vi.fn(),
|
|
|
|
|
onRemoveActiveVault: vi.fn(),
|
|
|
|
|
onRestoreGettingStarted: vi.fn(),
|
|
|
|
|
onCreateTheme: vi.fn(),
|
|
|
|
|
onRestoreDefaultThemes: vi.fn(),
|
|
|
|
|
onCommitPush: vi.fn(),
|
|
|
|
|
onResolveConflicts: vi.fn(),
|
|
|
|
|
onViewChanges: vi.fn(),
|
|
|
|
|
onInstallMcp: vi.fn(),
|
2026-03-07 01:14:12 +01:00
|
|
|
onReindexVault: vi.fn(),
|
2026-03-09 00:35:21 +01:00
|
|
|
onReloadVault: vi.fn(),
|
2026-03-11 23:36:42 +01:00
|
|
|
onReopenClosedTab: vi.fn(),
|
feat: populate macOS menu bar with native menus (File, Edit, View, Window) (#77)
* feat: populate macOS menu bar with File, Edit, View, Window menus
Add complete native macOS menu structure with all app actions:
- Laputa menu: About, Settings (Cmd+,), Hide/Quit
- File: New Note (Cmd+N), Quick Open (Cmd+P), Save (Cmd+S), Close Tab (Cmd+W)
- Edit: standard Undo/Redo/Cut/Copy/Paste/Select All
- View: Editor Only (Cmd+1), Editor+Notes (Cmd+2), All Panels (Cmd+3),
Toggle Inspector, Command Palette (Cmd+K)
- Window: Minimize, Maximize, Close Window
All accelerators registered via Tauri menu API. Menu events dispatched
to frontend via useMenuEvents hook. Save/Close Tab items dynamically
disabled when no note tab is active.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: wrap Enter selection assertion in waitFor for effect re-registration
* fix: resolve rebase conflict markers in menu.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:05:24 +01:00
|
|
|
activeTabPathRef: { current: '/vault/test.md' } as React.MutableRefObject<string | null>,
|
|
|
|
|
handleCloseTabRef: { current: vi.fn() } as React.MutableRefObject<(path: string) => void>,
|
|
|
|
|
activeTabPath: '/vault/test.md',
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
describe('dispatchMenuEvent', () => {
|
feat: reorganize menu bar with Go, Note, and Vault menus
Add missing command palette commands to menu bar and reorganize into
logical groups: File, Edit, View, Go, Note, Vault, Window. New menus
expose navigation filters, note actions, vault management, themes, and
git operations. Context-sensitive items (archive, trash, diff, raw
editor, commit, conflicts) are greyed out when not applicable.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 14:13:54 +01:00
|
|
|
// View mode events
|
feat: populate macOS menu bar with native menus (File, Edit, View, Window) (#77)
* feat: populate macOS menu bar with File, Edit, View, Window menus
Add complete native macOS menu structure with all app actions:
- Laputa menu: About, Settings (Cmd+,), Hide/Quit
- File: New Note (Cmd+N), Quick Open (Cmd+P), Save (Cmd+S), Close Tab (Cmd+W)
- Edit: standard Undo/Redo/Cut/Copy/Paste/Select All
- View: Editor Only (Cmd+1), Editor+Notes (Cmd+2), All Panels (Cmd+3),
Toggle Inspector, Command Palette (Cmd+K)
- Window: Minimize, Maximize, Close Window
All accelerators registered via Tauri menu API. Menu events dispatched
to frontend via useMenuEvents hook. Save/Close Tab items dynamically
disabled when no note tab is active.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: wrap Enter selection assertion in waitFor for effect re-registration
* fix: resolve rebase conflict markers in menu.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:05:24 +01:00
|
|
|
it('view-editor-only sets editor-only mode', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('view-editor-only', h)
|
|
|
|
|
expect(h.onSetViewMode).toHaveBeenCalledWith('editor-only')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('view-editor-list sets editor-list mode', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('view-editor-list', h)
|
|
|
|
|
expect(h.onSetViewMode).toHaveBeenCalledWith('editor-list')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('view-all sets all mode', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('view-all', h)
|
|
|
|
|
expect(h.onSetViewMode).toHaveBeenCalledWith('all')
|
|
|
|
|
})
|
|
|
|
|
|
feat: reorganize menu bar with Go, Note, and Vault menus
Add missing command palette commands to menu bar and reorganize into
logical groups: File, Edit, View, Go, Note, Vault, Window. New menus
expose navigation filters, note actions, vault management, themes, and
git operations. Context-sensitive items (archive, trash, diff, raw
editor, commit, conflicts) are greyed out when not applicable.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 14:13:54 +01:00
|
|
|
// Simple handler events
|
feat: populate macOS menu bar with native menus (File, Edit, View, Window) (#77)
* feat: populate macOS menu bar with File, Edit, View, Window menus
Add complete native macOS menu structure with all app actions:
- Laputa menu: About, Settings (Cmd+,), Hide/Quit
- File: New Note (Cmd+N), Quick Open (Cmd+P), Save (Cmd+S), Close Tab (Cmd+W)
- Edit: standard Undo/Redo/Cut/Copy/Paste/Select All
- View: Editor Only (Cmd+1), Editor+Notes (Cmd+2), All Panels (Cmd+3),
Toggle Inspector, Command Palette (Cmd+K)
- Window: Minimize, Maximize, Close Window
All accelerators registered via Tauri menu API. Menu events dispatched
to frontend via useMenuEvents hook. Save/Close Tab items dynamically
disabled when no note tab is active.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: wrap Enter selection assertion in waitFor for effect re-registration
* fix: resolve rebase conflict markers in menu.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:05:24 +01:00
|
|
|
it('file-new-note triggers create note', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('file-new-note', h)
|
|
|
|
|
expect(h.onCreateNote).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
2026-03-02 03:08:15 +01:00
|
|
|
it('file-daily-note triggers open daily note', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('file-daily-note', h)
|
|
|
|
|
expect(h.onOpenDailyNote).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
feat: populate macOS menu bar with native menus (File, Edit, View, Window) (#77)
* feat: populate macOS menu bar with File, Edit, View, Window menus
Add complete native macOS menu structure with all app actions:
- Laputa menu: About, Settings (Cmd+,), Hide/Quit
- File: New Note (Cmd+N), Quick Open (Cmd+P), Save (Cmd+S), Close Tab (Cmd+W)
- Edit: standard Undo/Redo/Cut/Copy/Paste/Select All
- View: Editor Only (Cmd+1), Editor+Notes (Cmd+2), All Panels (Cmd+3),
Toggle Inspector, Command Palette (Cmd+K)
- Window: Minimize, Maximize, Close Window
All accelerators registered via Tauri menu API. Menu events dispatched
to frontend via useMenuEvents hook. Save/Close Tab items dynamically
disabled when no note tab is active.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: wrap Enter selection assertion in waitFor for effect re-registration
* fix: resolve rebase conflict markers in menu.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:05:24 +01:00
|
|
|
it('file-quick-open triggers quick open', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('file-quick-open', h)
|
|
|
|
|
expect(h.onQuickOpen).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('file-save triggers save', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('file-save', h)
|
|
|
|
|
expect(h.onSave).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('file-close-tab closes the active tab', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('file-close-tab', h)
|
|
|
|
|
expect(h.handleCloseTabRef.current).toHaveBeenCalledWith('/vault/test.md')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('file-close-tab does nothing when no active tab', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
h.activeTabPathRef = { current: null }
|
|
|
|
|
dispatchMenuEvent('file-close-tab', h)
|
|
|
|
|
expect(h.handleCloseTabRef.current).not.toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('app-settings triggers open settings', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('app-settings', h)
|
|
|
|
|
expect(h.onOpenSettings).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
feat: reorganize menu bar with Go, Note, and Vault menus
Add missing command palette commands to menu bar and reorganize into
logical groups: File, Edit, View, Go, Note, Vault, Window. New menus
expose navigation filters, note actions, vault management, themes, and
git operations. Context-sensitive items (archive, trash, diff, raw
editor, commit, conflicts) are greyed out when not applicable.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 14:13:54 +01:00
|
|
|
it('view-toggle-properties triggers toggle inspector', () => {
|
feat: populate macOS menu bar with native menus (File, Edit, View, Window) (#77)
* feat: populate macOS menu bar with File, Edit, View, Window menus
Add complete native macOS menu structure with all app actions:
- Laputa menu: About, Settings (Cmd+,), Hide/Quit
- File: New Note (Cmd+N), Quick Open (Cmd+P), Save (Cmd+S), Close Tab (Cmd+W)
- Edit: standard Undo/Redo/Cut/Copy/Paste/Select All
- View: Editor Only (Cmd+1), Editor+Notes (Cmd+2), All Panels (Cmd+3),
Toggle Inspector, Command Palette (Cmd+K)
- Window: Minimize, Maximize, Close Window
All accelerators registered via Tauri menu API. Menu events dispatched
to frontend via useMenuEvents hook. Save/Close Tab items dynamically
disabled when no note tab is active.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: wrap Enter selection assertion in waitFor for effect re-registration
* fix: resolve rebase conflict markers in menu.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:05:24 +01:00
|
|
|
const h = makeHandlers()
|
feat: reorganize menu bar with Go, Note, and Vault menus
Add missing command palette commands to menu bar and reorganize into
logical groups: File, Edit, View, Go, Note, Vault, Window. New menus
expose navigation filters, note actions, vault management, themes, and
git operations. Context-sensitive items (archive, trash, diff, raw
editor, commit, conflicts) are greyed out when not applicable.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 14:13:54 +01:00
|
|
|
dispatchMenuEvent('view-toggle-properties', h)
|
feat: populate macOS menu bar with native menus (File, Edit, View, Window) (#77)
* feat: populate macOS menu bar with File, Edit, View, Window menus
Add complete native macOS menu structure with all app actions:
- Laputa menu: About, Settings (Cmd+,), Hide/Quit
- File: New Note (Cmd+N), Quick Open (Cmd+P), Save (Cmd+S), Close Tab (Cmd+W)
- Edit: standard Undo/Redo/Cut/Copy/Paste/Select All
- View: Editor Only (Cmd+1), Editor+Notes (Cmd+2), All Panels (Cmd+3),
Toggle Inspector, Command Palette (Cmd+K)
- Window: Minimize, Maximize, Close Window
All accelerators registered via Tauri menu API. Menu events dispatched
to frontend via useMenuEvents hook. Save/Close Tab items dynamically
disabled when no note tab is active.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: wrap Enter selection assertion in waitFor for effect re-registration
* fix: resolve rebase conflict markers in menu.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:05:24 +01:00
|
|
|
expect(h.onToggleInspector).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('view-command-palette triggers command palette', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('view-command-palette', h)
|
|
|
|
|
expect(h.onCommandPalette).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
2026-02-28 12:41:57 +01:00
|
|
|
it('view-zoom-in triggers zoom in', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('view-zoom-in', h)
|
|
|
|
|
expect(h.onZoomIn).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('view-zoom-out triggers zoom out', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('view-zoom-out', h)
|
|
|
|
|
expect(h.onZoomOut).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('view-zoom-reset triggers zoom reset', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('view-zoom-reset', h)
|
|
|
|
|
expect(h.onZoomReset).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
feat: reorganize menu bar with Go, Note, and Vault menus
Add missing command palette commands to menu bar and reorganize into
logical groups: File, Edit, View, Go, Note, Vault, Window. New menus
expose navigation filters, note actions, vault management, themes, and
git operations. Context-sensitive items (archive, trash, diff, raw
editor, commit, conflicts) are greyed out when not applicable.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 14:13:54 +01:00
|
|
|
it('edit-find-in-vault triggers search', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('edit-find-in-vault', h)
|
|
|
|
|
expect(h.onSearch).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// Active tab-dependent events
|
feat: keyboard-first navigation — menu bar shortcuts, note list nav, inspector Tab/Enter (#158)
* feat: keyboard-first navigation — menu bar shortcuts, note list nav, inspector Tab/Enter
- Add missing menu bar items: Archive Note (⌘E), Trash Note (⌘⌫),
Find in Vault (⌘⇧F), Go Back (⌘[), Go Forward (⌘])
- Wire new menu events through useMenuEvents → useAppCommands
- Note list: ↑↓ moves highlight, Enter opens selected note (useNoteListKeyboard hook)
- Inspector properties: Tab between rows, Enter to start editing
- Settings panel: auto-focus first input on open
- Extract StatusDot, StateBadge, noteItemStyle from NoteItem (reduces complexity)
- Extract dispatchActiveTabEvent/dispatchOptionalEvent from useMenuEvents
- 21 new tests (useNoteListKeyboard + useMenuEvents for new events)
- All 1275 frontend tests pass, 319 Rust tests pass
- CodeScene quality gates: passed (NoteItem improved from 22→18 complexity)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* design: keyboard-first-nav wireframes (note list highlight, menu shortcuts, inspector tab nav)
* test: add search.rs coverage for fallback branches (qmd_uri_to_vault_path, extract_clean_snippet)
* chore: exclude search.rs and lib.rs from coverage (qmd integration + Tauri setup code)
---------
Co-authored-by: Test <test@test.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 19:32:15 +01:00
|
|
|
it('note-archive triggers archive on active tab', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('note-archive', h)
|
|
|
|
|
expect(h.onArchiveNote).toHaveBeenCalledWith('/vault/test.md')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('note-archive does nothing when no active tab', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
h.activeTabPathRef = { current: null }
|
|
|
|
|
dispatchMenuEvent('note-archive', h)
|
|
|
|
|
expect(h.onArchiveNote).not.toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('note-trash triggers trash on active tab', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('note-trash', h)
|
|
|
|
|
expect(h.onTrashNote).toHaveBeenCalledWith('/vault/test.md')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('note-trash does nothing when no active tab', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
h.activeTabPathRef = { current: null }
|
|
|
|
|
dispatchMenuEvent('note-trash', h)
|
|
|
|
|
expect(h.onTrashNote).not.toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
feat: reorganize menu bar with Go, Note, and Vault menus
Add missing command palette commands to menu bar and reorganize into
logical groups: File, Edit, View, Go, Note, Vault, Window. New menus
expose navigation filters, note actions, vault management, themes, and
git operations. Context-sensitive items (archive, trash, diff, raw
editor, commit, conflicts) are greyed out when not applicable.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 14:13:54 +01:00
|
|
|
// Optional handler events
|
feat: keyboard-first navigation — menu bar shortcuts, note list nav, inspector Tab/Enter (#158)
* feat: keyboard-first navigation — menu bar shortcuts, note list nav, inspector Tab/Enter
- Add missing menu bar items: Archive Note (⌘E), Trash Note (⌘⌫),
Find in Vault (⌘⇧F), Go Back (⌘[), Go Forward (⌘])
- Wire new menu events through useMenuEvents → useAppCommands
- Note list: ↑↓ moves highlight, Enter opens selected note (useNoteListKeyboard hook)
- Inspector properties: Tab between rows, Enter to start editing
- Settings panel: auto-focus first input on open
- Extract StatusDot, StateBadge, noteItemStyle from NoteItem (reduces complexity)
- Extract dispatchActiveTabEvent/dispatchOptionalEvent from useMenuEvents
- 21 new tests (useNoteListKeyboard + useMenuEvents for new events)
- All 1275 frontend tests pass, 319 Rust tests pass
- CodeScene quality gates: passed (NoteItem improved from 22→18 complexity)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* design: keyboard-first-nav wireframes (note list highlight, menu shortcuts, inspector tab nav)
* test: add search.rs coverage for fallback branches (qmd_uri_to_vault_path, extract_clean_snippet)
* chore: exclude search.rs and lib.rs from coverage (qmd integration + Tauri setup code)
---------
Co-authored-by: Test <test@test.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 19:32:15 +01:00
|
|
|
it('view-go-back triggers go back', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('view-go-back', h)
|
|
|
|
|
expect(h.onGoBack).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('view-go-forward triggers go forward', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('view-go-forward', h)
|
|
|
|
|
expect(h.onGoForward).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
2026-03-03 13:19:09 +01:00
|
|
|
it('app-check-for-updates triggers check for updates', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('app-check-for-updates', h)
|
|
|
|
|
expect(h.onCheckForUpdates).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
feat: reorganize menu bar with Go, Note, and Vault menus
Add missing command palette commands to menu bar and reorganize into
logical groups: File, Edit, View, Go, Note, Vault, Window. New menus
expose navigation filters, note actions, vault management, themes, and
git operations. Context-sensitive items (archive, trash, diff, raw
editor, commit, conflicts) are greyed out when not applicable.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 14:13:54 +01:00
|
|
|
// New File menu items
|
|
|
|
|
it('file-new-type triggers create type', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('file-new-type', h)
|
|
|
|
|
expect(h.onCreateType).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// New Edit menu items
|
|
|
|
|
it('edit-toggle-raw-editor triggers toggle raw editor', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('edit-toggle-raw-editor', h)
|
|
|
|
|
expect(h.onToggleRawEditor).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('edit-toggle-diff triggers toggle diff', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('edit-toggle-diff', h)
|
|
|
|
|
expect(h.onToggleDiff).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// New View menu items
|
|
|
|
|
it('view-toggle-ai-chat triggers toggle AI chat', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('view-toggle-ai-chat', h)
|
|
|
|
|
expect(h.onToggleAIChat).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('view-toggle-backlinks triggers toggle inspector', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('view-toggle-backlinks', h)
|
|
|
|
|
expect(h.onToggleInspector).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// Go menu events
|
|
|
|
|
it('go-all-notes selects all filter', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('go-all-notes', h)
|
|
|
|
|
expect(h.onSelectFilter).toHaveBeenCalledWith('all')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('go-archived selects archived filter', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('go-archived', h)
|
|
|
|
|
expect(h.onSelectFilter).toHaveBeenCalledWith('archived')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('go-trash selects trash filter', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('go-trash', h)
|
|
|
|
|
expect(h.onSelectFilter).toHaveBeenCalledWith('trash')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('go-changes selects changes filter', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('go-changes', h)
|
|
|
|
|
expect(h.onSelectFilter).toHaveBeenCalledWith('changes')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// Vault menu events
|
|
|
|
|
it('vault-open triggers open vault', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('vault-open', h)
|
|
|
|
|
expect(h.onOpenVault).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('vault-remove triggers remove active vault', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('vault-remove', h)
|
|
|
|
|
expect(h.onRemoveActiveVault).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('vault-restore-getting-started triggers restore', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('vault-restore-getting-started', h)
|
|
|
|
|
expect(h.onRestoreGettingStarted).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('vault-new-theme triggers create theme', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('vault-new-theme', h)
|
|
|
|
|
expect(h.onCreateTheme).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('vault-restore-default-themes triggers restore default themes', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('vault-restore-default-themes', h)
|
|
|
|
|
expect(h.onRestoreDefaultThemes).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('vault-commit-push triggers commit push', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('vault-commit-push', h)
|
|
|
|
|
expect(h.onCommitPush).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('vault-resolve-conflicts triggers resolve conflicts', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('vault-resolve-conflicts', h)
|
|
|
|
|
expect(h.onResolveConflicts).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('vault-view-changes triggers view changes', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('vault-view-changes', h)
|
|
|
|
|
expect(h.onViewChanges).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('vault-install-mcp triggers install MCP', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('vault-install-mcp', h)
|
|
|
|
|
expect(h.onInstallMcp).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
2026-03-07 01:14:12 +01:00
|
|
|
it('vault-reindex triggers reindex vault', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('vault-reindex', h)
|
|
|
|
|
expect(h.onReindexVault).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
2026-03-09 00:35:21 +01:00
|
|
|
it('vault-reload triggers reload vault', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('vault-reload', h)
|
|
|
|
|
expect(h.onReloadVault).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
2026-03-11 23:36:42 +01:00
|
|
|
// File menu: reopen closed tab
|
|
|
|
|
it('file-reopen-closed-tab triggers reopen closed tab', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('file-reopen-closed-tab', h)
|
|
|
|
|
expect(h.onReopenClosedTab).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
feat: reorganize menu bar with Go, Note, and Vault menus
Add missing command palette commands to menu bar and reorganize into
logical groups: File, Edit, View, Go, Note, Vault, Window. New menus
expose navigation filters, note actions, vault management, themes, and
git operations. Context-sensitive items (archive, trash, diff, raw
editor, commit, conflicts) are greyed out when not applicable.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 14:13:54 +01:00
|
|
|
// Edge cases
|
feat: populate macOS menu bar with native menus (File, Edit, View, Window) (#77)
* feat: populate macOS menu bar with File, Edit, View, Window menus
Add complete native macOS menu structure with all app actions:
- Laputa menu: About, Settings (Cmd+,), Hide/Quit
- File: New Note (Cmd+N), Quick Open (Cmd+P), Save (Cmd+S), Close Tab (Cmd+W)
- Edit: standard Undo/Redo/Cut/Copy/Paste/Select All
- View: Editor Only (Cmd+1), Editor+Notes (Cmd+2), All Panels (Cmd+3),
Toggle Inspector, Command Palette (Cmd+K)
- Window: Minimize, Maximize, Close Window
All accelerators registered via Tauri menu API. Menu events dispatched
to frontend via useMenuEvents hook. Save/Close Tab items dynamically
disabled when no note tab is active.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: wrap Enter selection assertion in waitFor for effect re-registration
* fix: resolve rebase conflict markers in menu.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:05:24 +01:00
|
|
|
it('unknown event ID does nothing', () => {
|
|
|
|
|
const h = makeHandlers()
|
|
|
|
|
dispatchMenuEvent('unknown-event', h)
|
|
|
|
|
expect(h.onSetViewMode).not.toHaveBeenCalled()
|
|
|
|
|
expect(h.onCreateNote).not.toHaveBeenCalled()
|
|
|
|
|
expect(h.onSave).not.toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
})
|