feat: add emoji icon picker for notes stored in frontmatter
Every note can now have an optional emoji icon (frontmatter `icon` field). The icon is displayed in the editor header, note list, search results, and Quick Open. Includes command palette commands "Set Note Icon" and "Remove Note Icon", plus full test coverage (Vitest + Playwright). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
39
src/utils/__tests__/emoji.test.ts
Normal file
39
src/utils/__tests__/emoji.test.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { isEmoji } from '../emoji'
|
||||
|
||||
describe('isEmoji', () => {
|
||||
it('returns true for common emoji', () => {
|
||||
expect(isEmoji('🎯')).toBe(true)
|
||||
expect(isEmoji('🔥')).toBe(true)
|
||||
expect(isEmoji('🚀')).toBe(true)
|
||||
expect(isEmoji('❤️')).toBe(true)
|
||||
expect(isEmoji('✨')).toBe(true)
|
||||
})
|
||||
|
||||
it('returns false for Phosphor icon names', () => {
|
||||
expect(isEmoji('cooking-pot')).toBe(false)
|
||||
expect(isEmoji('file-text')).toBe(false)
|
||||
expect(isEmoji('rocket')).toBe(false)
|
||||
expect(isEmoji('star')).toBe(false)
|
||||
})
|
||||
|
||||
it('returns false for empty string', () => {
|
||||
expect(isEmoji('')).toBe(false)
|
||||
})
|
||||
|
||||
it('returns false for regular text', () => {
|
||||
expect(isEmoji('hello')).toBe(false)
|
||||
expect(isEmoji('ABC')).toBe(false)
|
||||
expect(isEmoji('123')).toBe(false)
|
||||
})
|
||||
|
||||
it('handles compound emoji (ZWJ sequences)', () => {
|
||||
expect(isEmoji('👨💻')).toBe(true)
|
||||
expect(isEmoji('🧑🔬')).toBe(true)
|
||||
})
|
||||
|
||||
it('returns false for multi-emoji strings', () => {
|
||||
expect(isEmoji('🔥🚀')).toBe(false)
|
||||
expect(isEmoji('hi 🎯')).toBe(false)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user