feat: show property kind icons

This commit is contained in:
lucaronin
2026-04-16 07:27:11 +02:00
parent 1b10aa9660
commit f8bd3e1b4a
5 changed files with 81 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
import type { ComponentProps } from 'react'
import { describe, it, expect, vi, beforeEach, beforeAll } from 'vitest'
import { render, screen, fireEvent, waitFor } from '@testing-library/react'
import { render, screen, fireEvent, waitFor, within } from '@testing-library/react'
import { DynamicPropertiesPanel, containsWikilinks } from './DynamicPropertiesPanel'
import type { VaultEntry } from '../types'
import { bindVaultConfigStore, getVaultConfig, resetVaultConfigStore } from '../utils/vaultConfigStore'
@@ -125,6 +125,16 @@ describe('DynamicPropertiesPanel', () => {
expect(screen.getByText('Note')).toBeInTheDocument()
})
it('shows the shared type icon in the type row label', () => {
renderPanel({
content: '# Test\n\nSome words here',
frontmatter: { Status: 'Active' },
onUpdateProperty,
})
expect(screen.getByTestId('type-row-icon')).toBeInTheDocument()
})
it('renders status as colored pill', () => {
renderPanel({ frontmatter: { Status: 'Active' } })
// Status rendered as sentence case
@@ -438,6 +448,15 @@ describe('DynamicPropertiesPanel', () => {
expect(screen.getByText('Icon')).toBeInTheDocument()
})
it('shows a property-kind icon for each suggested slot', () => {
renderPanel({ onAddProperty })
expect(within(findSuggestedSlot('Status')).getByTestId('suggested-property-icon-status')).toBeInTheDocument()
expect(within(findSuggestedSlot('Date')).getByTestId('suggested-property-icon-date')).toBeInTheDocument()
expect(within(findSuggestedSlot('URL')).getByTestId('suggested-property-icon-url')).toBeInTheDocument()
expect(within(findSuggestedSlot('Icon')).getByTestId('suggested-property-icon-text')).toBeInTheDocument()
})
it('hides Status slot when Status property already exists', () => {
renderPanel({
frontmatter: { Status: 'Active' },