From 8f88d6ecdfa25ce9d3fc38a7ccc4468fc07ca685 Mon Sep 17 00:00:00 2001 From: rain Date: Tue, 21 Jul 2026 11:26:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A4=E8=AF=81=E9=A1=B5?= =?UTF-8?q?=E5=85=B1=E4=BA=AB=E8=87=AA=E9=80=82=E5=BA=94=E9=AA=A8=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/auth-page-shell-contract.ps1 | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/auth-page-shell-contract.ps1 diff --git a/tests/auth-page-shell-contract.ps1 b/tests/auth-page-shell-contract.ps1 new file mode 100644 index 0000000..78768f4 --- /dev/null +++ b/tests/auth-page-shell-contract.ps1 @@ -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', + '', + '', + '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 '