39 lines
2.5 KiB
PowerShell
39 lines
2.5 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
$list = Get-Content -LiteralPath (Join-Path $root 'pages/records/r01-people-list.vue') -Raw -Encoding UTF8
|
|
$detail = Get-Content -LiteralPath (Join-Path $root 'pages/records/r02-person-detail.vue') -Raw -Encoding UTF8
|
|
foreach ($token in @('listTreeMemberPresentationFixtures', 'openPage(', '"R02",', 'genealogyId: genealogyId.value', 'mode: "create"', 'mode: "view"')) {
|
|
if (-not $list.Contains($token)) { throw "R01 create flow missing: $token" }
|
|
}
|
|
foreach ($token in @('findTreeMemberPresentationFixture', 'routeMode.value === "create"', 'localPersonPreview', '"R08",', '"R09",', 'genealogyId: genealogyId.value', 'personId: personId.value', 'requestBack', 'auto-height')) {
|
|
if (-not $detail.Contains($token)) { throw "R02 person flow missing: $token" }
|
|
}
|
|
if ($detail -notmatch '(?s)\["privacy",\s*"forbidden"\]\.includes\(selected\.status\).*?personState\.value\s*=\s*"privacy"') {
|
|
throw 'R02 must derive restricted presentation from the scoped person status instead of an unregistered route flag'
|
|
}
|
|
if ($detail -notmatch 'personState\.value\s*===\s*"preview"\s*\|\|') {
|
|
throw 'R02 must treat a generated local preview as unsaved work during back navigation'
|
|
}
|
|
if ($detail -notmatch '(?s)const returnToPeople = \(\) =>\s*genealogyId\.value\s*\?\s*returnTo\("R01".*?:\s*goBack\(\)') {
|
|
throw 'R02 invalid-entry CTA must fall back to goBack when no genealogy identity is available'
|
|
}
|
|
if ($detail -match 'errors\.generationName\s*=') {
|
|
throw 'R02 must not make optional generationName a client-side required field'
|
|
}
|
|
if ($detail -notmatch '(?s)const generationInput = draft\.generation\.trim\(\);.*?errors\.generation\s*=\s*!generationInput\s*\?\s*""') {
|
|
throw 'R02 must allow the optional generation field to remain empty'
|
|
}
|
|
if ($detail.Contains('canEdit')) {
|
|
throw 'R02 local preview must not treat a fixture field as a backend edit capability'
|
|
}
|
|
$detailDialogs = [regex]::Matches($detail, '(?s)<AppDialog\b.*?>')
|
|
if ($detailDialogs.Count -eq 0 -or ($detailDialogs | Where-Object { $_.Value -notmatch ':close-on-mask="false"' })) {
|
|
throw 'R02 discard confirmation must ignore mask taps'
|
|
}
|
|
foreach ($source in @($list, $detail)) {
|
|
foreach ($forbidden in @('uni.navigateTo', 'uni.reLaunch', '/pages/records/', '人物资料已保存', 'finishPage(')) {
|
|
if ($source.Contains($forbidden)) { throw "R01/R02 retains forbidden fake-write or raw-route contract: $forbidden" }
|
|
}
|
|
}
|
|
Write-Output 'R01-R02-PERSON-FLOW-CONTRACT PASS'
|