From 8bf868875bd6c29397f4517c6a28b2e32cfa7139 Mon Sep 17 00:00:00 2001 From: lucaronin Date: Sat, 21 Mar 2026 03:32:16 +0100 Subject: [PATCH] test: add sidebar emoji icon rendering tests Verify that SectionChildItem renders emoji icons before note titles in expanded sidebar sections, and that notes without icons render without any extra content. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/components/Sidebar.test.tsx | 45 +++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/components/Sidebar.test.tsx b/src/components/Sidebar.test.tsx index 37adccf7..c6b617e0 100644 --- a/src/components/Sidebar.test.tsx +++ b/src/components/Sidebar.test.tsx @@ -1058,4 +1058,49 @@ describe('Sidebar', () => { fireEvent.click(screen.getByText('Inbox')) expect(onSelect).toHaveBeenCalledWith({ kind: 'filter', filter: 'inbox' }) }) + + describe('emoji icon in sidebar section children', () => { + const entriesWithEmoji: VaultEntry[] = [ + { + path: '/vault/project.md', filename: 'project.md', title: 'Project', isA: 'Type', + aliases: [], belongsTo: [], relatedTo: [], status: null, owner: null, cadence: null, + archived: false, trashed: false, trashedAt: null, modifiedAt: 1700000000, createdAt: null, + fileSize: 200, snippet: '', wordCount: 0, relationships: {}, + icon: 'rocket-launch', color: 'purple', order: null, sidebarLabel: null, template: null, + sort: null, view: null, visible: null, outgoingLinks: [], properties: {}, + }, + { + path: '/vault/project/build-app.md', filename: 'build-app.md', title: 'Build App', + isA: 'Project', aliases: [], belongsTo: [], relatedTo: [], status: null, owner: null, + cadence: null, archived: false, trashed: false, trashedAt: null, modifiedAt: 1700000000, + createdAt: null, fileSize: 300, snippet: '', wordCount: 0, relationships: {}, + icon: '🚀', color: null, order: null, sidebarLabel: null, template: null, + sort: null, view: null, visible: null, outgoingLinks: [], properties: {}, + }, + { + path: '/vault/project/no-icon.md', filename: 'no-icon.md', title: 'No Icon Project', + isA: 'Project', aliases: [], belongsTo: [], relatedTo: [], status: null, owner: null, + cadence: null, archived: false, trashed: false, trashedAt: null, modifiedAt: 1700000000, + createdAt: null, fileSize: 150, snippet: '', wordCount: 0, relationships: {}, + icon: null, color: null, order: null, sidebarLabel: null, template: null, + sort: null, view: null, visible: null, outgoingLinks: [], properties: {}, + }, + ] + + it('shows emoji icon before title in expanded section child', () => { + render( {}} />) + fireEvent.click(screen.getByLabelText('Expand Projects')) + const buildApp = screen.getByText('Build App') + const parent = buildApp.closest('div')! + expect(parent.textContent).toBe('🚀Build App') + }) + + it('does not show emoji for notes without icon', () => { + render( {}} />) + fireEvent.click(screen.getByLabelText('Expand Projects')) + const noIcon = screen.getByText('No Icon Project') + const parent = noIcon.closest('div')! + expect(parent.textContent).toBe('No Icon Project') + }) + }) })