31 lines
2.4 KiB
PowerShell
31 lines
2.4 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
function Read-Utf8([string]$Path) { [System.IO.File]::ReadAllText((Join-Path (Join-Path $PSScriptRoot '..') $Path), [System.Text.Encoding]::UTF8) }
|
|
function Assert-Contains([string]$Content,[string]$Expected) { if (-not $Content.Contains($Expected)) { throw "R02 contract missing: $Expected" } }
|
|
$page = Read-Utf8 'pages/records/r02-person-detail.vue'
|
|
$catalog = Read-Utf8 'data/page-catalog.js'
|
|
foreach ($expected in @(
|
|
'class="person-detail-page"','person-detail-state--','class="person-identity-card"',
|
|
'class="person-edit-action"','class="person-save-action"','class="person-cancel-action"',
|
|
'shortFields','longFields','person-field__label','person-long-field__label','const enterEdit = () =>','const savePerson = () =>',
|
|
'const returnToPeople = () =>','r01-person-name-card.png','module-content-frame.png','module-field-frame.png',
|
|
'ModulePageBackground','PageHeader','AppButton','AppLoading','AppToast'
|
|
)) { Assert-Contains $page $expected }
|
|
foreach ($forbidden in @('<ModulePage page-id="r02"','import ModulePage from')) { if ($page.Contains($forbidden)) { throw "R02 retains forbidden dependency: $forbidden" } }
|
|
if ($catalog -match '(?m)^\s*r02\s*:') { throw 'R02 obsolete page-catalog owner must be removed' }
|
|
foreach ($forbidden in @('<image class="person-card-skin"','.person-card-skin')) {
|
|
if ($page.Contains($forbidden)) { throw "R02 must use container backgrounds instead of positioned decorative skins: $forbidden" }
|
|
}
|
|
if ($page -match '(?im)(?<![-\w])position\s*:') {
|
|
throw 'R02 must not contain position declarations'
|
|
}
|
|
foreach ($rule in @(
|
|
'(?s)\.person-detail-page\s*\{[^}]*display:\s*flex;[^}]*flex-direction:\s*column;',
|
|
'(?s)\.person-detail-header,\.person-detail-loading,\.person-detail-content\s*\{[^}]*z-index:\s*1;',
|
|
'(?s)\.person-identity-card\s*\{[^}]*background:\s*url\("/static/assets/modules/records/transparent/r01-person-name-card\.png"\) center / 100% 100% no-repeat;',
|
|
'(?s)\.person-archive-card,\.person-long-field,\.person-state-card\s*\{[^}]*background:\s*url\("/static/assets/modules/records/transparent/module-content-frame\.png"\) center / 100% 100% no-repeat;',
|
|
'(?s)\.person-field\s*\{[^}]*background:\s*url\("/static/assets/modules/records/transparent/module-field-frame\.png"\) center / 100% 100% no-repeat;'
|
|
)) {
|
|
if ($page -notmatch $rule) { throw "R02 document-flow background rule missing: $rule" }
|
|
}
|
|
Write-Output 'R02-PERSON-DETAIL-CONTRACT PASS'
|