19 lines
689 B
TypeScript
19 lines
689 B
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { mount } from '@vue/test-utils'
|
|
import { Badge } from '../src/lib'
|
|
|
|
describe('Badge', () => {
|
|
it('defaults to the primary variant', () => {
|
|
const wrapper = mount(Badge, { slots: { default: 'Sacred' } })
|
|
expect(wrapper.classes().join(' ')).toContain('bg-primary')
|
|
})
|
|
|
|
it.each(['secondary', 'info', 'success', 'warning', 'danger'] as const)(
|
|
'applies the %s variant class',
|
|
(variant) => {
|
|
const wrapper = mount(Badge, { props: { variant } })
|
|
const expectedClass = variant === 'danger' ? 'bg-destructive' : `bg-${variant}`
|
|
expect(wrapper.classes().join(' ')).toContain(expectedClass)
|
|
},
|
|
)
|
|
})
|