import { describe, expect, it } from 'vitest';
import { cv } from '../../lib/cv.js';
describe('cv()', () => {
    const button = cv('inline-flex items-center', {
        variants: {
            intent: {
                primary: 'bg-primary text-white',
                secondary: 'bg-secondary text-foreground',
            },
            size: {
                sm: 'px-2 py-1 text-xs',
                md: 'px-4 py-2 text-sm',
                lg: 'px-6 py-3 text-base',
            },
        },
        defaultVariants: { intent: 'primary', size: 'md' },
    });
    it('returns the base class and default variant classes when no props supplied', () => {
        const out = button();
        expect(out).toContain('inline-flex');
        expect(out).toContain('bg-primary');
        expect(out).toContain('text-white');
        expect(out).toContain('px-4 py-2 text-sm');
    });
    it('overrides default variants when explicit values are supplied', () => {
        const out = button({ intent: 'secondary', size: 'sm' });
        expect(out).toContain('bg-secondary');
        expect(out).toContain('text-foreground');
        expect(out).toContain('px-2 py-1 text-xs');
        expect(out).not.toContain('bg-primary');
    });
    it('appends the `class` escape hatch', () => {
        const out = button({ class: 'shadow-md' });
        expect(out).toContain('shadow-md');
    });
    it('appends the `className` escape hatch', () => {
        const out = button({ className: 'rounded-full' });
        expect(out).toContain('rounded-full');
    });
    it('applies compound variants when their match criteria are satisfied', () => {
        const card = cv('rounded-md', {
            variants: {
                tone: { neutral: 'bg-gray-100', danger: 'bg-red-100' },
                emphasis: { low: 'border', high: 'border-2' },
            },
            defaultVariants: { tone: 'neutral', emphasis: 'low' },
            compoundVariants: [{ tone: 'danger', emphasis: 'high', class: 'ring-2 ring-red-500' }],
        });
        expect(card({ tone: 'danger', emphasis: 'high' })).toContain('ring-2 ring-red-500');
        expect(card({ tone: 'danger', emphasis: 'low' })).not.toContain('ring-2');
        expect(card({ tone: 'neutral', emphasis: 'high' })).not.toContain('ring-2');
    });
    it('applies compound variants with array (any-of) matching', () => {
        const alert = cv('alert', {
            variants: {
                tone: { info: 'bg-blue-50', warn: 'bg-amber-50', danger: 'bg-red-50' },
            },
            defaultVariants: { tone: 'info' },
            compoundVariants: [{ tone: ['warn', 'danger'], class: 'font-medium' }],
        });
        expect(alert({ tone: 'warn' })).toContain('font-medium');
        expect(alert({ tone: 'danger' })).toContain('font-medium');
        expect(alert({ tone: 'info' })).not.toContain('font-medium');
    });
});
//# sourceMappingURL=cv.test.js.map