loading-errors now forces each list API (/api/tasks, /api/captures, /api/event-types, /api/tokens, /api/access/policies) to fail and asserts the page shows its error surface, never its empty-state copy. accessibility gains two static-route sweeps: every input/textarea/select/ button must have an accessible name, and every keyboard focus stop's indicator (ring var, outline, shadow or focus border) must clear 3:1 against the background behind it. phone-overflow sweeps every static route at 390x844 for horizontal scroll. The sweeps caught real gaps, fixed here: the DurationInput amount input had no accessible name and its unit select no focus indicator, and TabsContent and CodeBlockContent were focusable with outline-none and no ring. The stale 'Sections' list selector now matches the nav landmark.
23 lines
1.0 KiB
JavaScript
23 lines
1.0 KiB
JavaScript
// Every static route loads without errors, renders, and shows no text with
|
|
// stray leading, trailing or doubled spaces.
|
|
const { staticRoutes } = require('./helpers/routes.cjs');
|
|
|
|
module.exports = async ({ page, go, shot, fail }) => {
|
|
const stray = new Map();
|
|
for (const r of staticRoutes()) {
|
|
await go(r);
|
|
await shot(r);
|
|
// Log lines are data, not copy.
|
|
if (r === '/logs') continue;
|
|
const bad = await page.evaluate(() => [...document.querySelectorAll('body *')]
|
|
.filter((el) => !el.children.length && !el.closest('pre,code,textarea,.xterm') && el.getClientRects().length && !getComputedStyle(el).whiteSpace.startsWith('pre'))
|
|
.map((el) => el.textContent)
|
|
.filter((t) => t.trim() && (t !== t.trim() || / /.test(t.trim()))));
|
|
for (const t of bad) {
|
|
const key = JSON.stringify(t.length > 60 ? t.slice(0, 60) + '…' : t);
|
|
stray.set(key, (stray.get(key) || new Set()).add(r));
|
|
}
|
|
}
|
|
for (const [text, where] of stray) fail(`stray whitespace ${text} on ${[...where].join(', ')}`);
|
|
};
|