Completes the front-end shell with footer, status pages and SEO

Adds the footer, back-to-top button, skip link, placeholder routes,
404 and error pages inside the shell, plus per-page SEO from a single
page registry (canonical URLs, Open Graph image, JSON-LD, generated
sitemap.xml and robots.txt).

Theme tokens and recipes replace repeated styling, the hero loads only
the active and neighbouring slides, and the e-mail address is joined
in the browser to keep it out of the HTML and bundle.

Adds Vitest with property-based (fast-check) and axe tests, ESLint,
security headers for dev and preview, Lighthouse CI and a `pnpm check`
script that runs all quality gates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-18 17:05:02 +02:00
co-authored by Claude Opus 5.5
parent b5b7f3b3db
commit 4d6408b607
99 changed files with 7883 additions and 414 deletions
+49
View File
@@ -0,0 +1,49 @@
import fc from 'fast-check';
import type { EmailAddress, SocialLink } from '../content/types';
// Gedeelde generators voor de property-based tests (fast-check)
const platform = fc.constantFrom('facebook' as const, 'instagram' as const);
// Een padsegment zoals in een route: kleine letters, cijfers en streepjes
export const pathSegment = fc.stringMatching(/^[a-z0-9-]{1,12}$/);
export const routePath = fc
.array(pathSegment, { maxLength: 4 })
.map((segments) => '/' + segments.join('/'));
export const httpsUrl = fc.webUrl({ validSchemes: ['https'] });
// Mix van geldige en ongeldige href's zoals het CMS ze zou kunnen leveren
export const anyHref = fc.oneof(
httpsUrl,
fc.webUrl({ validSchemes: ['http'] }),
fc.constantFrom(
'',
'javascript:alert(1)',
'/relatief',
'geen url',
'https://',
),
fc.string(),
);
export const socialLink: fc.Arbitrary<SocialLink> = fc.record({
platform,
href: anyHref,
});
// Een geldig deel van een e-mailadres: geen spaties, geen @
const emailPart = fc.stringMatching(/^[a-z0-9._-]{1,20}$/);
export const validEmail: fc.Arbitrary<EmailAddress> = fc.record({
user: emailPart,
domain: fc
.tuple(emailPart, fc.stringMatching(/^[a-z]{2,6}$/))
.map(([name, tld]) => `${name}.${tld}`),
});
export const anyEmail: fc.Arbitrary<EmailAddress> = fc.oneof(
validEmail,
fc.record({ user: fc.string(), domain: fc.string() }),
);
+31
View File
@@ -0,0 +1,31 @@
import axe from 'axe-core';
// Eigen matcher op axe-core: vitest-axe gebruikt nog de oude Vitest-types.
// Kleurcontrast meet axe niet in jsdom; dat dekt Lighthouse af (NFR-A-05).
export async function axeResults(container: Element) {
return axe.run(container, {
rules: { 'color-contrast': { enabled: false } },
});
}
export function toHaveNoViolations(results: axe.AxeResults) {
const violations = results.violations;
return {
pass: violations.length === 0,
message: () =>
violations
.map(
(v) =>
`${v.id}: ${v.help}\n` +
v.nodes.map((n) => ` ${n.html}`).join('\n'),
)
.join('\n\n'),
};
}
// Vitest 5: eigen matchers horen op de Matchers-interface
declare module 'vitest' {
interface Matchers<R> {
toHaveNoViolations(): R;
}
}
+31
View File
@@ -0,0 +1,31 @@
import type { ReactNode } from 'react';
import { ChakraProvider } from '@chakra-ui/react';
import {
createMemoryHistory,
createRootRoute,
createRoute,
createRouter,
RouterProvider,
} from '@tanstack/react-router';
import { render } from '@testing-library/react';
import system from '../theme';
// Rendert een component binnen het Chakra-thema en een router op `path`.
// Een splat-route vangt elk pad op, zodat links en aria-current werken
// zonder de echte route tree.
export async function renderWithProviders(ui: ReactNode, { path = '/' } = {}) {
const rootRoute = createRootRoute({ component: () => <>{ui}</> });
const splat = createRoute({ getParentRoute: () => rootRoute, path: '$' });
const router = createRouter({
routeTree: rootRoute.addChildren([splat]),
history: createMemoryHistory({ initialEntries: [path] }),
});
await router.load();
const result = render(
<ChakraProvider value={system}>
<RouterProvider router={router} />
</ChakraProvider>,
);
return { ...result, router };
}
+34
View File
@@ -0,0 +1,34 @@
import '@testing-library/jest-dom/vitest';
import { cleanup } from '@testing-library/react';
import fc from 'fast-check';
import { afterEach, expect, inject, vi } from 'vitest';
import { toHaveNoViolations } from './axe';
expect.extend({ toHaveNoViolations });
// Seed van deze run, gekozen en gelogd in config/testSeed.ts (PBT-08)
fc.configureGlobal({ seed: inject('fcSeed') });
// Zonder globals ruimt Testing Library niet zelf op
afterEach(() => {
cleanup();
vi.restoreAllMocks();
});
// jsdom kent geen matchMedia (Chakra-breakpoints, reduced motion) en geen
// scrollTo. Tests die het gedrag nodig hebben, overschrijven deze stubs.
Object.defineProperty(window, 'matchMedia', {
writable: true,
configurable: true,
value: (query: string) => ({
matches: false,
media: query,
onchange: null,
addEventListener: () => {},
removeEventListener: () => {},
addListener: () => {},
removeListener: () => {},
dispatchEvent: () => false,
}),
});
window.scrollTo = () => {};