Files
jiapuapp/tests/app-dialog-responsive-content-contract.ps1
T

35 lines
1.4 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$dialog = Get-Content -LiteralPath (Join-Path $root 'components/AppDialog.vue') -Raw -Encoding UTF8
foreach ($token in @(
'compactActions: { type: Boolean, default: false }',
'class="app-dialog__copy"',
':compact="compactActions && showCancel"',
'@use "../styles/adaptive-frame-profiles.scss" as adaptive;',
'@include adaptive-auth-dialog;',
'padding: calc(40rpx + env(safe-area-inset-top)) 40rpx calc(40rpx + env(safe-area-inset-bottom));',
'max-height: calc(var(--app-viewport-height, 100vh) - 80rpx - env(safe-area-inset-top) - env(safe-area-inset-bottom));',
'min-height: 0;',
'margin-top: 26rpx;'
)) {
if (-not $dialog.Contains($token)) { throw "AppDialog responsive contract missing: $token" }
}
foreach ($forbidden in @(
'min-height: 520rpx;',
'center / contain no-repeat',
'margin-top: auto;'
)) {
if ($dialog.Contains($forbidden)) { throw "AppDialog responsive contract forbids: $forbidden" }
}
foreach ($rule in @(
'(?s)\.app-dialog__copy\s*\{[^}]*display:\s*flex;[^}]*width:\s*100%;[^}]*flex-direction:\s*column;',
'(?s)\.app-dialog__title,\s*\.app-dialog__message\s*\{[^}]*display:\s*block;[^}]*width:\s*100%;'
)) {
if ($dialog -notmatch $rule) { throw "AppDialog responsive layout rule missing: $rule" }
}
Write-Output 'APP-DIALOG-RESPONSIVE-CONTENT-CONTRACT PASS'