import { jsx as _jsx } from "react/jsx-runtime";
// @vitest-environment happy-dom
import { describe, expect, it, vi } from 'vitest';
import { render, screen } from '@testing-library/react';
import { StatusBadge } from '../../components/ui/StatusBadge.js';
import { FilterPill } from '../../components/ui/FilterPill.js';
import { StatPill } from '../../components/ui/StatPill.js';
describe('StatusBadge', () => {
    it('renders the label with a leading dot by default', () => {
        const { container } = render(_jsx(StatusBadge, { tone: "success", children: "Published" }));
        expect(screen.getByText('Published')).toBeTruthy();
        expect(container.querySelectorAll('[aria-hidden]')).toHaveLength(1);
    });
    it('omits the dot when dot={false}', () => {
        const { container } = render(_jsx(StatusBadge, { tone: "neutral", dot: false, children: "Draft" }));
        expect(container.querySelectorAll('[aria-hidden]')).toHaveLength(0);
    });
    it('forwards aria-label for screen readers', () => {
        const { container } = render(_jsx(StatusBadge, { tone: "warning", "aria-label": "Status: Scheduled", children: "Scheduled" }));
        expect(container.querySelector('[aria-label="Status: Scheduled"]')).toBeTruthy();
    });
});
describe('FilterPill', () => {
    it('exposes active state via aria-pressed and fires onClick', () => {
        const onClick = vi.fn();
        render(_jsx(FilterPill, { active: true, onClick: onClick, children: "All" }));
        const btn = screen.getByRole('button', { name: 'All' });
        expect(btn.getAttribute('aria-pressed')).toBe('true');
        btn.click();
        expect(onClick).toHaveBeenCalledTimes(1);
    });
    it('renders an optional count', () => {
        render(_jsx(FilterPill, { count: 12, children: "Admin" }));
        expect(screen.getByText('12')).toBeTruthy();
        expect(screen.getByRole('button', { name: /Admin/ }).getAttribute('aria-pressed')).toBe('false');
    });
});
describe('StatPill', () => {
    it('renders value and label', () => {
        render(_jsx(StatPill, { value: 8, label: "Active" }));
        expect(screen.getByText('8')).toBeTruthy();
        expect(screen.getByText('Active')).toBeTruthy();
    });
});
//# sourceMappingURL=ui-primitives.test.js.map