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
4 changes: 2 additions & 2 deletions packages/vuetify/src/components/VBadge/VBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const VBadge = genericComponent<VBadgeSlots>()({
{ ...attrs }
style={ props.style }
>
<div class="v-badge__wrapper">
<props.tag class="v-badge__wrapper">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be fine if we are convinced tag on <v-badge> is never used in real life. Otherwise it is too risky

{ ctx.slots.default?.() }

<MaybeTransition transition={ props.transition }>
Expand Down Expand Up @@ -150,7 +150,7 @@ export const VBadge = genericComponent<VBadgeSlots>()({
}
</span>
</MaybeTransition>
</div>
</props.tag>
</props.tag>
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ describe('VBadge', () => {
const el = wrapper.find('custom-tag').element
expect(el).toHaveTextContent('tag')
})

it('uses the tag for the wrapper element so phrasing content stays valid', () => {
const { wrapper } = render(<VBadge tag="span" content="3">child</VBadge>)
const root = wrapper.find('span.v-badge').element
const wrapperEl = root.querySelector('.v-badge__wrapper')
expect(wrapperEl?.tagName).toBe('SPAN')
})
})

showcase({ stories, props, component: VBadge })
Expand Down
Loading