feat: add shared workspace layouts
This commit is contained in:
@@ -46,3 +46,33 @@ assert(!embeddedMarkup.includes("page-scroll-viewport"), "embedded pages defer s
|
||||
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(
|
||||
<PlatformLanguageProvider>
|
||||
<PageLayout
|
||||
title="Workspace page"
|
||||
description={<p className="version-line">Version 3</p>}
|
||||
mode="workspace"
|
||||
notices={<div role="status">Additional notice</div>}
|
||||
>
|
||||
Workspace content
|
||||
</PageLayout>
|
||||
</PlatformLanguageProvider>
|
||||
);
|
||||
|
||||
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("<p><p"), "rich page descriptions are not nested in an invalid paragraph");
|
||||
assert(workspaceMarkup.includes("page-layout-notices"), "additional page notices use the central notice region");
|
||||
|
||||
const headerLoadingMarkup = renderToStaticMarkup(
|
||||
<PlatformLanguageProvider>
|
||||
<PageLayout title="Refreshing" mode="workspace" headerLoading>
|
||||
Stable content
|
||||
</PageLayout>
|
||||
</PlatformLanguageProvider>
|
||||
);
|
||||
|
||||
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");
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
function assert(condition: unknown, message = "assertion failed"): void {
|
||||
if (!condition) throw new Error(message);
|
||||
}
|
||||
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import WorkspaceLayout from "../src/components/WorkspaceLayout";
|
||||
import { PlatformLanguageProvider } from "../src/i18n/LanguageContext";
|
||||
|
||||
const navigationMarkup = renderToStaticMarkup(
|
||||
<PlatformLanguageProvider>
|
||||
<WorkspaceLayout
|
||||
primary={<nav>Sections</nav>}
|
||||
primaryLabel="Campaign sections"
|
||||
contentLabel="Campaign content"
|
||||
interfaceId="campaign.workspace"
|
||||
helpModuleId="campaign"
|
||||
>
|
||||
<main>Selected section</main>
|
||||
</WorkspaceLayout>
|
||||
</PlatformLanguageProvider>
|
||||
);
|
||||
|
||||
assert(navigationMarkup.includes("workspace-layout-navigation"), "navigation workspaces use the central navigation geometry");
|
||||
assert(navigationMarkup.includes("workspace-layout-primary-default"), "the default primary-pane width is explicit");
|
||||
assert(navigationMarkup.includes("workspace-layout-pane-contained"), "navigation panes defer scrolling to their navigation component");
|
||||
assert(navigationMarkup.includes('aria-label="Campaign sections"'), "the primary pane can be named");
|
||||
assert(navigationMarkup.includes('aria-label="Campaign content"'), "the content pane can be named");
|
||||
assert(navigationMarkup.includes('data-help-scope="workspace"'), "workspace contextual-help scope is centralized");
|
||||
assert(navigationMarkup.includes('data-interface-id="campaign.workspace"'), "workspace identity reaches the root");
|
||||
assert(navigationMarkup.includes('data-help-documentation-type="user"'), "workspace documentation type is explicit");
|
||||
|
||||
const splitMarkup = renderToStaticMarkup(
|
||||
<PlatformLanguageProvider>
|
||||
<WorkspaceLayout
|
||||
variant="split"
|
||||
primarySize="wide"
|
||||
contentScrollable={false}
|
||||
primary={<div>Collection</div>}
|
||||
>
|
||||
Detail
|
||||
</WorkspaceLayout>
|
||||
</PlatformLanguageProvider>
|
||||
);
|
||||
|
||||
assert(splitMarkup.includes("workspace-layout-split"), "list-detail workspaces opt into split-pane geometry");
|
||||
assert(splitMarkup.includes("workspace-layout-primary-wide"), "split workspaces use central width variants");
|
||||
assert(splitMarkup.includes("workspace-layout-pane-scrollable"), "split primary panes can own scrolling");
|
||||
assert(splitMarkup.includes("workspace-layout-content workspace-layout-pane-contained"), "contained content panes can delegate scrolling to their children");
|
||||
Reference in New Issue
Block a user