import { describe, expect, it } from "vitest"; import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; function findRepoRoot(startDir: string): string { let dir = startDir; while (!fs.existsSync(path.join(dir, "pnpm-workspace.yaml"))) { const parent = path.dirname(dir); if (parent === dir) return process.cwd(); dir = parent; } return dir; } const repoRoot = findRepoRoot(path.dirname(fileURLToPath(import.meta.url))); const screenFiles = [ "apps/web/app/components/screens/shared/PageShell.tsx", "apps/web/app/components/screens/forms/FormsAdminPage.tsx", "apps/web/app/components/screens/forms/FormNewPage.tsx", "apps/web/app/components/screens/forms/FormEditorPage.tsx", "apps/web/app/components/screens/forms/editor/QuestionsTab.tsx", "apps/web/app/components/screens/forms/editor/LeadMappingView.tsx", "apps/web/app/components/screens/forms/editor/DesignTab.tsx", "apps/web/app/components/screens/forms/editor/ResponsesTab.tsx", "apps/web/app/components/screens/automation/AutomationListPage.tsx", "apps/web/app/components/screens/automation/AutomationExecutionsPage.tsx", "apps/web/app/components/screens/automation/AutomationExecutionDetailPage.tsx", "apps/web/app/components/screens/automation/AutomationTemplatesPage.tsx", "apps/web/app/components/screens/automation/automationUi.tsx", "apps/web/app/components/screens/automation/dialogs/StartAuswahlDialog.tsx", "apps/web/app/components/screens/automation/dialogs/ProbelaufDialog.tsx", "apps/web/app/components/screens/automation/dialogs/SchleifenWarnungDialog.tsx", "apps/web/app/components/screens/automation/dialogs/BausteinPickerDrawer.tsx", "apps/web/app/components/screens/automation/dialogs/NodeConfigDialog.tsx", "apps/web/app/components/screens/automation/nodeConfigDescriptors.ts", "apps/web/app/components/screens/calendar/CalendarViewPage.tsx", "apps/web/app/components/screens/calendar/CalendarConnectionsPage.tsx", "apps/web/app/components/screens/calendar/CalendarConnectionDetailPage.tsx", "apps/web/app/components/screens/booking/BookingListPage.tsx", "apps/web/app/components/screens/booking/BookingDetailPage.tsx", "apps/web/app/components/screens/booking/BookingPagesPage.tsx", "apps/web/app/components/screens/booking/BookingPageEditorPage.tsx", "apps/web/app/components/screens/booking/AvailabilityPage.tsx", "apps/web/app/components/screens/signature/ProjectSignaturePanel.tsx", "apps/web/app/components/screens/signature/SignatureWizardDialog.tsx", "apps/web/app/components/screens/signature/PublicSignPage.tsx", "apps/web/app/components/screens/email-inbox/EmailInboxListPage.tsx", "apps/web/app/components/screens/email-inbox/EmailMessageDetailPage.tsx", "apps/web/app/components/screens/email-inbox/EmailComposePage.tsx", "apps/web/app/components/screens/email-inbox/EmailMailboxSettingsPage.tsx", "apps/web/app/components/screens/integrations/IntegrationsCatalogPage.tsx", "apps/web/app/components/screens/integrations/ConnectionDetailPage.tsx", "apps/web/app/components/screens/integrations/SyncHistoryPage.tsx", "apps/web/app/components/screens/integrations/SyncRunDetailPage.tsx", "apps/web/app/components/screens/billing/SubscriptionOverviewPage.tsx", "apps/web/app/components/screens/billing/BillingUsagePage.tsx", "apps/web/app/components/screens/billing/BillingPaymentPage.tsx", "apps/web/app/components/screens/plugins/PluginCatalogPage.tsx", "apps/web/app/components/screens/onboarding/DemoDataSettingsPage.tsx", "apps/web/app/components/screens/onboarding/FirstStepsChecklistPage.tsx", "apps/web/app/components/screens/onboarding/FirstStepsChecklistWidget.tsx", "apps/web/app/components/screens/projects/BoardsStartPage.tsx", "apps/web/app/components/screens/projects/PipelineKanbanPage.tsx", "apps/web/app/components/screens/projects/ProjektListPage.tsx", "apps/web/app/components/screens/projects/ProjektDetailPage.tsx", // WF-P8 S02 sections. Listed individually so the layout gates keep covering // the detail screen after it was split out of one file. "apps/web/app/components/screens/projects/detail/detailUi.tsx", "apps/web/app/components/screens/projects/detail/DetailHeader.tsx", "apps/web/app/components/screens/projects/detail/DetailQuickActionBar.tsx", "apps/web/app/components/screens/projects/detail/DetailStatusField.tsx", "apps/web/app/components/screens/projects/detail/GrunddatenSection.tsx", "apps/web/app/components/screens/projects/detail/PlanungSection.tsx", "apps/web/app/components/screens/projects/detail/ProjektkontaktSection.tsx", "apps/web/app/components/screens/projects/detail/KontakteSection.tsx", "apps/web/app/components/screens/projects/detail/AdressenSection.tsx", "apps/web/app/components/screens/projects/detail/DetailSideRail.tsx", "apps/web/app/components/screens/projects/detail/AddKontaktBlock.tsx", "apps/web/app/components/screens/projects/detail/KwpSection.tsx", "apps/web/app/components/screens/projects/PipelineAdminPage.tsx", "apps/web/app/components/screens/projects/LostReasonAdminPage.tsx", // WF-P8 Subframe baseline dialogs. "apps/web/app/components/screens/projects/dialogs/PipelineHandoverDialog.tsx", "apps/web/app/components/screens/projects/dialogs/ProjectQuickActionDialogs.tsx", "apps/web/app/components/screens/projects/PipelineFieldTemplatePage.tsx", "apps/web/app/components/screens/settings/SettingsHubShell.tsx", ]; describe("Subframe screen layout boundary", () => { it("does not nest generated Subframe app chrome inside HiveGrid app routes", () => { for (const screenFile of screenFiles) { const source = fs.readFileSync(path.join(repoRoot, screenFile), "utf8"); expect(source).not.toContain("~/ui/layouts/DefaultPageLayout"); expect(source).not.toContain(" { // The ~/ui TextInput/Select roots carry `h-full w-full`. `grow` does not // override that width, so inside a WRAPPING flex row each field claims the // whole line (the row breaks after every field) and stretches to the row // height, with `justify-center` parking the input in the middle of that // height — the field reads as detached from its own label and collides // with the next one. Give the field an explicit width, or lay the row out // as a grid so each field fills its track. A non-wrapping `flex` row is // fine: the fields simply shrink. Hit for real in the WF-P8 "Termin // erstellen" dialog (2026-07-29). const FIELD_WITH_GROW = /<(?:TextInput|Select)\b[^>]*className="(?:[^"]*\s)?grow(?:\s[^"]*)?"/; for (const screenFile of screenFiles) { const source = fs.readFileSync(path.join(repoRoot, screenFile), "utf8"); for (const match of source.matchAll(/flex-wrap/g)) { // Only the fields directly opening this row matter, hence the window. const row = source.slice(match.index, match.index + 600); expect( FIELD_WITH_GROW.test(row), `${screenFile}: field with \`grow\` in a flex-wrap row near offset ${match.index} — use a grid or an explicit width` ).toBe(false); } } }); it("does not use the Subframe inner-scroll pattern that collapses inside the app shell", () => { // The shell's
is a block-level scroll container without a definite // height. A screen root with `h-full`+`overflow-hidden` plus a // `grow shrink-0 basis-0`+`overflow-y-auto` scroll area therefore // collapses to 0px and hides all content. Screens must use plain // document flow and let
scroll. for (const screenFile of screenFiles) { const source = fs.readFileSync(path.join(repoRoot, screenFile), "utf8"); const classNames = [...source.matchAll(/className="([^"]*)"/g)].map((match) => match[1]); for (const className of classNames) { const isHiddenFullHeightRoot = className.includes("h-full") && className.includes("overflow-hidden"); const isCollapsingScrollArea = className.includes("basis-0") && className.includes("overflow-y-auto"); expect(isHiddenFullHeightRoot, `${screenFile}: h-full + overflow-hidden root traps content: "${className}"`).toBe(false); expect(isCollapsingScrollArea, `${screenFile}: basis-0 + overflow-y-auto scroll area collapses: "${className}"`).toBe(false); } } }); });