Files
jiapuapp/tests/g05-document-flow-contract.ps1
T

41 lines
1.7 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$pagePath = Join-Path $root 'pages/genealogy/g05-genealogy-overview.vue'
$page = Get-Content -LiteralPath $pagePath -Raw -Encoding utf8
$style = [regex]::Match($page, '(?s)<style[^>]*>(.*?)</style>').Groups[1].Value
$styleWithoutComments = [regex]::Replace($style, '(?s)/\*.*?\*/', '')
$positions = [regex]::Matches($styleWithoutComments, '(?m)\bposition\s*:\s*([^;]+);')
if ($positions.Count -ne 0) {
$values = ($positions | ForEach-Object { $_.Groups[1].Value.Trim() }) -join ', '
throw "G05 ordinary overview layout must use document flow; found $($positions.Count) position declarations: $values"
}
foreach ($required in @(
'@include adaptive.adaptive-g05-overview-surface;',
'@include adaptive.adaptive-genealogy-state-panel;',
'background: url("/static/assets/foundation/transparent/a01-scroll-primary-v3.png")'
)) {
if ($page -notmatch [regex]::Escape($required)) {
throw "G05 document-flow migration is missing asset-backed surface: $required"
}
}
foreach ($obsoleteClass in @('overview-surface__skin', 'overview-state__frame')) {
if ($page -match "class=`"$obsoleteClass`"") {
throw "G05 must not retain decorative image layer .$obsoleteClass"
}
}
foreach ($selector in @('overview-ready', 'overview-public')) {
if ($style -match "(?s)\.$selector\s*\{[^}]*(?:height\s*:\s*100%|grid-template-rows\s*:[^;}]+)") {
throw "G05 .$selector must let overview content define row heights"
}
}
if ($style -match '(?s)\.overview-public__details\s*\{[^}]*grid-template-rows\s*:') {
throw 'G05 public details must grow from their data instead of fixed rows'
}
Write-Output 'G05-DOCUMENT-FLOW-CONTRACT PASS'