✅ test: added test file
This commit is contained in:
parent
451f665907
commit
ba8ffaf82f
50
test/VGroup.spec.ts
Normal file
50
test/VGroup.spec.ts
Normal file
|
@ -0,0 +1,50 @@
|
|||
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')
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue
Block a user