mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
feat(NavigationMenu): rename links to items + improve slots
This commit is contained in:
@@ -3,7 +3,7 @@ import NavigationMenu, { type NavigationMenuProps } from '../../src/runtime/comp
|
||||
import ComponentRender from '../component-render'
|
||||
|
||||
describe('NavigationMenu', () => {
|
||||
const links = [{
|
||||
const items = [{
|
||||
label: 'Profile',
|
||||
avatar: {
|
||||
src: 'https://avatars.githubusercontent.com/u/739984?v=4'
|
||||
@@ -20,16 +20,25 @@ describe('NavigationMenu', () => {
|
||||
}, {
|
||||
label: 'Popover',
|
||||
icon: 'i-heroicons-command-line',
|
||||
to: '/popover'
|
||||
to: '/popover',
|
||||
slot: 'custom'
|
||||
}]
|
||||
|
||||
const props = { items }
|
||||
|
||||
it.each([
|
||||
// Props
|
||||
['with links', { props: { links } }],
|
||||
['with orientation vertical', { props: { links, orientation: 'vertical' as const } }],
|
||||
['with class', { props: { links, class: 'w-48' } }],
|
||||
['with ui', { props: { links, ui: { links, linkLeadingIcon: 'size-4' } } }]
|
||||
])('renders %s correctly', async (nameOrHtml: string, options: { props?: NavigationMenuProps<typeof links[number]>, slots?: any }) => {
|
||||
['with items', { props }],
|
||||
['with orientation vertical', { props: { ...props, orientation: 'vertical' as const } }],
|
||||
['with class', { props: { ...props, class: 'w-48' } }],
|
||||
['with ui', { props: { items, ui: { linkLeadingIcon: 'size-4' } } }],
|
||||
// Slots
|
||||
['with leading slot', { props, slots: { leading: () => 'Leading slot' } }],
|
||||
['with label slot', { props, slots: { label: () => 'Label slot' } }],
|
||||
['with trailing slot', { props, slots: { trailing: () => 'Trailing slot' } }],
|
||||
['with item slot', { props, slots: { item: () => 'Item slot' } }],
|
||||
['with custom slot', { props, slots: { custom: () => 'Custom slot' } }]
|
||||
])('renders %s correctly', async (nameOrHtml: string, options: { props?: NavigationMenuProps<typeof items[number]>, slots?: any }) => {
|
||||
const html = await ComponentRender(nameOrHtml, options, NavigationMenu)
|
||||
expect(html).toMatchSnapshot()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user