Files
jiapuapp/tests/t01-all-states-visual-contract.ps1
T

52 lines
2.1 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$tree = Get-Content -LiteralPath (Join-Path $root 'pages/tree/t01-tree-overview.vue') -Raw -Encoding utf8
$page = Get-Content -LiteralPath (Join-Path $root 'pages/tree/t02-pedigree-overview.vue') -Raw -Encoding utf8
foreach ($required in @(
'@action="toTree"',
'class="pedigree-page"',
'class="pedigree-layout"',
'class="pedigree-scroll"',
'class="pedigree-sheet"',
'class="pedigree-column pedigree-column--legend"',
'class="member-node__relation"',
'class="member-node__name"',
'class="member-node__copy"',
'class="generation-band__arrow"',
'v-for="(page, pageIndex) in pedigreePages"',
'v-for="(member, memberIndex) in page.members"',
'class="pedigree-swiper"',
':disable-touch="false"',
'scroll-y',
'const openMemberProfile = (member) =>',
'const openMemberDetail = async (member) =>',
'detailVisible',
'<AppDialog'
)) {
if ($page -notmatch [regex]::Escape($required)) {
throw "T02 pedigree visual contract missing: $required"
}
}
foreach ($rule in @(
'(?s)\.pedigree-layout\s*\{[^}]*display:\s*grid;[^}]*grid-template-columns:\s*minmax\(0, 1fr\) 92rpx;',
'(?s)\.pedigree-swiper\s*\{[^}]*width:\s*100%;[^}]*height:\s*100%;',
'(?s)\.pedigree-sheet\s*\{[^}]*display:\s*grid;[^}]*width:\s*100%;[^}]*grid-template-columns:\s*repeat\(6, minmax\(0, 1fr\)\);',
'(?s)\.member-node\s*\{[^}]*grid-template-rows:\s*144rpx 274rpx minmax\(0, 1fr\);',
'(?s)\.member-node__name\s*\{[^}]*font-size:\s*clamp\(19px, 34rpx, 24px\);',
'(?s)\.member-node__copy\s*\{[^}]*writing-mode:\s*vertical-rl;',
'(?s)\.generation-band__copy\s*\{[^}]*writing-mode:\s*vertical-rl;'
)) {
if ($page -notmatch $rule) { throw "T02 pedigree visual rule missing: $rule" }
}
if ($page -match 'scroll-x|treeScrollLeft|openMemberPanel') {
throw 'T02 must use direct swiper gestures and separate its name/detail tap targets'
}
if ($tree -notmatch 'scroll-x|treeScrollLeft|class="lineage-pan-cue"|@action="toPedigree"') {
throw 'T01 must retain the horizontal tree-diagram reader and its pedigree entry'
}
Write-Output 'T01-ALL-STATES-VISUAL-CONTRACT PASS'