diff --git a/src/runtime/components/PageCard.vue b/src/runtime/components/PageCard.vue index 2c57b52ff1..39ea975c01 100644 --- a/src/runtime/components/PageCard.vue +++ b/src/runtime/components/PageCard.vue @@ -127,6 +127,7 @@ const ariaLabel = computed(() => { { expect(await axe(wrapper.element)).toHaveNoViolations() }) + + it('passes aria attributes to the root element', async () => { + const wrapper = await mountSuspended(PageCard, { + props: { title: 'Title' }, + attrs: { 'aria-selected': 'true', 'aria-label': 'Custom label' } + }) + const root = wrapper.find('[data-slot="root"]') + expect(root.attributes('aria-selected')).toBe('true') + expect(root.attributes('aria-label')).toBe('Custom label') + }) + + it('passes aria attributes to the root element when to is present', async () => { + const wrapper = await mountSuspended(PageCard, { + props: { title: 'Title', to: 'https://example.com' }, + attrs: { 'aria-selected': 'true' } + }) + const root = wrapper.find('[data-slot="root"]') + expect(root.attributes('aria-selected')).toBe('true') + }) })