test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
2026-04-08 10:22:47 +02:00
|
|
|
import { render, screen, fireEvent, act } from '@testing-library/react'
|
2026-02-24 15:16:26 +01:00
|
|
|
import { TypeCustomizePopover } from './TypeCustomizePopover'
|
|
|
|
|
import { resolveIcon, ICON_OPTIONS } from '../utils/iconRegistry'
|
test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
|
|
|
|
|
describe('resolveIcon', () => {
|
|
|
|
|
it('returns the correct icon component for known name', () => {
|
|
|
|
|
const Icon = resolveIcon('wrench')
|
|
|
|
|
expect(Icon).toBeDefined()
|
2026-02-24 15:16:26 +01:00
|
|
|
// wrench should not be the default fallback (file-text)
|
|
|
|
|
const fileTextIcon = resolveIcon('file-text')
|
|
|
|
|
expect(Icon).not.toBe(fileTextIcon)
|
test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('returns FileText fallback for null', () => {
|
|
|
|
|
const Icon = resolveIcon(null)
|
|
|
|
|
expect(Icon).toBeDefined()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('returns FileText fallback for unknown name', () => {
|
|
|
|
|
const Icon = resolveIcon('nonexistent-icon')
|
|
|
|
|
expect(Icon).toBeDefined()
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
2026-02-24 15:16:26 +01:00
|
|
|
describe('ICON_OPTIONS', () => {
|
|
|
|
|
it('contains 200+ icons', () => {
|
|
|
|
|
expect(ICON_OPTIONS.length).toBeGreaterThanOrEqual(200)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('has unique names', () => {
|
|
|
|
|
const names = ICON_OPTIONS.map((o) => o.name)
|
|
|
|
|
expect(new Set(names).size).toBe(names.length)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('uses kebab-case names', () => {
|
|
|
|
|
for (const option of ICON_OPTIONS) {
|
|
|
|
|
expect(option.name).toMatch(/^[a-z][a-z0-9-]*$/)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
describe('TypeCustomizePopover', () => {
|
|
|
|
|
const onChangeIcon = vi.fn()
|
|
|
|
|
const onChangeColor = vi.fn()
|
2026-03-02 08:37:06 +01:00
|
|
|
const onChangeTemplate = vi.fn()
|
test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
const onClose = vi.fn()
|
|
|
|
|
|
2026-03-02 08:37:06 +01:00
|
|
|
const renderPopover = (overrides: Partial<Parameters<typeof TypeCustomizePopover>[0]> = {}) =>
|
test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
render(
|
|
|
|
|
<TypeCustomizePopover
|
2026-03-02 08:37:06 +01:00
|
|
|
currentIcon={null}
|
|
|
|
|
currentColor={null}
|
|
|
|
|
currentTemplate={null}
|
test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
onChangeIcon={onChangeIcon}
|
|
|
|
|
onChangeColor={onChangeColor}
|
2026-03-02 08:37:06 +01:00
|
|
|
onChangeTemplate={onChangeTemplate}
|
test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
onClose={onClose}
|
2026-03-02 08:37:06 +01:00
|
|
|
{...overrides}
|
test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
/>
|
|
|
|
|
)
|
2026-03-02 08:37:06 +01:00
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
vi.clearAllMocks()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('renders color, icon, and template sections', () => {
|
|
|
|
|
renderPopover()
|
2026-03-29 17:00:04 +02:00
|
|
|
expect(screen.getByText('Color')).toBeInTheDocument()
|
|
|
|
|
expect(screen.getByText('Icon')).toBeInTheDocument()
|
|
|
|
|
expect(screen.getByText('Template')).toBeInTheDocument()
|
test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
expect(screen.getByText('Done')).toBeInTheDocument()
|
2026-04-30 21:01:09 +02:00
|
|
|
}, 10_000)
|
test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
|
2026-04-30 04:14:47 +02:00
|
|
|
it('can hide the template and Done controls for inline appearance editing', () => {
|
|
|
|
|
renderPopover({ showTemplate: false, showDone: false, surface: 'inline' })
|
|
|
|
|
expect(screen.getByText('Color')).toBeInTheDocument()
|
|
|
|
|
expect(screen.getByText('Icon')).toBeInTheDocument()
|
|
|
|
|
expect(screen.queryByText('Template')).not.toBeInTheDocument()
|
|
|
|
|
expect(screen.queryByText('Done')).not.toBeInTheDocument()
|
|
|
|
|
})
|
|
|
|
|
|
2026-02-24 15:16:26 +01:00
|
|
|
it('renders search input', () => {
|
2026-03-02 08:37:06 +01:00
|
|
|
renderPopover()
|
2026-02-24 15:16:26 +01:00
|
|
|
expect(screen.getByPlaceholderText('Search icons…')).toBeInTheDocument()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('filters icons by search query', () => {
|
2026-03-02 08:37:06 +01:00
|
|
|
renderPopover()
|
2026-02-24 15:16:26 +01:00
|
|
|
|
|
|
|
|
const searchInput = screen.getByPlaceholderText('Search icons…')
|
|
|
|
|
fireEvent.change(searchInput, { target: { value: 'book' } })
|
|
|
|
|
|
|
|
|
|
// Should show book-related icons
|
|
|
|
|
expect(screen.getByTitle('book')).toBeInTheDocument()
|
|
|
|
|
expect(screen.getByTitle('book-open')).toBeInTheDocument()
|
|
|
|
|
// Should not show unrelated icons
|
|
|
|
|
expect(screen.queryByTitle('wrench')).not.toBeInTheDocument()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('shows empty state when no icons match search', () => {
|
2026-03-02 08:37:06 +01:00
|
|
|
renderPopover()
|
2026-02-24 15:16:26 +01:00
|
|
|
|
|
|
|
|
const searchInput = screen.getByPlaceholderText('Search icons…')
|
|
|
|
|
fireEvent.change(searchInput, { target: { value: 'zzzznonexistent' } })
|
|
|
|
|
|
|
|
|
|
expect(screen.getByText('No icons found')).toBeInTheDocument()
|
|
|
|
|
})
|
|
|
|
|
|
test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
it('calls onChangeColor when a color is clicked', () => {
|
2026-03-02 08:37:06 +01:00
|
|
|
renderPopover()
|
test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
|
2026-05-02 10:02:57 +02:00
|
|
|
const colorButtons = screen.getAllByTitle(/red|blue|green|purple|yellow|orange|pink/i)
|
test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
fireEvent.click(colorButtons[0])
|
|
|
|
|
|
|
|
|
|
expect(onChangeColor).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('calls onChangeIcon when an icon is clicked', () => {
|
2026-03-02 08:37:06 +01:00
|
|
|
renderPopover()
|
test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
|
|
|
|
|
fireEvent.click(screen.getByTitle('wrench'))
|
|
|
|
|
expect(onChangeIcon).toHaveBeenCalledWith('wrench')
|
|
|
|
|
})
|
|
|
|
|
|
2026-05-02 10:02:57 +02:00
|
|
|
it('renders picker icons slightly larger than the sidebar icon size', () => {
|
|
|
|
|
renderPopover()
|
|
|
|
|
|
|
|
|
|
const icon = screen.getByTitle('wrench').querySelector('svg')
|
|
|
|
|
expect(icon).toHaveAttribute('width', '18')
|
|
|
|
|
expect(icon).toHaveAttribute('height', '18')
|
|
|
|
|
expect(icon).toHaveClass('size-[18px]')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('orders color swatches by hue before neutral gray', () => {
|
|
|
|
|
renderPopover()
|
|
|
|
|
|
|
|
|
|
const colorRow = screen.getByTitle('Red').parentElement
|
|
|
|
|
expect(Array.from(colorRow?.children ?? []).map((element) => element.getAttribute('title'))).toEqual([
|
|
|
|
|
'Red',
|
|
|
|
|
'Orange',
|
|
|
|
|
'Yellow',
|
|
|
|
|
'Green',
|
|
|
|
|
'Blue',
|
|
|
|
|
'Purple',
|
|
|
|
|
'Pink',
|
|
|
|
|
'Gray',
|
|
|
|
|
])
|
|
|
|
|
})
|
|
|
|
|
|
test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
it('calls onClose when Done is clicked', () => {
|
2026-03-02 08:37:06 +01:00
|
|
|
renderPopover()
|
test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
|
|
|
|
|
fireEvent.click(screen.getByText('Done'))
|
|
|
|
|
expect(onClose).toHaveBeenCalled()
|
|
|
|
|
})
|
|
|
|
|
|
2026-05-02 10:02:57 +02:00
|
|
|
it('renders curated color options without the teal near-duplicate', () => {
|
2026-03-02 08:37:06 +01:00
|
|
|
renderPopover()
|
test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
|
2026-05-02 10:02:57 +02:00
|
|
|
expect(screen.queryByTitle('Teal')).not.toBeInTheDocument()
|
2026-02-24 15:16:26 +01:00
|
|
|
expect(screen.getByTitle('Pink')).toBeInTheDocument()
|
test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
})
|
2026-03-02 08:37:06 +01:00
|
|
|
|
|
|
|
|
// --- Template tests ---
|
|
|
|
|
|
|
|
|
|
it('renders template textarea', () => {
|
|
|
|
|
renderPopover()
|
|
|
|
|
expect(screen.getByTestId('template-textarea')).toBeInTheDocument()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('shows placeholder when template is empty', () => {
|
|
|
|
|
renderPopover()
|
|
|
|
|
expect(screen.getByPlaceholderText('Markdown template for new notes of this type…')).toBeInTheDocument()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('displays current template value', () => {
|
|
|
|
|
renderPopover({ currentTemplate: '## Objective\n\n## Notes' })
|
|
|
|
|
const textarea = screen.getByTestId('template-textarea') as HTMLTextAreaElement
|
|
|
|
|
expect(textarea.value).toBe('## Objective\n\n## Notes')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('updates template text on user input', () => {
|
|
|
|
|
renderPopover()
|
|
|
|
|
const textarea = screen.getByTestId('template-textarea')
|
|
|
|
|
fireEvent.change(textarea, { target: { value: '## New Template' } })
|
|
|
|
|
expect((textarea as HTMLTextAreaElement).value).toBe('## New Template')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('calls onChangeTemplate after debounce', async () => {
|
|
|
|
|
vi.useFakeTimers()
|
2026-04-08 10:22:47 +02:00
|
|
|
try {
|
|
|
|
|
renderPopover()
|
|
|
|
|
const textarea = screen.getByTestId('template-textarea')
|
|
|
|
|
fireEvent.change(textarea, { target: { value: '## Debounced' } })
|
|
|
|
|
|
|
|
|
|
// Should not be called immediately
|
|
|
|
|
expect(onChangeTemplate).not.toHaveBeenCalled()
|
|
|
|
|
|
|
|
|
|
// Fast-forward past debounce and flush the resulting state update.
|
|
|
|
|
await act(async () => {
|
|
|
|
|
vi.advanceTimersByTime(600)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
expect(onChangeTemplate).toHaveBeenCalledWith('## Debounced')
|
|
|
|
|
} finally {
|
|
|
|
|
vi.useRealTimers()
|
|
|
|
|
}
|
2026-03-02 08:37:06 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('treats null template as empty string', () => {
|
|
|
|
|
renderPopover({ currentTemplate: null })
|
|
|
|
|
const textarea = screen.getByTestId('template-textarea') as HTMLTextAreaElement
|
|
|
|
|
expect(textarea.value).toBe('')
|
|
|
|
|
})
|
test: add component tests — StatusBar, CommitDialog, DiffView, QuickOpenPalette, ResizeHandle, CreateNoteDialog, EditableValue, TypeCustomizePopover, DynamicPropertiesPanel, InspectorPanels
251 tests covering:
- StatusBar: note count, vault menu interactions
- CommitDialog: file count badge, submit via click/Cmd+Enter, validation
- DiffView: line rendering, color coding, line numbers
- QuickOpenPalette: search, sorting, fuzzy filtering, keyboard navigation
- ResizeHandle: drag with rAF batching, delta accumulation, cursor reset
- CreateNoteDialog: title input, submit, validation, defaultType
- EditableValue: view/edit modes, Enter/Escape/blur, TagPillList CRUD
- TypeCustomizePopover: resolveIcon, color/icon selection
- DynamicPropertiesPanel: properties, status pills, boolean toggle, tags,
add property form, value coercion, delete
- InspectorPanels: relationships, backlinks, git history, navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:02:44 +01:00
|
|
|
})
|