T07a: frontend core SPA — shell + auth + routing + i18n + UI library + a11y

- React 18 + Vite + TypeScript + Tailwind CSS setup
- AppShell with Sidebar (plugin menu) + TopBar (tenant switcher, search, notifications, user menu)
- Auth pages: Login, PasswordResetRequest, PasswordResetConfirm
- Protected routes with auth guard
- API client (axios with interceptors: session cookie, 401 redirect, 422 validation)
- TanStack Query hooks for auth, users, companies, contacts, notifications
- Zustand stores: authStore, uiStore
- i18n setup (de/en locales) with react-i18next
- UI component library: Button, Input, Select, Modal, Toast, Table, Card, Badge, Avatar, Pagination, EmptyState, Skeleton, ConfirmDialog
- Accessibility: ARIA labels, 44px touch targets, keyboard nav, reduced-motion, sr-only
- Design tokens from prototype as CSS custom properties
- 111 tests passing across 20 test files
- tsc --noEmit: 0 errors
- npm run build: success (471KB JS, 24KB CSS)
This commit is contained in:
leocrm-bot
2026-06-29 07:55:47 +02:00
parent f8193a6ab5
commit 22976abe92
66 changed files with 8598 additions and 0 deletions
@@ -0,0 +1,53 @@
import React from 'react';
import { describe, it, expect, vi } from 'vitest';
import { render, screen, within } from '@testing-library/react';
import { MemoryRouter, Route, Routes } from 'react-router-dom';
import { AppShell } from '@/components/layout/AppShell';
vi.mock('@/api/hooks', () => ({
useLogout: () => ({ mutateAsync: vi.fn(), isPending: false }),
useSwitchTenant: () => ({ mutateAsync: vi.fn(), isPending: false }),
}));
function renderWithRouter(initialPath = '/dashboard') {
return render(
<MemoryRouter initialEntries={[initialPath]}>
<Routes>
<Route path="*" element={<AppShell />} />
</Routes>
</MemoryRouter>
);
}
describe('AppShell', () => {
it('renders sidebar, topbar, and content area', () => {
renderWithRouter();
expect(screen.getByTestId('app-shell')).toBeInTheDocument();
expect(screen.getByTestId('sidebar')).toBeInTheDocument();
expect(screen.getByTestId('topbar')).toBeInTheDocument();
expect(screen.getByTestId('content-area')).toBeInTheDocument();
});
it('sidebar contains navigation items', () => {
renderWithRouter();
const sidebar = screen.getByTestId('sidebar');
expect(within(sidebar).getByText('Dashboard')).toBeInTheDocument();
expect(within(sidebar).getByText('Firmen')).toBeInTheDocument();
expect(within(sidebar).getByText('Kontakte')).toBeInTheDocument();
expect(within(sidebar).getByText('Einstellungen')).toBeInTheDocument();
});
it('topbar contains tenant switcher, search, notifications, and user menu', () => {
renderWithRouter();
const topbar = screen.getByTestId('topbar');
expect(within(topbar).getByLabelText('Mandant wechseln')).toBeInTheDocument();
expect(within(topbar).getByLabelText('Suchen...')).toBeInTheDocument();
expect(within(topbar).getByLabelText('Benachrichtigungen')).toBeInTheDocument();
expect(within(topbar).getByLabelText('Benutzermenü')).toBeInTheDocument();
});
it('content area has main role for screen readers', () => {
renderWithRouter();
expect(screen.getByRole('main')).toBeInTheDocument();
});
});