import { describe, it, expect } from 'vitest';
import { render } from '@testing-library/svelte';
import Flag from './Flag.svelte';
describe('m-flag component', () => {
    it('renders with default appearance', () => {
        const { container, getByText } = render(Flag, {
            props: { label: 'New' },
        });
        const flag = container.querySelector('.mc-flag');
        expect(flag).toBeTruthy();
        expect(flag?.classList.contains('mc-flag--standard')).toBe(true);
        const label = getByText('New');
        expect(label).toBeInTheDocument();
        expect(label.classList.contains('mc-flag__label')).toBe(true);
    });
    it('applies the correct appearance class', () => {
        const { container } = render(Flag, {
            props: { label: 'Sale', appearance: 'danger' },
        });
        const flag = container.querySelector('.mc-flag');
        expect(flag).toBeTruthy();
        expect(flag?.classList.contains('mc-flag--danger')).toBe(true);
    });
    it('renders the correct label text', () => {
        const { getByText } = render(Flag, {
            props: { label: 'Limited Offer' },
        });
        expect(getByText('Limited Offer')).toBeInTheDocument();
    });
});
