// tools/generate-tests/generators/a11y-tests-generator.ts
// SPEC-017a: Accessibility test definitions and content generators
export function generateA11yTestDefs(title, testDir) {
    return [
        {
            name: `${title} — a11y: zero WCAG violations`,
            type: 'unit',
            file: `${testDir}/a11y/`,
            description: `Verify zero WCAG AA violations using axe-core on all UI components`,
            priority: 'high',
            automatable: true,
        },
        {
            name: `${title} — a11y: keyboard navigation`,
            type: 'unit',
            file: `${testDir}/a11y/`,
            description: `Verify all interactive elements are keyboard accessible`,
            priority: 'high',
            automatable: true,
        },
    ];
}
export function generateA11yTestContent(title, framework, language) {
    if (language === 'python') {
        return generatePythonA11yTest(title);
    }
    return generateJsA11yTest(title, framework);
}
function generateJsA11yTest(title, framework) {
    const isVitest = framework === 'vitest';
    const runner = isVitest ? 'vitest' : 'jest';
    return [
        `// Accessibility tests for: ${title}`,
        '// Generated by Planu SDD MCP Server',
        '// Requires: @axe-core/react (React) or axe-core + jest-axe',
        '',
        `import { describe, it, expect } from '${runner}'`,
        "import { render } from '@testing-library/react'",
        "import { axe, toHaveNoViolations } from 'jest-axe'",
        '',
        'expect.extend(toHaveNoViolations)',
        '',
        `describe('${title} — Accessibility (WCAG 2.1 AA)', () => {`,
        `  it('should have no WCAG violations', async () => {`,
        `    // TODO: Replace with actual component`,
        `    const { container } = render(<div>Component under test</div>)`,
        `    const results = await axe(container)`,
        `    expect(results).toHaveNoViolations()`,
        `  })`,
        '',
        `  it('should be keyboard navigable', async () => {`,
        `    // TODO: Replace with actual component`,
        `    const { getByRole } = render(<div tabIndex={0}>Interactive element</div>)`,
        `    const element = getByRole('generic')`,
        `    element.focus()`,
        `    expect(document.activeElement).toBe(element)`,
        `  })`,
        '',
        `  it('should have visible focus indicators', async () => {`,
        `    // Manual verification required: ensure CSS :focus-visible styles are defined`,
        `    // Automated: check outline is not none without replacement`,
        `    expect(true).toBe(true) // Replace with actual focus style assertion`,
        `  })`,
        `})`,
    ].join('\n');
}
function generatePythonA11yTest(title) {
    return [
        `# Accessibility tests for: ${title}`,
        '# Generated by Planu SDD MCP Server',
        '# Requires: playwright + axe-playwright for Python',
        '',
        'import pytest',
        '',
        `class Test${title.replace(/\s+/g, '')}Accessibility:`,
        `    def test_no_wcag_violations(self, page):`,
        `        """Test zero WCAG 2.1 AA violations."""`,
        `        # TODO: Navigate to the component/page URL`,
        `        page.goto("http://localhost:3000")`,
        `        # TODO: Use playwright-axe or axe-playwright`,
        `        # violations = check_violations(page)`,
        `        # assert len(violations) == 0`,
        `        pass`,
        '',
        `    def test_keyboard_navigation(self, page):`,
        `        """Test keyboard accessibility."""`,
        `        page.goto("http://localhost:3000")`,
        `        page.keyboard.press("Tab")`,
        `        # TODO: Assert focused element is the expected first interactive element`,
        `        pass`,
    ].join('\n');
}
//# sourceMappingURL=a11y-tests-generator.js.map