32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { h } from 'vue'
|
|
import { mount } from '@vue/test-utils'
|
|
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '../src/lib'
|
|
|
|
describe('Card', () => {
|
|
it('renders header, title, description, content, and footer together', () => {
|
|
const wrapper = mount(Card, {
|
|
slots: {
|
|
default: () => [
|
|
h(CardHeader, undefined, {
|
|
default: () => [
|
|
h(CardTitle, undefined, { default: () => 'Elysium' }),
|
|
h(CardDescription, undefined, { default: () => 'The blessed fields' }),
|
|
],
|
|
}),
|
|
h(CardContent, undefined, { default: () => 'A resting place for the virtuous.' }),
|
|
h(CardFooter, undefined, { default: () => 'Enter' }),
|
|
],
|
|
},
|
|
})
|
|
expect(wrapper.text()).toContain('Elysium')
|
|
expect(wrapper.text()).toContain('The blessed fields')
|
|
expect(wrapper.text()).toContain('A resting place for the virtuous.')
|
|
expect(wrapper.text()).toContain('Enter')
|
|
})
|
|
|
|
it('exposes a data-slot attribute for styling hooks', () => {
|
|
const wrapper = mount(Card)
|
|
expect(wrapper.attributes('data-slot')).toBe('card')
|
|
})
|
|
})
|