feat(C): Phase C — Core UI prüfen, vervollständigen, testen
C-ERR-BOUNDARY: ErrorBoundary erweitert (trace_id, Fallback-UI, PluginErrorBoundary) C-NOTIF: NotificationDropdown mit System-Channel-Link C-DOCS: ApiDocs.tsx Seite (Swagger UI iframe) C-A11Y: aria-label, min-h-touch, focus-visible ergänzt C-FE-TEST: 29 neue Tests (ErrorBoundary, ApiDocs, PrintButton, themeStore, NotificationDropdown) C-DOC: ui-design-guidelines.md aktualisiert Verifiziert (keine Änderungen nötig): - C-TAGS, C-CF, C-FILTER, C-DEDUP, C-ONBOARD, C-THEME, C-PWA, C-PRINT TSC: 0 errors, Build: erfolgreich, Vitest: 29/29 passed
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* ApiDocs page tests — verifies iframe embedding and external link.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { ApiDocsPage } from '@/pages/ApiDocs';
|
||||
|
||||
// Mock react-i18next
|
||||
vi.mock('react-i18next', () => ({
|
||||
useTranslation: () => ({ t: (key: string, fallback: string) => fallback }),
|
||||
}));
|
||||
|
||||
describe('ApiDocsPage', () => {
|
||||
it('renders the page with title', () => {
|
||||
render(<ApiDocsPage />);
|
||||
expect(screen.getByTestId('api-docs-page')).toBeInTheDocument();
|
||||
expect(screen.getByText('API-Dokumentation')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('embeds an iframe pointing to /docs', () => {
|
||||
render(<ApiDocsPage />);
|
||||
const iframe = screen.getByTitle('API-Dokumentation');
|
||||
expect(iframe.tagName).toBe('IFRAME');
|
||||
expect(iframe).toHaveAttribute('src', '/docs');
|
||||
});
|
||||
|
||||
it('has a link to open /docs in a new tab', () => {
|
||||
render(<ApiDocsPage />);
|
||||
const link = screen.getByRole('link', { name: 'In neuem Tab öffnen' });
|
||||
expect(link).toHaveAttribute('href', '/docs');
|
||||
expect(link).toHaveAttribute('target', '_blank');
|
||||
expect(link).toHaveAttribute('rel', 'noopener noreferrer');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user