diff --git a/docs/engineering/history/2026-10-29-documentation-copy-layout.md b/docs/engineering/history/2026-10-29-documentation-copy-layout.md new file mode 100644 index 0000000..1f7b554 --- /dev/null +++ b/docs/engineering/history/2026-10-29-documentation-copy-layout.md @@ -0,0 +1,19 @@ +# Documentation copy and reading layout + +## Scope + +Revise the documentation on current main using idiomatic Polish, preserve GreenWave as a proper noun and describe simulated outcomes without promises of real-world savings. Remove the Running it / Uruchomienie section in both languages, rename the page Documentation / Dokumentacja and use an SVG icon for the demo link. + +The desktop layout uses a section rail and a single reading column. Phones keep horizontal tabs, stacked technology rows and labelled source details rather than a wide data table. Section links and keyboard navigation remain available. Switching from a scrolled section restores the next heading to view. + +## Verification and handoff + +Regression tests cover removed installation content, the heading and SVG icon, vertical keyboard navigation, mobile source labels and legacy `#run` fallback. The browser check in `frontend/scripts/smoke/docs-review.js` covers PL/ENG at desktop and phone widths, overflow, keyboard activation, diagrams and section changes after scrolling. + +Commit locally on `codex/refine-documentation`. Do not push or create a PR until the user accepts the result. + +## Results + +Lint, typecheck, formatting, all 1,246 tests and the production build passed. Chromium passed 50 section/language/viewport cases, keyboard navigation and switching sections after a long scroll. Light and dark screenshots were inspected. The copy reviewer found no language or factual regression. + +WebKit completed the layout checks and screenshots, but its strict runner reported access-control failures on shared navigation RSC prefetch requests for `/driver` and `/compare`, on both localhost and 127.0.0.1. That run is not recorded as a clean pass. No shared routing behavior was changed for this documentation task. diff --git a/frontend/scripts/smoke/docs-review.js b/frontend/scripts/smoke/docs-review.js new file mode 100644 index 0000000..1feaf10 --- /dev/null +++ b/frontend/scripts/smoke/docs-review.js @@ -0,0 +1,76 @@ +/* eslint-disable @typescript-eslint/no-unused-expressions -- playwright-cli consumes a function expression */ +async (page) => { + const base = new URL(page.url()).origin; + const results = []; + const errors = []; + page.on("pageerror", (error) => errors.push(error.message)); + const check = (condition, message) => { if (!condition) throw new Error(message); }; + await page.context().clearCookies(); + for (const width of [1440, 900, 768, 393, 320]) { + await page.setViewportSize({ width, height: 900 }); + await page.goto(base + "/docs", { waitUntil: "networkidle" }); + for (const language of ["pl", "en"]) { + await page.getByRole("button", { name: language === "pl" ? "Polski" : "English", exact: true }).click(); + await page.getByRole("heading", { name: language === "pl" ? "Dokumentacja" : "Documentation", exact: true }).waitFor(); + const list = page.getByRole("tablist"); + check(await page.getByRole("tab").count() === 5, "Expected five documentation sections"); + check(await list.getAttribute("aria-orientation") === (width < 768 ? "horizontal" : "vertical"), "Wrong keyboard orientation"); + const demo = page.locator(".docs-head a"); + check(await demo.locator("svg").count() === 1, "Demo arrow must be an SVG"); + check(!(await demo.textContent()).includes("↗"), "Demo must not contain an emoji-prone arrow"); + for (const id of ["about", "tech", "data", "architecture", "roadmap"]) { + await page.locator(`#docs-tab-${id}`).click(); + const panel = page.locator(`#docs-panel-${id}`); + await panel.waitFor(); + const geometry = await page.evaluate(() => { + const panel = document.querySelector('.docs-panel').getBoundingClientRect(); + const header = document.querySelector('.workspace-header').getBoundingClientRect(); + return { width: innerWidth, scrollWidth: document.documentElement.scrollWidth, panelRight: panel.right, headerBottom: header.bottom, panelTop: panel.top }; + }); + check(geometry.scrollWidth <= width + 1, `Page overflow: ${width}/${language}/${id}`); + check(geometry.panelRight <= width, `Panel outside viewport: ${width}/${id}`); + if (id === "data") check(await page.locator(width < 768 ? ".docs-table-mobile" : ".docs-table-scroll").isVisible(), "Data sources use wrong layout"); + if (id === "architecture") { + const diagram = await panel.locator(".docs-diagram").evaluate((element) => ({ width: element.clientWidth, narrow: getComputedStyle(element.querySelector('.docs-diagram-narrow')).display !== 'none' })); + check(diagram.width > 640 || diagram.narrow, "Diagram labels are squeezed into a wide layout"); + } + results.push({ width, language, id }); + } + await page.locator("#docs-tab-about").click(); + await page.locator("#docs-tab-about").focus(); + await page.keyboard.press(width < 768 ? "ArrowRight" : "ArrowDown"); + await page.waitForFunction(() => location.hash === "#tech"); + await page.locator('#docs-tab-tech[aria-selected="true"]').waitFor(); + } + } + await page.setViewportSize({ width: 393, height: 700 }); + await page.goto(base + "/docs#data", { waitUntil: "networkidle" }); + await page.locator("#docs-panel-data").waitFor(); + await page.evaluate(() => window.scrollTo(0, document.documentElement.scrollHeight)); + await page.locator("#docs-tab-tech").click(); + await page.locator("#docs-panel-tech").waitFor(); + const headingVisible = await page.evaluate(() => document.querySelector('.docs-section-title').getBoundingClientRect().top >= document.querySelector('.workspace-header').getBoundingClientRect().bottom); + check(headingVisible, "Section switching leaves the new heading hidden above the viewport"); + await page.setViewportSize({ width: 1440, height: 1000 }); + await page.goto(base + "/docs", { waitUntil: "networkidle" }); + await page.getByRole("button", { name: "Polski", exact: true }).click(); + await page.screenshot({ path: "docs-desktop-light.png", fullPage: true }); + await page.locator("#docs-tab-data").click(); + await page.screenshot({ path: "docs-data-desktop.png", fullPage: true }); + await page.setViewportSize({ width: 393, height: 844 }); + await page.goto(base + "/docs", { waitUntil: "networkidle" }); + await page.screenshot({ path: "docs-phone-light.png", fullPage: true }); + await page.locator("#docs-tab-data").click(); + await page.screenshot({ path: "docs-data-phone.png", fullPage: true }); + await page.emulateMedia({ colorScheme: "dark" }); + await page.waitForFunction(() => document.documentElement.classList.contains("dark")); + await page.goto(base + "/docs", { waitUntil: "networkidle" }); + await page.screenshot({ path: "docs-phone-dark.png", fullPage: true }); + await page.setViewportSize({ width: 1440, height: 1000 }); + await page.screenshot({ path: "docs-desktop-dark.png", fullPage: true }); + await page.goto(base + "/docs#run", { waitUntil: "networkidle" }); + await page.locator("#docs-panel-about").waitFor(); + check(await page.getByRole("tab").count() === 5, "Removed Running section reappeared"); + check(errors.length === 0, errors.join("; ")); + return { passed: true, cases: results.length, errors }; +} diff --git a/frontend/src/app/globals.css b/frontend/src/app/globals.css index bc16525..3405d3a 100644 --- a/frontend/src/app/globals.css +++ b/frontend/src/app/globals.css @@ -2999,12 +2999,31 @@ button, outline-offset: 2px; } -/* Documentation page: the full content width as a grid of panels over a road-ink corridor. Panels - use the home-card material; prose inside a panel keeps its own readable measure. */ +/* Documentation keeps a stable section rail and a readable text measure. */ .docs-page { - --docs-tabs-top: calc(var(--shell-gap) + env(safe-area-inset-top) + 4.75rem); + --docs-tabs-top: calc(var(--workspace-header-bottom, 6rem) + 1rem); + width: min(76rem, 100%); + padding: max(8rem, calc(var(--workspace-header-bottom, 6rem) + 2.5rem)) clamp(1rem, 4vw, 3rem) + 5rem; +} +.docs-layout { + display: grid; + grid-template-columns: 10.5rem minmax(0, 1fr); + align-items: start; + gap: 3rem; +} +.docs-navigation { + position: sticky; + top: var(--docs-tabs-top); + z-index: 20; + min-width: 0; +} +.docs-panel { + scroll-margin-top: calc(var(--workspace-header-bottom, 6rem) + 1.5rem); + min-width: 0; } .docs-backdrop { + opacity: 0.3; position: fixed; inset: 0; z-index: -1; @@ -3040,43 +3059,38 @@ button, .docs-head { display: flex; flex-wrap: wrap; - align-items: flex-end; + align-items: center; justify-content: space-between; gap: 1rem 2rem; - margin-bottom: 1.5rem; + padding-bottom: 1.75rem; + margin-bottom: 2.5rem; + border-bottom: 1px solid var(--border); } .docs-head-meta { display: flex; + align-items: center; flex-wrap: wrap; - gap: 0.5rem; + gap: 1.25rem; } .docs-chip { display: inline-flex; align-items: center; gap: 0.4375rem; - padding: 0.3125rem 0.75rem; - border: 1px solid var(--border); - border-radius: 999px; - background: color-mix(in oklch, var(--surface-1) 72%, transparent); - backdrop-filter: blur(14px) saturate(1.3); + min-height: 44px; font-size: 0.8125rem; font-weight: 500; color: var(--muted-foreground); } a.docs-chip { color: var(--beacon); - transition: border-color var(--dur-hover) ease; -} -.docs-chip-sim { - border-color: color-mix(in oklch, var(--caution) 35%, transparent); - color: var(--caution); + text-decoration: underline; + text-underline-offset: 4px; + text-decoration-color: color-mix(in srgb, var(--beacon) 35%, transparent); } -.docs-chip-sim::before { - content: ""; - width: 6px; - height: 6px; - border-radius: 50%; - background: currentColor; +a.docs-chip:focus-visible, +.docs-tab:focus-visible { + outline: 2px solid var(--ring); + outline-offset: 3px; } .docs-section-title { margin-bottom: 1.25rem; @@ -3088,14 +3102,12 @@ a.docs-chip { } .docs-lead { display: grid; - grid-template-columns: repeat(auto-fit, minmax(min(100%, 30rem), 1fr)); - gap: 1rem 3rem; - margin-bottom: 1.75rem; - font-size: 1.0625rem; - line-height: 1.7; -} -.docs-lead > * { - max-width: 75ch; + gap: 1rem; + margin-bottom: 2rem; + max-width: 72ch; + font-size: 1rem; + line-height: 1.75; + color: var(--muted-foreground); } .docs-lead a { color: var(--beacon); @@ -3104,30 +3116,18 @@ a.docs-chip { } .docs-grid { display: grid; - grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); - gap: 1rem; + grid-template-columns: minmax(0, 1fr); + gap: 2rem; } .docs-wide { - grid-column: 1 / -1; min-width: 0; } -.docs-grid > .docs-note { - align-self: start; -} -.docs-group, -.docs-card { - min-width: 0; - border: 1px solid var(--border); - border-radius: var(--radius-card); - background: color-mix(in oklch, var(--surface-1) 72%, transparent); - box-shadow: var(--highlight); - backdrop-filter: blur(14px) saturate(1.3); -} .docs-group { display: grid; align-content: start; - gap: 0.875rem; - padding: 1.25rem 1.375rem; + gap: 1rem; + padding-top: 1.5rem; + border-top: 1px solid var(--border); } .docs-group h3 { display: flex; @@ -3155,47 +3155,30 @@ a.docs-chip { } .docs-cards { display: grid; - grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); - gap: 1rem; + list-style: none; } .docs-card { display: grid; - align-content: start; - gap: 0.375rem; - padding: 1.125rem 1.25rem; + grid-template-columns: 8.5rem minmax(0, 1fr); + gap: 0.5rem 1.5rem; + padding: 1.25rem 0; + border-bottom: 1px solid var(--border); } .docs-card-label { - font-size: 0.6875rem; - font-weight: 600; - letter-spacing: 0.06em; - text-transform: uppercase; + grid-row: 1 / span 2; + font-size: 0.8125rem; color: var(--muted-foreground); } .docs-card strong { + font-size: 0.9375rem; font-weight: 600; } .docs-card p { + grid-column: 2; font-size: 0.875rem; - line-height: 1.55; + line-height: 1.65; color: var(--muted-foreground); } -.docs-panel-enter { - transition: - opacity 260ms var(--ease-out), - transform 260ms var(--ease-out); - @starting-style { - opacity: 0; - transform: translateY(6px); - } -} -@media (prefers-reduced-motion: reduce) { - .docs-panel-enter { - transition: opacity 200ms ease; - @starting-style { - transform: none; - } - } -} .docs-prose { display: grid; gap: 0.875rem; @@ -3290,6 +3273,7 @@ a.docs-chip { color: var(--caution); } .docs-diagram { + container-type: inline-size; display: grid; gap: 0.5rem; max-width: 54rem; @@ -3338,71 +3322,128 @@ a.docs-chip { } } -/* Docs tabs: the segmented track as one row that scrolls inside itself on narrow screens. It sticks - under the header and takes the glass material only while stuck. One thumb slides between tabs. */ -.docs-tabs-bar { - position: sticky; - top: var(--docs-tabs-top); - z-index: 20; - width: fit-content; - max-width: 100%; - margin-bottom: 2rem; -} +/* One tab model: a quiet desktop rail and a horizontally scrollable phone strip. */ .docs-tabs { - position: relative; display: flex; - max-width: 100%; - width: fit-content; - overflow-x: auto; - scrollbar-width: none; - transition: - background-color var(--dur-enter) ease, - box-shadow var(--dur-enter) ease; -} -.docs-tabs-bar[data-stuck] .docs-tabs { - background: var(--glass-bg); - box-shadow: var(--glass-highlight), var(--glass-ring), var(--glass-shadow); - backdrop-filter: blur(20px) saturate(1.6); -} -.docs-tab-thumb { - position: absolute; - top: 3px; - bottom: 3px; - left: 0; - border-radius: var(--radius-thumb); - background: var(--thumb); - box-shadow: var(--thumb-shadow); - opacity: 0; - pointer-events: none; - transition: - transform 220ms var(--ease-out), - width 220ms var(--ease-out); -} -.docs-tabs[data-thumb] .docs-tab-thumb { - opacity: 1; + flex-direction: column; + gap: 0.25rem; } -.docs-tabs .hud-segment { - position: relative; +.docs-tab { + min-height: 44px; + padding: 0.625rem 0.875rem; + border-radius: var(--radius-control); + text-align: left; + font-size: 0.875rem; + font-weight: 500; + color: var(--muted-foreground); + cursor: pointer; } -.docs-tabs[data-thumb] .hud-segment[aria-selected="true"] { - background: transparent; - box-shadow: none; +.docs-tab[aria-selected="true"] { + background: var(--muted); + color: var(--foreground); } -@media (prefers-reduced-motion: reduce) { - .docs-tab-thumb { - transition: none; +@media (hover: hover) and (pointer: fine) { + .docs-tab:hover { + color: var(--foreground); + background: var(--muted); } } -.docs-tabs::-webkit-scrollbar { - display: none; -} -.docs-tabs .hud-segment { - flex: none; - padding-inline: 0.875rem; - white-space: nowrap; +@media (max-width: 767px) { + .docs-page { + padding-top: max(6.5rem, calc(var(--workspace-header-bottom, 5rem) + 1.5rem)); + } + .docs-head { + margin-bottom: 1rem; + padding-bottom: 1rem; + gap: 0.5rem; + } + .docs-layout { + grid-template-columns: minmax(0, 1fr); + gap: 1.5rem; + } + .docs-navigation { + top: calc(var(--workspace-header-bottom, 5rem) + 0.5rem); + padding-block: 0.375rem; + background: var(--background); + border-bottom: 1px solid var(--border); + } + .docs-tabs { + flex-direction: row; + overflow-x: auto; + overscroll-behavior-x: contain; + scrollbar-width: thin; + } + .docs-tab { + flex: none; + white-space: nowrap; + } + .docs-panel { + scroll-margin-top: calc(var(--workspace-header-bottom, 5rem) + 5.5rem); + } + .docs-card { + grid-template-columns: minmax(0, 1fr); + gap: 0.5rem; + } + .docs-card-label, + .docs-card p { + grid-column: auto; + grid-row: auto; + } } .docs-panel:focus-visible { outline: 2px solid var(--ring); outline-offset: 6px; border-radius: var(--radius-control); } + +.docs-table-mobile { + display: none; +} +@media (max-width: 767px) { + .docs-data-table > .docs-table-scroll { + display: none; + } + .docs-table-mobile { + display: grid; + gap: 1.5rem; + } + .docs-source { + padding-bottom: 1.5rem; + border-bottom: 1px solid var(--border); + } + .docs-source h3 { + font-size: 1rem; + font-weight: 600; + line-height: 1.5; + } + .docs-source dl { + display: grid; + gap: 0.75rem; + margin-top: 1rem; + } + .docs-source dl > div { + display: grid; + grid-template-columns: 6rem minmax(0, 1fr); + gap: 1rem; + } + .docs-source dt { + font-size: 0.8125rem; + color: var(--muted-foreground); + } + .docs-source dd { + font-size: 0.875rem; + line-height: 1.65; + overflow-wrap: anywhere; + } +} + +@container (max-width: 40rem) { + .docs-diagram-wide { + display: none; + } + .docs-diagram-narrow { + display: block; + max-width: 22rem; + margin-inline: auto; + } +} diff --git a/frontend/src/components/docs/DocsBlocks.tsx b/frontend/src/components/docs/DocsBlocks.tsx index 103abb4..c2afcf1 100644 --- a/frontend/src/components/docs/DocsBlocks.tsx +++ b/frontend/src/components/docs/DocsBlocks.tsx @@ -33,27 +33,44 @@ export function Block({ block }: { block: DocsBlock }) { ); return ( -
- - - - {block.columns.map((column) => ( - - ))} - - - - {block.rows.map((row) => ( - - {row.map((cell, index) => ( - +
+
+
- {column} -
{cell}
+ + + {block.columns.map((column) => ( + ))} - ))} - -
+ {column} +
+ + + {block.rows.map((row) => ( + + {row.map((cell, index) => ( + {cell} + ))} + + ))} + + +
+
+ {block.rows.map((row) => ( +
+

{row[0]}

+
+ {block.columns.slice(1).map((column, index) => ( +
+
{column}
+
{row[index + 1]}
+
+ ))} +
+
+ ))} +
); case "code": diff --git a/frontend/src/components/docs/DocsSectionView.tsx b/frontend/src/components/docs/DocsSectionView.tsx index 4e7bd48..20add3f 100644 --- a/frontend/src/components/docs/DocsSectionView.tsx +++ b/frontend/src/components/docs/DocsSectionView.tsx @@ -24,7 +24,7 @@ function Group({ ); } -/** One section across the full page: the lead in columns, then a grid of panels. */ +/** A readable introduction followed by titled subsections and full-width data blocks. */ export function DocsSectionView({ section }: { section: DocsSection }) { const { intro, items } = groupDocsBlocks(section.blocks); let step = 0; diff --git a/frontend/src/components/docs/DocsTabs.tsx b/frontend/src/components/docs/DocsTabs.tsx index 7932567..29ecf13 100644 --- a/frontend/src/components/docs/DocsTabs.tsx +++ b/frontend/src/components/docs/DocsTabs.tsx @@ -1,99 +1,58 @@ "use client"; import { useTranslation } from "@/components/language-provider"; - -import { useEffect, useLayoutEffect, useRef } from "react"; +import { useEffect, useRef } from "react"; import type { DocsSection } from "@/lib/docs/content"; import { nextTabIndex, type DocsSectionId } from "@/lib/docs/tabs"; -export type DocsSelectVia = "pointer" | "keyboard"; - -/** WAI-ARIA tabs with automatic activation, on the shared segmented track with one sliding thumb. */ export function DocsTabs({ sections, active, onSelect, + orientation = "horizontal", }: { sections: DocsSection[]; active: DocsSectionId; - onSelect: (id: DocsSectionId, via: DocsSelectVia) => void; + onSelect: (id: DocsSectionId) => void; + orientation?: "horizontal" | "vertical"; }) { const { t } = useTranslation(); - const list = useRef(null); - const thumb = useRef(null); const tabs = useRef<(HTMLButtonElement | null)[]>([]); - // Pointer switches slide the thumb; keyboard switches repeat quickly, so they jump. - const slide = useRef(false); const activeIndex = sections.findIndex((section) => section.id === active); - useEffect(() => { tabs.current[activeIndex]?.scrollIntoView({ block: "nearest", inline: "nearest" }); - }, [activeIndex]); - - useLayoutEffect(() => { - const track = list.current; - const element = thumb.current; - if (!track || !element) return; - const place = (animate: boolean) => { - const tab = tabs.current[activeIndex]; - if (!tab) return; - element.style.transition = animate ? "" : "none"; - element.style.width = `${tab.offsetWidth}px`; - element.style.transform = `translateX(${tab.offsetLeft}px)`; - track.dataset.thumb = ""; - }; - place(slide.current); - slide.current = false; - // Labels change width with the language and once the web font loads. The observer also fires - // once on observe; skipping that keeps it from cancelling the slide just started. - let width = track.scrollWidth; - const observer = new ResizeObserver(() => { - if (track.scrollWidth === width) return; - width = track.scrollWidth; - place(false); - }); - observer.observe(track); - return () => observer.disconnect(); - }, [activeIndex, sections]); - + }, [activeIndex, orientation]); return (
-
); } diff --git a/frontend/src/components/docs/DocsWorkspace.tsx b/frontend/src/components/docs/DocsWorkspace.tsx index 2aa0536..f70287c 100644 --- a/frontend/src/components/docs/DocsWorkspace.tsx +++ b/frontend/src/components/docs/DocsWorkspace.tsx @@ -1,7 +1,7 @@ "use client"; import { useTranslation } from "@/components/language-provider"; - -import { useEffect, useRef, useState } from "react"; +import { useEffect, useRef } from "react"; +import { ArrowUpRight } from "lucide-react"; import { ThemeToggle } from "@/components/hud/ThemeToggle"; import { ResponsiveNavigation } from "@/components/workspace/ResponsiveNavigation"; import { WorkspaceHeader } from "@/components/workspace/WorkspaceHeader"; @@ -9,74 +9,77 @@ import { useIsPhone } from "@/lib/useIsPhone"; import { DEMO_URL, docsContent } from "@/lib/docs/content"; import { DocsBackdrop } from "./DocsBackdrop"; import { DocsSectionView } from "./DocsSectionView"; -import { DocsTabs, type DocsSelectVia } from "./DocsTabs"; +import { DocsTabs } from "./DocsTabs"; import { useDocsSection } from "./useDocsSection"; -/** True once the sticky tab track has scrolled up against the header. */ -function useStuck() { - const sentinel = useRef(null); - const [stuck, setStuck] = useState(false); - useEffect(() => { - const element = sentinel.current; - const bar = element?.nextElementSibling; - if (!element || !bar) return; - // The sentinel sits right above the bar, so it leaves the viewport's top band as the bar sticks. - const top = Math.ceil(parseFloat(getComputedStyle(bar).top) || 0) + 1; - const observer = new IntersectionObserver(([entry]) => setStuck(!entry.isIntersecting), { - rootMargin: `-${top}px 0px 0px 0px`, - }); - observer.observe(element); - return () => observer.disconnect(); - }, []); - return [sentinel, stuck] as const; -} - export function DocsWorkspace() { const { t, language } = useTranslation(); const phone = useIsPhone(); const [active, select] = useDocsSection(); - // The panel fades in after a pointer switch; first paint and keyboard switches show it at once. - const [fade, setFade] = useState(false); - const [sentinel, stuck] = useStuck(); + const panel = useRef(null); + const previous = useRef(active); + useEffect(() => { + if (previous.current === active) return; + previous.current = active; + const element = panel.current; + if (!element) return; + const margin = parseFloat(getComputedStyle(element).scrollMarginTop) || 0; + // Keep a new section's beginning visible when switching from a long, scrolled section. + if (element.getBoundingClientRect().top < margin) + element.scrollIntoView({ block: "start", behavior: "instant" }); + }, [active]); const sections = docsContent[language]; const section = sections.find((item) => item.id === active) ?? sections[0]; - const onSelect = (id: typeof active, via: DocsSelectVia) => { - setFade(via === "pointer"); - select(id); - }; return ( -
+
}>
-

- {t("Contest documentation")} -

-

- {t("Simulation only")} +

{t("Documentation")}

+
+ + - {t("Live demo")} ↗ + {t("Live demo")} -

-
- -
-
+
+ +

{section.title}

-
-
+ +
); } diff --git a/frontend/src/components/docs/docs-blocks.test.tsx b/frontend/src/components/docs/docs-blocks.test.tsx index 01e513a..a926528 100644 --- a/frontend/src/components/docs/docs-blocks.test.tsx +++ b/frontend/src/components/docs/docs-blocks.test.tsx @@ -92,11 +92,10 @@ describe("DocsBlocks", () => { describe("DocsSectionView", () => { const about = docsContent.en[0]; - const run = docsContent.en.find((section) => section.id === "run")!; it("puts the leading paragraphs in the lead and each heading in its own panel", () => { const html = renderToStaticMarkup(); - expect(html).toMatch(/

An ambulance/); + expect(html).toMatch(/

ER-GreenWave/); const headings = about.blocks.filter((block) => block.kind === "heading").length; expect(html.match(/

{ it("spans tables across the grid", () => { const data = docsContent.en.find((section) => section.id === "data")!; expect(renderToStaticMarkup()).toContain( - '
', + '
', ); }); it("numbers the steps of a numbered section only", () => { - const steps = renderToStaticMarkup().match( - /class="docs-step">(\d+), + ).match(/class="docs-step">(\d+))).not.toContain("docs-step"); }); }); + +it("offers labelled source details for narrow screens", () => { + const html = renderToStaticMarkup( + , + ); + expect(html).toContain('class="docs-table-mobile"'); + expect(html).toContain("
Publisher
Community
"); +}); diff --git a/frontend/src/components/docs/docs-workspace.test.tsx b/frontend/src/components/docs/docs-workspace.test.tsx index b20613d..d6c0543 100644 --- a/frontend/src/components/docs/docs-workspace.test.tsx +++ b/frontend/src/components/docs/docs-workspace.test.tsx @@ -14,10 +14,10 @@ const english = () => ); describe("DocsWorkspace", () => { - it("names a tablist with six tabs", () => { + it("names a tablist with five tabs", () => { const html = english(); expect(html).toMatch(/role="tablist"[^>]*aria-label="Documentation sections"/); - expect(html.match(/role="tab"/g)).toHaveLength(6); + expect(html.match(/role="tab"/g)).toHaveLength(5); }); it("selects About first with roving focus", () => { @@ -42,18 +42,26 @@ describe("DocsWorkspace", () => { ); }); - it("flags simulation only and links the demo beside the title", () => { + it("shows a simulation-mode badge distinct from the demo link", () => { const html = english(); - expect(html).toMatch(/class="docs-chip docs-chip-sim"[^>]*>Simulation only/); + expect(html).toContain("bg-amber-500"); + expect(html).toContain("bg-zinc-900/80"); + expect(html).toContain("border-neutral-700/60"); expect(html).toMatch(/class="docs-chip"[^>]*href="https:\/\/green-wave\.duckdns\.org\/"/); }); - it("draws the sliding thumb and the corridor backdrop", () => { + it("uses an SVG external-link icon and a documentation navigation rail", () => { const html = english(); + expect(html).not.toContain("↗"); + expect(html).toContain('class="docs-navigation"'); + expect(html).toMatch(/Live demo[\s\S]*?]*>[\s\S]*