Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/runtime/components/Breadcrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,20 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.breadcrumb |
<template v-for="(item, index) in items" :key="index">
<li data-slot="item" :class="ui.item({ class: [props.ui?.item, item.ui?.item] })">
<ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
<ULinkBase v-bind="slotProps" as="span" :aria-current="(item.active ?? active) && (index === items!.length - 1) ? 'page' : undefined" data-slot="link" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: item.active ?? (index === items!.length - 1), disabled: !!item.disabled, to: !!item.to })">
<slot :name="((item.slot || 'item') as keyof BreadcrumbSlots<T>)" :item="(item as Extract<T, { slot: string; }>)" :active="item.active ?? (index === items!.length - 1)" :index="index" :ui="ui">
<slot :name="((item.slot ? `${item.slot}-leading`: 'item-leading') as keyof BreadcrumbSlots<T>)" :item="(item as Extract<T, { slot: string; }>)" :active="item.active ?? (index === items!.length - 1)" :index="index" :ui="ui">
<UIcon v-if="item.icon" :name="item.icon" data-slot="linkLeadingIcon" :class="ui.linkLeadingIcon({ class: [props.ui?.linkLeadingIcon, item.ui?.linkLeadingIcon], active: item.active ?? (index === items!.length - 1) })" />
<UAvatar v-else-if="item.avatar" :size="((props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" data-slot="linkLeadingAvatar" :class="ui.linkLeadingAvatar({ class: [props.ui?.linkLeadingAvatar, item.ui?.linkLeadingAvatar], active: item.active ?? (index === items!.length - 1) })" />
<ULinkBase v-bind="slotProps" as="span" :aria-current="(item.active ?? active) ? 'page' : undefined" data-slot="link" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: item.active ?? active, disabled: !!item.disabled, to: !!item.to })">
<slot :name="((item.slot || 'item') as keyof BreadcrumbSlots<T>)" :item="(item as Extract<T, { slot: string; }>)" :active="item.active ?? active" :index="index" :ui="ui">
<slot :name="((item.slot ? `${item.slot}-leading`: 'item-leading') as keyof BreadcrumbSlots<T>)" :item="(item as Extract<T, { slot: string; }>)" :active="item.active ?? active" :index="index" :ui="ui">
<UIcon v-if="item.icon" :name="item.icon" data-slot="linkLeadingIcon" :class="ui.linkLeadingIcon({ class: [props.ui?.linkLeadingIcon, item.ui?.linkLeadingIcon], active: item.active ?? active })" />
<UAvatar v-else-if="item.avatar" :size="((props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" data-slot="linkLeadingAvatar" :class="ui.linkLeadingAvatar({ class: [props.ui?.linkLeadingAvatar, item.ui?.linkLeadingAvatar], active: item.active ?? active })" />
</slot>

<span v-if="get(item, props.labelKey as string) || !!slots[(item.slot ? `${item.slot}-label`: 'item-label') as keyof BreadcrumbSlots<T>]" data-slot="linkLabel" :class="ui.linkLabel({ class: [props.ui?.linkLabel, item.ui?.linkLabel] })">
<slot :name="((item.slot ? `${item.slot}-label`: 'item-label') as keyof DynamicSlots<T, 'label'>)" :item="(item as Extract<T, { slot: string; }>)" :active="item.active ?? (index === items!.length - 1)" :index="index">
<slot :name="((item.slot ? `${item.slot}-label`: 'item-label') as keyof DynamicSlots<T, 'label'>)" :item="(item as Extract<T, { slot: string; }>)" :active="item.active ?? active" :index="index">
{{ get(item, props.labelKey as string) }}
</slot>
</span>

<slot :name="((item.slot ? `${item.slot}-trailing`: 'item-trailing') as keyof DynamicSlots<T, 'trailing'>)" :item="(item as Extract<T, { slot: string; }>)" :active="item.active ?? (index === items!.length - 1)" :index="index" />
<slot :name="((item.slot ? `${item.slot}-trailing`: 'item-trailing') as keyof DynamicSlots<T, 'trailing'>)" :item="(item as Extract<T, { slot: string; }>)" :active="item.active ?? active" :index="index" />
</slot>
</ULinkBase>
</ULink>
Expand Down
24 changes: 23 additions & 1 deletion test/components/Breadcrumb.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
['with custom slot', { props, slots: { custom: () => 'Custom slot' } }],
['with separator slot', { props, slots: { separator: () => '/' } }]
])('renders %s correctly', async (nameOrHtml: string, options: { props?: BreadcrumbProps, slots?: Partial<BreadcrumbSlots & { custom: () => 'Custom slot' }> }) => {
const html = await ComponentRender(nameOrHtml, options, Breadcrumb)
const html = await ComponentRender(nameOrHtml, { ...options, route: '/components/breadcrumb' }, Breadcrumb)
expect(html).toMatchSnapshot()

Check failure on line 46 in test/components/Breadcrumb.spec.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

test/components/Breadcrumb.spec.ts > Breadcrumb > renders with item-trailing slot correctly

Error: Snapshot `Breadcrumb > renders with item-trailing slot correctly 1` mismatched - Expected + Received "<nav aria-label="breadcrumb" data-slot="root" class="relative min-w-0"> <ol data-slot="list" class="flex items-center gap-1.5"> - <li data-slot="item" class="flex min-w-0"><a href="/" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium hover:text-default transition-colors"><span data-slot="root" class="inline-flex items-center justify-center select-none rounded-full align-middle bg-elevated size-5 text-[10px] shrink-0"><img src="https://github.com/benjamincanac.png" alt="Benjamin Canac" width="20" height="20" data-slot="image" class="h-full w-full rounded-[inherit] object-cover"></span><span data-slot="linkLabel" class="truncate">Home</span>Item trailing slot</a></li> + <li data-slot="item" class="flex min-w-0"><a href="/" aria-current="page" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-primary font-semibold"><span data-slot="root" class="inline-flex items-center justify-center select-none rounded-full align-middle bg-elevated size-5 text-[10px] shrink-0"><img src="https://github.com/benjamincanac.png" alt="Benjamin Canac" width="20" height="20" data-slot="image" class="h-full w-full rounded-[inherit] object-cover"></span><span data-slot="linkLabel" class="truncate">Home</span>Item trailing slot</a></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> <li data-slot="item" class="flex min-w-0"><span data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium cursor-not-allowed opacity-75"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Components</span>Item trailing slot</span></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> - <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-primary font-semibold"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Breadcrumb</span></a></li> + <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium hover:text-default transition-colors"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Breadcrumb</span></a></li> <!--v-if--> </ol> </nav>" ❯ test/components/Breadcrumb.spec.ts:46:18

Check failure on line 46 in test/components/Breadcrumb.spec.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

test/components/Breadcrumb.spec.ts > Breadcrumb > renders with item-label slot correctly

Error: Snapshot `Breadcrumb > renders with item-label slot correctly 1` mismatched - Expected + Received "<nav aria-label="breadcrumb" data-slot="root" class="relative min-w-0"> <ol data-slot="list" class="flex items-center gap-1.5"> - <li data-slot="item" class="flex min-w-0"><a href="/" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium hover:text-default transition-colors"><span data-slot="root" class="inline-flex items-center justify-center select-none rounded-full align-middle bg-elevated size-5 text-[10px] shrink-0"><img src="https://github.com/benjamincanac.png" alt="Benjamin Canac" width="20" height="20" data-slot="image" class="h-full w-full rounded-[inherit] object-cover"></span><span data-slot="linkLabel" class="truncate">Item label slot</span></a></li> + <li data-slot="item" class="flex min-w-0"><a href="/" aria-current="page" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-primary font-semibold"><span data-slot="root" class="inline-flex items-center justify-center select-none rounded-full align-middle bg-elevated size-5 text-[10px] shrink-0"><img src="https://github.com/benjamincanac.png" alt="Benjamin Canac" width="20" height="20" data-slot="image" class="h-full w-full rounded-[inherit] object-cover"></span><span data-slot="linkLabel" class="truncate">Item label slot</span></a></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> <li data-slot="item" class="flex min-w-0"><span data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium cursor-not-allowed opacity-75"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Item label slot</span></span></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> - <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-primary font-semibold"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Breadcrumb</span></a></li> + <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium hover:text-default transition-colors"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Breadcrumb</span></a></li> <!--v-if--> </ol> </nav>" ❯ test/components/Breadcrumb.spec.ts:46:18

Check failure on line 46 in test/components/Breadcrumb.spec.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

test/components/Breadcrumb.spec.ts > Breadcrumb > renders with item-leading slot correctly

Error: Snapshot `Breadcrumb > renders with item-leading slot correctly 1` mismatched - Expected + Received "<nav aria-label="breadcrumb" data-slot="root" class="relative min-w-0"> <ol data-slot="list" class="flex items-center gap-1.5"> - <li data-slot="item" class="flex min-w-0"><a href="/" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium hover:text-default transition-colors">Item leading slot<span data-slot="linkLabel" class="truncate">Home</span></a></li> + <li data-slot="item" class="flex min-w-0"><a href="/" aria-current="page" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-primary font-semibold">Item leading slot<span data-slot="linkLabel" class="truncate">Home</span></a></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> <li data-slot="item" class="flex min-w-0"><span data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium cursor-not-allowed opacity-75">Item leading slot<span data-slot="linkLabel" class="truncate">Components</span></span></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> - <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-primary font-semibold"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Breadcrumb</span></a></li> + <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium hover:text-default transition-colors"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Breadcrumb</span></a></li> <!--v-if--> </ol> </nav>" ❯ test/components/Breadcrumb.spec.ts:46:18

Check failure on line 46 in test/components/Breadcrumb.spec.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

test/components/Breadcrumb.spec.ts > Breadcrumb > renders with item slot correctly

Error: Snapshot `Breadcrumb > renders with item slot correctly 1` mismatched - Expected + Received "<nav aria-label="breadcrumb" data-slot="root" class="relative min-w-0"> <ol data-slot="list" class="flex items-center gap-1.5"> - <li data-slot="item" class="flex min-w-0"><a href="/" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium hover:text-default transition-colors">Item slot</a></li> + <li data-slot="item" class="flex min-w-0"><a href="/" aria-current="page" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-primary font-semibold">Item slot</a></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> <li data-slot="item" class="flex min-w-0"><span data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium cursor-not-allowed opacity-75">Item slot</span></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> - <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-primary font-semibold"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Breadcrumb</span></a></li> + <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium hover:text-default transition-colors"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Breadcrumb</span></a></li> <!--v-if--> </ol> </nav>" ❯ test/components/Breadcrumb.spec.ts:46:18

Check failure on line 46 in test/components/Breadcrumb.spec.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

test/components/Breadcrumb.spec.ts > Breadcrumb > renders with ui correctly

Error: Snapshot `Breadcrumb > renders with ui correctly 1` mismatched - Expected + Received "<nav aria-label="breadcrumb" data-slot="root" class="relative min-w-0"> <ol data-slot="list" class="flex items-center gap-1.5"> - <li data-slot="item" class="flex min-w-0"><a href="/" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted hover:text-default transition-colors font-bold"><span data-slot="root" class="inline-flex items-center justify-center select-none rounded-full align-middle bg-elevated size-5 text-[10px] shrink-0"><img src="https://github.com/benjamincanac.png" alt="Benjamin Canac" width="20" height="20" data-slot="image" class="h-full w-full rounded-[inherit] object-cover"></span><span data-slot="linkLabel" class="truncate">Home</span></a></li> + <li data-slot="item" class="flex min-w-0"><a href="/" aria-current="page" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-primary font-bold"><span data-slot="root" class="inline-flex items-center justify-center select-none rounded-full align-middle bg-elevated size-5 text-[10px] shrink-0"><img src="https://github.com/benjamincanac.png" alt="Benjamin Canac" width="20" height="20" data-slot="image" class="h-full w-full rounded-[inherit] object-cover"></span><span data-slot="linkLabel" class="truncate">Home</span></a></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> <li data-slot="item" class="flex min-w-0"><span data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted cursor-not-allowed opacity-75 font-bold"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Components</span></span></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> - <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-primary font-bold"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Breadcrumb</span></a></li> + <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted hover:text-default transition-colors font-bold"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Breadcrumb</span></a></li> <!--v-if--> </ol> </nav>" ❯ test/components/Breadcrumb.spec.ts:46:18

Check failure on line 46 in test/components/Breadcrumb.spec.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

test/components/Breadcrumb.spec.ts > Breadcrumb > renders with class correctly

Error: Snapshot `Breadcrumb > renders with class correctly 1` mismatched - Expected + Received "<nav aria-label="breadcrumb" data-slot="root" class="relative min-w-0 w-48"> <ol data-slot="list" class="flex items-center gap-1.5"> - <li data-slot="item" class="flex min-w-0"><a href="/" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium hover:text-default transition-colors"><span data-slot="root" class="inline-flex items-center justify-center select-none rounded-full align-middle bg-elevated size-5 text-[10px] shrink-0"><img src="https://github.com/benjamincanac.png" alt="Benjamin Canac" width="20" height="20" data-slot="image" class="h-full w-full rounded-[inherit] object-cover"></span><span data-slot="linkLabel" class="truncate">Home</span></a></li> + <li data-slot="item" class="flex min-w-0"><a href="/" aria-current="page" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-primary font-semibold"><span data-slot="root" class="inline-flex items-center justify-center select-none rounded-full align-middle bg-elevated size-5 text-[10px] shrink-0"><img src="https://github.com/benjamincanac.png" alt="Benjamin Canac" width="20" height="20" data-slot="image" class="h-full w-full rounded-[inherit] object-cover"></span><span data-slot="linkLabel" class="truncate">Home</span></a></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> <li data-slot="item" class="flex min-w-0"><span data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium cursor-not-allowed opacity-75"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Components</span></span></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> - <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-primary font-semibold"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Breadcrumb</span></a></li> + <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium hover:text-default transition-colors"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Breadcrumb</span></a></li> <!--v-if--> </ol> </nav>" ❯ test/components/Breadcrumb.spec.ts:46:18

Check failure on line 46 in test/components/Breadcrumb.spec.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

test/components/Breadcrumb.spec.ts > Breadcrumb > renders with as correctly

Error: Snapshot `Breadcrumb > renders with as correctly 1` mismatched - Expected + Received "<div aria-label="breadcrumb" data-slot="root" class="relative min-w-0"> <ol data-slot="list" class="flex items-center gap-1.5"> - <li data-slot="item" class="flex min-w-0"><a href="/" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium hover:text-default transition-colors"><span data-slot="root" class="inline-flex items-center justify-center select-none rounded-full align-middle bg-elevated size-5 text-[10px] shrink-0"><img src="https://github.com/benjamincanac.png" alt="Benjamin Canac" width="20" height="20" data-slot="image" class="h-full w-full rounded-[inherit] object-cover"></span><span data-slot="linkLabel" class="truncate">Home</span></a></li> + <li data-slot="item" class="flex min-w-0"><a href="/" aria-current="page" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-primary font-semibold"><span data-slot="root" class="inline-flex items-center justify-center select-none rounded-full align-middle bg-elevated size-5 text-[10px] shrink-0"><img src="https://github.com/benjamincanac.png" alt="Benjamin Canac" width="20" height="20" data-slot="image" class="h-full w-full rounded-[inherit] object-cover"></span><span data-slot="linkLabel" class="truncate">Home</span></a></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> <li data-slot="item" class="flex min-w-0"><span data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium cursor-not-allowed opacity-75"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Components</span></span></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> - <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-primary font-semibold"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Breadcrumb</span></a></li> + <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium hover:text-default transition-colors"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Breadcrumb</span></a></li> <!--v-if--> </ol> </div>" ❯ test/components/Breadcrumb.spec.ts:46:18

Check failure on line 46 in test/components/Breadcrumb.spec.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

test/components/Breadcrumb.spec.ts > Breadcrumb > renders with separatorIcon correctly

Error: Snapshot `Breadcrumb > renders with separatorIcon correctly 1` mismatched - Expected + Received "<nav aria-label="breadcrumb" data-slot="root" class="relative min-w-0"> <ol data-slot="list" class="flex items-center gap-1.5"> - <li data-slot="item" class="flex min-w-0"><a href="/" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium hover:text-default transition-colors"><span data-slot="root" class="inline-flex items-center justify-center select-none rounded-full align-middle bg-elevated size-5 text-[10px] shrink-0"><img src="https://github.com/benjamincanac.png" alt="Benjamin Canac" width="20" height="20" data-slot="image" class="h-full w-full rounded-[inherit] object-cover"></span><span data-slot="linkLabel" class="truncate">Home</span></a></li> + <li data-slot="item" class="flex min-w-0"><a href="/" aria-current="page" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-primary font-semibold"><span data-slot="root" class="inline-flex items-center justify-center select-none rounded-full align-middle bg-elevated size-5 text-[10px] shrink-0"><img src="https://github.com/benjamincanac.png" alt="Benjamin Canac" width="20" height="20" data-slot="image" class="h-full w-full rounded-[inherit] object-cover"></span><span data-slot="linkLabel" class="truncate">Home</span></a></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> <li data-slot="item" class="flex min-w-0"><span data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium cursor-not-allowed opacity-75"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Components</span></span></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> - <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-primary font-semibold"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Breadcrumb</span></a></li> + <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium hover:text-default transition-colors"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Breadcrumb</span></a></li> <!--v-if--> </ol> </nav>" ❯ test/components/Breadcrumb.spec.ts:46:18

Check failure on line 46 in test/components/Breadcrumb.spec.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

test/components/Breadcrumb.spec.ts > Breadcrumb > renders with labelKey correctly

Error: Snapshot `Breadcrumb > renders with labelKey correctly 1` mismatched - Expected + Received @@ -4,9 +4,9 @@ <!--v-if--> </a></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> <li data-slot="item" class="flex min-w-0"><span data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium cursor-not-allowed opacity-75"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">i-lucide-box</span></span></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> - <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-primary font-semibold"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">i-lucide-link</span></a></li> + <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium hover:text-default transition-colors"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">i-lucide-link</span></a></li> <!--v-if--> </ol> </nav>" ❯ test/components/Breadcrumb.spec.ts:46:18

Check failure on line 46 in test/components/Breadcrumb.spec.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

test/components/Breadcrumb.spec.ts > Breadcrumb > renders with items correctly

Error: Snapshot `Breadcrumb > renders with items correctly 1` mismatched - Expected + Received @@ -2,9 +2,9 @@ <ol data-slot="list" class="flex items-center gap-1.5"> <li data-slot="item" class="flex min-w-0"><a href="/" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium hover:text-default transition-colors"><span data-slot="root" class="inline-flex items-center justify-center select-none rounded-full align-middle bg-elevated size-5 text-[10px] shrink-0"><img src="https://github.com/benjamincanac.png" alt="Benjamin Canac" width="20" height="20" data-slot="image" class="h-full w-full rounded-[inherit] object-cover"></span><span data-slot="linkLabel" class="truncate">Home</span></a></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> <li data-slot="item" class="flex min-w-0"><span data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium cursor-not-allowed opacity-75"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Components</span></span></li> <li role="presentation" aria-hidden="true" data-slot="separator" class="flex"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="separatorIcon" class="shrink-0 size-5 text-muted"></svg></li> - <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-primary font-semibold"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Breadcrumb</span></a></li> + <li data-slot="item" class="flex min-w-0"><a href="/components/breadcrumb" data-slot="link" class="group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-primary text-muted font-medium hover:text-default transition-colors"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 16 16" data-slot="linkLeadingIcon" class="shrink-0 size-5"></svg><span data-slot="linkLabel" class="truncate">Breadcrumb</span></a></li> <!--v-if--> </ol> </nav>" ❯ test/components/Breadcrumb.spec.ts:46:18
})

it('passes accessibility tests', async () => {
Expand All @@ -53,4 +53,26 @@

expect(await axe(wrapper.element)).toHaveNoViolations()
})

it('highlights the current route link as active', async () => {
const wrapper = await mountSuspended(Breadcrumb, {
props: {
items: [{
label: 'Home',
to: '/'
}, {
label: 'Components',
to: '/components'
}, {
label: 'Breadcrumb',
to: '/components/breadcrumb'
}]
},
route: '/components'
})

const activeLink = wrapper.find('[aria-current="page"]')
expect(activeLink.exists()).toBe(true)
expect(activeLink.html()).toContain('Components')
})
})