feat(useKbd): new composable (#73)

This commit is contained in:
Benjamin Canac
2024-04-23 11:52:09 +02:00
committed by GitHub
parent 89ff6b6702
commit f076019f8f
14 changed files with 153 additions and 87 deletions

View File

@@ -11,11 +11,11 @@ describe('DropdownMenu', () => {
}, {
label: 'Edit',
icon: 'i-heroicons-pencil-square-20-solid',
shortcuts: ['E']
kbds: ['E']
}, {
label: 'Duplicate',
icon: 'i-heroicons-document-duplicate-20-solid',
shortcuts: ['D'],
kbds: ['D'],
disabled: true,
slot: 'custom'
}]

View File

@@ -18,9 +18,9 @@ describe('Tooltip', () => {
// Props
['with text', { props: { text: 'Tooltip', open: true, portal: false } }],
['with arrow', { props: { text: 'Tooltip', arrow: true, open: true, portal: false } }],
['with shortcuts', { props: { text: 'Tooltip', shortcuts: ['', 'K'], open: true, portal: false } }],
['with kbds', { props: { text: 'Tooltip', kbds: ['meta', 'K'], open: true, portal: false } }],
// Slots
['with default slot', { props: { text: 'Tooltip', shortcuts: ['', 'K'], open: true, portal: false }, slots: { default: () => 'Default slot' } }],
['with default slot', { props: { text: 'Tooltip', kbds: ['meta', 'K'], open: true, portal: false }, slots: { default: () => 'Default slot' } }],
['with content slot', { props: { open: true, portal: false }, slots: { content: () => 'Content slot' } }]
])('renders %s correctly', async (nameOrHtml: string, options: { props?: TooltipProps, slots?: Partial<TooltipSlots> }) => {
const html = await ComponentRender(nameOrHtml, options, TooltipWrapper)