Files
jiapuapp/tests/ag-responsive-surfaces-contract.ps1
T
2026-07-21 20:59:10 +08:00

55 lines
2.2 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
function Read-Utf8([string]$path) {
Get-Content -LiteralPath (Join-Path $root $path) -Raw -Encoding UTF8
}
$expected = @{
'components/AppToast.vue' = @('adaptive.adaptive-feedback-toast')
'pages/auth/a01-entry.vue' = @('adaptive.adaptive-feedback-toast')
'pages/auth/a04-register.vue' = @('adaptive.adaptive-feedback-toast')
'pages/auth/a05-reset-password.vue' = @('adaptive.adaptive-feedback-toast')
'pages/genealogy/g01-my-genealogies.vue' = @(
'adaptive.adaptive-genealogy-current-slip',
'adaptive.adaptive-genealogy-list-card',
'adaptive.adaptive-genealogy-state-panel',
'adaptive.adaptive-g01-add-sheet',
'adaptive.adaptive-g01-switcher'
)
'pages/genealogy/g09-my-applications.vue' = @('adaptive.adaptive-genealogy-list-card')
'pages/genealogy/g10-application-review.vue' = @(
'adaptive.adaptive-genealogy-form-field',
'adaptive.adaptive-genealogy-list-card',
'adaptive.adaptive-scroll-button',
'adaptive.adaptive-feedback-toast'
)
}
foreach ($path in $expected.Keys) {
$source = Read-Utf8 $path
if (-not $source.Contains('@use "../../styles/adaptive-frame-profiles.scss" as adaptive;') -and
-not $source.Contains('@use "../styles/adaptive-frame-profiles.scss" as adaptive;')) {
throw "$path must import the adaptive frame profile owner"
}
foreach ($token in $expected[$path]) {
if (-not $source.Contains($token)) { throw "$path missing adaptive surface: $token" }
}
if ($source -match '(?im)border-image-slice\s*:') {
throw "$path must not own border-image slice values"
}
}
$g01 = Read-Utf8 'pages/genealogy/g01-my-genealogies.vue'
$g10 = Read-Utf8 'pages/genealogy/g10-application-review.vue'
foreach ($source in @($g01, $g10)) {
if ($source -match '(?im)background\s*:[^;\r\n]*100%\s+100%[^;\r\n]*;') {
throw 'A/G variable surfaces must not stretch full images to 100% 100%'
}
}
$tabbar = Read-Utf8 'components/AppTabbar.vue'
if ($tabbar -match '(?im)(?<![-\w])height\s*:\s*112rpx;') { throw 'AppTabbar must use a minimum baseline instead of fixed content height' }
Write-Output 'AG-RESPONSIVE-SURFACES-CONTRACT PASS'