Migrate Tenancy interface patterns
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
|
||||
function source(path) {
|
||||
return readFileSync(new URL(path, import.meta.url), "utf8");
|
||||
}
|
||||
|
||||
function assert(condition, message) {
|
||||
if (!condition) throw new Error(message);
|
||||
}
|
||||
|
||||
const tenants = source("../src/features/admin/TenantsPanel.tsx");
|
||||
const settings = source("../src/features/admin/TenantSettingsPanel.tsx");
|
||||
const patterns = source("../src/features/admin/interfacePatterns.ts");
|
||||
const moduleSource = source("../src/module.ts");
|
||||
const translations = source("../src/i18n/generatedTranslations.ts");
|
||||
|
||||
assert(tenants.includes("DocumentationHelpLink") && settings.includes("DocumentationHelpLink"), "Both Tenancy admin surfaces expose contextual documentation");
|
||||
assert(tenants.includes("ActionBlockerHint") && settings.includes("ActionBlockerHint"), "Read-only Tenancy states identify the actor, action, and destination");
|
||||
assert(tenants.includes("disabledReason") && settings.includes("disabledReason"), "Disabled Tenancy actions explain their state");
|
||||
assert(tenants.includes("requestDiscard(closeEditor)"), "The tenant editor uses the shared unsaved-change guard when closing");
|
||||
assert(settings.includes("requestDiscard(() => void load())"), "Tenant settings protect dirty state when reloading");
|
||||
assert(tenants.includes("ConfirmDialog") && tenants.includes("confirmSuspend"), "Tenant suspension remains explicitly confirmed");
|
||||
assert(tenants.includes("minimumSlots={3}"), "Tenant row actions reserve stable keyboard and visual positions");
|
||||
assert(!tenants.includes("applicable:"), "Row-specific unavailable actions stay visible with an explanation");
|
||||
assert(patterns.includes('topicId: "tenancy.lifecycle-and-settings"') && patterns.includes('topicId: "tenancy.reference.admin-fields"'), "Tenancy uses stable manifest-backed help references");
|
||||
assert(moduleSource.includes('version: "0.1.8"'), "The WebUI contribution reports the module release version");
|
||||
assert(moduleSource.includes('label: "i18n:govoplan-tenancy.tenants.1f7ae776"') && moduleSource.includes('label: "i18n:govoplan-tenancy.tenant_general_settings.db1c3ba8"'), "View-surface labels are localized");
|
||||
assert(translations.includes('"i18n:govoplan-tenancy.tenant_administration_is_read_only.7c9a1011"'), "Availability explanations are present in the translation catalog");
|
||||
|
||||
console.log("Tenancy surfaces satisfy the recorded interface pattern-language contract.");
|
||||
Reference in New Issue
Block a user