Add product presentation extension contracts
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
||||
viewSurfaceCatalogueForModules,
|
||||
visibleRoutesForProjection
|
||||
} from "../src/platform/views";
|
||||
import { groupNavigationItems } from "../src/platform/productAreas";
|
||||
import { scopeGrants } from "../src/utils/permissions";
|
||||
|
||||
function assert(condition: unknown, message: string): void {
|
||||
@@ -148,6 +149,49 @@ functionAction.onClick({
|
||||
assert(selectedFunctionId === "function-1", "organization function actions receive their row context");
|
||||
assert(!("render" in functionAction), "organization function actions expose metadata instead of arbitrary rendered controls");
|
||||
|
||||
const productNavigation = [
|
||||
{ to: "/dashboard", label: "Dashboard", surfaceId: "dashboard.nav.dashboard" },
|
||||
{ to: "/tasks", label: "Tasks", surfaceId: "tasks.nav.tasks" },
|
||||
{ to: "/files", label: "Files", surfaceId: "files.nav.files" },
|
||||
{ to: "/admin", label: "Administration", surfaceId: "admin.nav.admin" }
|
||||
];
|
||||
const productAreas = [
|
||||
{
|
||||
id: "work",
|
||||
moduleId: "tasks",
|
||||
label: "Work",
|
||||
iconName: "list-checks" as const,
|
||||
surfaceIds: ["tasks.nav.tasks"],
|
||||
order: 10
|
||||
},
|
||||
{
|
||||
id: "records-documents",
|
||||
moduleId: "files",
|
||||
label: "Records and documents",
|
||||
iconName: "folder" as const,
|
||||
surfaceIds: ["files.nav.files"],
|
||||
order: 20
|
||||
}
|
||||
];
|
||||
const groupedNavigation = groupNavigationItems(productNavigation, productAreas, {
|
||||
navigationMode: "grouped",
|
||||
productAreaOrder: ["records-documents", "work"],
|
||||
productAreaLabels: { work: "My work" }
|
||||
});
|
||||
assert(
|
||||
groupedNavigation.map((group) => group.id).join(",") ===
|
||||
"overview,product-area:records-documents,product-area:work,more-tools",
|
||||
"product-area navigation should preserve dashboard, configured order, and unclassified tools"
|
||||
);
|
||||
assert(
|
||||
groupedNavigation[2]?.label === "My work",
|
||||
"View presentation should override a product-area label"
|
||||
);
|
||||
assert(
|
||||
groupNavigationItems(productNavigation, productAreas, { navigationMode: "flat" })[0]?.items.length === 4,
|
||||
"flat navigation should retain every authorized destination"
|
||||
);
|
||||
|
||||
const viewAwareFiles: PlatformWebModule = {
|
||||
...files,
|
||||
navItems: [{ to: "/files", label: "Files", order: 20 }],
|
||||
|
||||
Reference in New Issue
Block a user