import { describe, it, expect } from 'vitest';
import { render } from '@testing-library/svelte';
import Link from './Link.svelte';
describe('m-link component', () => {
    it('renders with default props and correct classes', () => {
        const { container } = render(Link, {
            props: {
                href: 'https://example.com',
            },
        });
        const link = container.querySelector('a.mc-link');
        expect(link).toBeTruthy();
        expect(link).toHaveAttribute('href', 'https://example.com');
        expect(link.classList.contains('mc-link--standard')).toBe(true);
        expect(link.classList.contains('mc-link--s')).toBe(true);
        expect(link.classList.contains('mc-link--stand-alone')).toBe(true);
    });
    it('renders with inline class when inline prop is true', () => {
        const { container } = render(Link, {
            props: {
                href: 'https://example.com',
                inline: true,
            },
        });
        const link = container.querySelector('a.mc-link');
        expect(link.classList.contains('mc-link--inline')).toBe(true);
        expect(link.classList.contains('mc-link--stand-alone')).toBe(false);
    });
    it('applies appearance and size classes correctly', () => {
        const { container } = render(Link, {
            props: {
                href: 'https://example.com',
                appearance: 'accent',
                size: 'm',
            },
        });
        const link = container.querySelector('a.mc-link');
        expect(link.classList.contains('mc-link--accent')).toBe(true);
        expect(link.classList.contains('mc-link--m')).toBe(true);
    });
    it('sets target attribute correctly', () => {
        const { container } = render(Link, {
            props: {
                href: 'https://example.com',
                target: '_blank',
            },
        });
        const link = container.querySelector('a.mc-link');
        expect(link).toHaveAttribute('target', '_blank');
    });
});
