feat: add note layout preference
This commit is contained in:
@@ -25,6 +25,8 @@ function makeConfig(overrides: Record<string, unknown> = {}) {
|
||||
onToggleInspector: vi.fn(),
|
||||
onToggleDiff: vi.fn(),
|
||||
onToggleRawEditor: vi.fn(),
|
||||
noteLayout: 'centered',
|
||||
onToggleNoteLayout: vi.fn(),
|
||||
onToggleAIChat: vi.fn(),
|
||||
onOpenVault: vi.fn(),
|
||||
activeNoteModified: false,
|
||||
@@ -260,6 +262,29 @@ describe('useCommandRegistry', () => {
|
||||
expect(findCommand(result.current, 'toggle-raw-editor')?.enabled).toBe(false)
|
||||
})
|
||||
|
||||
it('exposes a command palette action for the note layout preference', () => {
|
||||
const onToggleNoteLayout = vi.fn()
|
||||
const config = makeConfig({ noteLayout: 'centered', onToggleNoteLayout })
|
||||
const { result } = renderHook(() => useCommandRegistry(config))
|
||||
const cmd = findCommand(result.current, 'toggle-note-layout')
|
||||
|
||||
expect(cmd).toBeDefined()
|
||||
expect(cmd!.group).toBe('View')
|
||||
expect(cmd!.label).toBe('Use Left-Aligned Note Layout')
|
||||
expect(cmd!.keywords).toContain('wide')
|
||||
|
||||
cmd!.execute()
|
||||
|
||||
expect(onToggleNoteLayout).toHaveBeenCalledOnce()
|
||||
})
|
||||
|
||||
it('updates note layout command copy when left alignment is active', () => {
|
||||
const config = makeConfig({ noteLayout: 'left' })
|
||||
const { result } = renderHook(() => useCommandRegistry(config))
|
||||
|
||||
expect(findCommand(result.current, 'toggle-note-layout')?.label).toBe('Use Centered Note Layout')
|
||||
})
|
||||
|
||||
it('includes a New AI chat command that opens and resets the panel session', () => {
|
||||
const config = makeConfig()
|
||||
const dispatchSpy = vi.spyOn(window, 'dispatchEvent')
|
||||
|
||||
Reference in New Issue
Block a user