测试认证页共享自适应骨架

This commit is contained in:
rain
2026-07-21 11:26:59 +08:00
parent c0f3233e26
commit 8f88d6ecdf
+40
View File
@@ -0,0 +1,40 @@
$ErrorActionPreference = 'Stop'
function Assert-Contains {
param([string]$Content, [string]$Expected, [string]$Message)
if ($Content -notmatch [regex]::Escape($Expected)) { throw $Message }
}
function Assert-NotContains {
param([string]$Content, [string]$Unexpected, [string]$Message)
if ($Content -match [regex]::Escape($Unexpected)) { throw $Message }
}
$root = Split-Path -Parent $PSScriptRoot
$shellPath = Join-Path $root 'components/AuthPageShell.vue'
if (-not (Test-Path -LiteralPath $shellPath)) { throw 'AuthPageShell is missing' }
$shell = Get-Content -LiteralPath $shellPath -Raw -Encoding utf8
foreach ($required in @(
'class="auth-shell__header"',
'class="auth-shell__header-image"',
'a01-vnext-header-v1.png',
'mode="widthFix"',
'class="auth-shell__paper"',
'auth-page-paper.jpg',
'<slot />',
'<slot name="overlay" />',
'min-height: var(--app-viewport-height);'
)) {
Assert-Contains -Content $shell -Expected $required -Message "AuthPageShell is missing: $required"
}
foreach ($pageName in @('a01-entry.vue', 'a04-register.vue', 'a05-reset-password.vue', 'a06-auth-status.vue')) {
$page = Get-Content -LiteralPath (Join-Path $root "pages/auth/$pageName") -Raw -Encoding utf8
Assert-Contains -Content $page -Expected '<AuthPageShell' -Message "$pageName must consume AuthPageShell"
foreach ($forbidden in @('class="page-canvas"', 'class="page-backdrop"', 'mode="scaleToFill"', '1665rpx')) {
Assert-NotContains -Content $page -Unexpected $forbidden -Message "$pageName retains rejected page coordinates: $forbidden"
}
}
Write-Output 'AUTH-PAGE-SHELL-CONTRACT PASS'