Files
jiapuapp/tests/t03-t06-all-states-visual-contract.ps1
T
2026-07-23 08:24:07 +08:00

41 lines
1.8 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$profile = Get-Content -LiteralPath (Join-Path $root 'pages/tree/t03-member-profile.vue') -Raw -Encoding utf8
$forms = [ordered]@{
'T04' = Get-Content -LiteralPath (Join-Path $root 'pages/tree/t04-add-relative.vue') -Raw -Encoding utf8
'T05' = Get-Content -LiteralPath (Join-Path $root 'pages/tree/t05-edit-member.vue') -Raw -Encoding utf8
'T06' = Get-Content -LiteralPath (Join-Path $root 'pages/tree/t06-edit-relationship.vue') -Raw -Encoding utf8
}
foreach ($rule in @(
'(?s)\.member-heading > view:last-child text:last-child\s*\{[^}]*font-size:\s*23rpx;',
'(?s)\.member-section-title\s*\{[^}]*font-size:\s*24rpx;',
'(?s)\.member-info-row text\s*\{[^}]*font-size:\s*23rpx;',
'(?s)\.member-relatives\s*\{[^}]*font-size:\s*23rpx;',
'(?s)\.member-error > text:nth-child\(2\)\s*\{[^}]*font-size:\s*24rpx;'
)) {
if ($profile -notmatch $rule) { throw "T03 readable visual rule missing: $rule" }
}
foreach ($entry in $forms.GetEnumerator()) {
foreach ($token in @(
'@include adaptive.adaptive-tree-panel;',
'@include adaptive.adaptive-tree-field;',
'grid-template-columns: auto minmax(0, 1fr)'
)) {
if (-not $entry.Value.Contains($token)) { throw "$($entry.Key) active form layout token missing: $token" }
}
foreach ($rule in @(
'(?s)\.form-copy,\s*\.form-note\s*\{[^}]*font-size:\s*24rpx;',
'(?s)\.form-field[^{]*text:first-child\s*\{[^}]*font-size:\s*24rpx;',
'(?s)\.form-field[^{]*(?:input|text:last-child)[^{]*\{[^}]*font-size:\s*24rpx;'
)) {
if ($entry.Value -notmatch $rule) { throw "$($entry.Key) readable visual rule missing: $rule" }
}
if ($entry.Value -match '(?m)\bposition\s*:') {
throw "$($entry.Key) must keep active form content in document flow"
}
}
Write-Output 'T03-T06-ALL-STATES-VISUAL-CONTRACT PASS'