diff --git a/test/VGroup.spec.ts b/test/VGroup.spec.ts new file mode 100644 index 0000000..24dedac --- /dev/null +++ b/test/VGroup.spec.ts @@ -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: 'Test Content', + }, + }) + 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') + }) +})