mirror of
https://github.com/kuhyx/steam-backlog-enforcer.git
synced 2026-11-24 02:06:18 +01:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWYNS1qAMRdgAtbr5Rq
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { useIcons } from '../test/iconLedger'
|
|
import { contextPreview } from './preview'
|
|
import type { IconId } from './registry'
|
|
|
|
describe('contextPreview: the icon as it looks where it is used', () => {
|
|
it.each<[IconId, string, string]>([
|
|
['nav.gaming', '.nav-link', '🕹️'],
|
|
['palette.open', '.palette-btn', '⌨️'],
|
|
['cmd.install', '.btn', '📥'],
|
|
['job.state.failed', '.pill', '💔'],
|
|
['notice.info', '.notice', '💡'],
|
|
])('%s renders inside %s with the chosen glyph and word', (id, shell, alt) => {
|
|
useIcons({ [id]: { word: 'shown here', glyph: alt } })
|
|
const el = contextPreview(id)
|
|
expect(el).toHaveAttribute('inert')
|
|
const host = el.querySelector(shell)
|
|
expect(host).not.toBeNull()
|
|
expect(host?.textContent).toContain(alt)
|
|
expect(host?.querySelector('.icon-word')?.textContent).toBe('Shown here')
|
|
})
|
|
|
|
it('shows the default glyph and no word before any choice', () => {
|
|
const el = contextPreview('cmd.install')
|
|
expect(el.textContent).toContain('⬇️')
|
|
expect(el.querySelector('.icon-word')).toBeNull()
|
|
})
|
|
})
|