visua-vue/test/VGroup.spec.ts
2025-07-21 18:28:28 +02:00

51 lines
1.5 KiB
TypeScript

import { describe, test, expect } from 'vitest'
import { mount } from '@vue/test-utils'
import VGroup from '../src/components/group/VGroup.vue'
describe('VGroup', () => {
test('renders default slot content', () => {
const wrapper = mount(VGroup, {
props: {type: undefined},
slots: {
default: '<span>Test Content</span>',
},
})
expect(wrapper.html()).toContain('Test Content')
})
test('applies default class when no type is specified', () => {
const wrapper = mount(VGroup)
expect(wrapper.classes()).toContain('container')
expect(wrapper.classes()).not.toContain('error')
expect(wrapper.classes()).not.toContain('success')
})
test('applies "error" class when type is "error"', () => {
const wrapper = mount(VGroup, {
props: { type: 'error' },
})
expect(wrapper.classes()).toContain('error')
})
test('applies "success" class when type is "success"', () => {
const wrapper = mount(VGroup, {
props: { type: 'success' },
})
expect(wrapper.classes()).toContain('success')
})
test('applies "disabled" class when disabled is true', () => {
const wrapper = mount(VGroup, {
props: { disabled: true, type: undefined },
})
expect(wrapper.classes()).toContain('disabled')
})
test('does not apply "disabled" class when disabled is false', () => {
const wrapper = mount(VGroup, {
props: { disabled: false, type: undefined },
})
expect(wrapper.classes()).not.toContain('disabled')
})
})