function assert(condition: unknown, message = "assertion failed"): void {
if (!condition) throw new Error(message);
}
import { renderToStaticMarkup } from "react-dom/server";
import PageLayout from "../src/components/PageLayout";
import { PlatformLanguageProvider } from "../src/i18n/LanguageContext";
const standaloneMarkup = renderToStaticMarkup(
Reload}
error="Could not load"
success="Saved"
interfaceId="test.page"
helpContextId="test.page.help"
helpModuleId="test-module"
>
);
assert(standaloneMarkup.includes('class="page-scroll-viewport"'), "standalone pages own their scroll viewport");
assert(standaloneMarkup.includes("page-layout-standalone content-pad workspace-data-page"), "standalone pages use the shared padded workspace frame");
assert(standaloneMarkup.includes("page-layout-header"), "the central page header is rendered");
assert(standaloneMarkup.includes("page-layout-actions"), "route actions use the central responsive action region");
assert(standaloneMarkup.includes('data-interface-id="test.page"'), "page identity reaches the shared frame");
assert(standaloneMarkup.includes('data-help-context-id="test.page.help"'), "context help reaches the shared frame");
assert(standaloneMarkup.includes('data-help-module-id="test-module"'), "documentation ownership reaches the shared frame");
assert(standaloneMarkup.includes("Could not load"), "page errors use the shared alert region");
assert(standaloneMarkup.includes("Saved"), "page success notices use the shared alert region");
assert(standaloneMarkup.includes("Page content"), "page content is preserved");
const embeddedMarkup = renderToStaticMarkup(
Embedded content
);
assert(!embeddedMarkup.includes("page-scroll-viewport"), "embedded pages defer scrolling to their owner");
assert(!embeddedMarkup.includes("content-pad"), "embedded pages do not add a second content inset");
assert(embeddedMarkup.includes("page-layout-embedded"), "embedded mode remains explicit");
assert(embeddedMarkup.includes('data-help-documentation-type="admin"'), "embedded administration keeps its documentation type");
const workspaceMarkup = renderToStaticMarkup(
Version 3
}
mode="workspace"
notices={Additional notice
}
>
Workspace content
);
assert(!workspaceMarkup.includes("page-scroll-viewport"), "workspace pages defer scrolling to the workspace content pane");
assert(workspaceMarkup.includes("page-layout-workspace content-pad workspace-data-page"), "workspace pages keep the standard content inset");
assert(workspaceMarkup.includes('class="version-line"'), "rich page descriptions keep their own semantic element");
assert(!workspaceMarkup.includes("
Stable content
);
assert(headerLoadingMarkup.includes("loading-indicator"), "page headings can expose partial refresh progress");
assert(!headerLoadingMarkup.includes('aria-busy="true"'), "partial refresh does not block the stable page body");