71 lines
3.0 KiB
PowerShell
71 lines
3.0 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
|
|
function ConvertFrom-Utf8Base64 {
|
|
param([string]$Value)
|
|
return [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($Value))
|
|
}
|
|
|
|
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
|
|
$registerPath = Join-Path $root 'pages/auth/a04-register.vue'
|
|
$pages = Get-Content -LiteralPath (Join-Path $root 'pages.json') -Raw -Encoding utf8 | ConvertFrom-Json
|
|
$catalog = Get-Content -LiteralPath (Join-Path $root 'data/page-catalog.js') -Raw -Encoding utf8
|
|
$register = Get-Content -LiteralPath $registerPath -Raw -Encoding utf8
|
|
$registerCopy = ConvertFrom-Utf8Base64 '5rOo5YaM6LSm5Y+3'
|
|
$loginCopy = ConvertFrom-Utf8Base64 '55m75b2V'
|
|
|
|
if (-not ($pages.pages.path -contains 'pages/auth/a04-register')) { throw 'A-04 route must remain declared in pages.json' }
|
|
Assert-NotContains -Content $register -Unexpected 'ModulePage' -Message 'A-04 must not remain a ModulePage shell'
|
|
foreach ($required in @(
|
|
'auth-header',
|
|
'register-panel__skin',
|
|
'a02-login-panel.png',
|
|
'a01-primary-button.png',
|
|
'a02-agreement-unchecked.png',
|
|
'a02-agreement-checked.png',
|
|
'v-model.trim="phone"',
|
|
'v-model="password"',
|
|
'v-model="confirmPassword"',
|
|
'const agreed = ref(false)',
|
|
'const toggleAgreement = () =>',
|
|
'const submitRegister = () =>',
|
|
"const prepareLogin = () => uni.navigateTo({ url: '/pages/auth/a02-login' })",
|
|
'if (!/^1\d{10}$/.test(phone.value))',
|
|
'if (!password.value)',
|
|
'if (password.value !== confirmPassword.value)'
|
|
)) {
|
|
Assert-Contains -Content $register -Expected $required -Message "Missing A-04 registration contract: $required"
|
|
}
|
|
Assert-Contains -Content $register -Expected $registerCopy -Message 'A-04 must visibly identify registration'
|
|
Assert-Contains -Content $register -Expected $loginCopy -Message 'A-04 must provide a login return path'
|
|
Assert-NotContains -Content $catalog -Unexpected 'a04:' -Message 'A-04 must not remain in the temporary page catalog'
|
|
Assert-NotContains -Content $register -Unexpected 'register-intro' -Message 'A-04 must not retain the redundant registration intro copy'
|
|
foreach ($required in @(
|
|
'auth-divider-knot.png',
|
|
'register-divider',
|
|
'width: 154rpx'
|
|
)) {
|
|
Assert-Contains -Content $register -Expected $required -Message "Missing A-04 visual balance contract: $required"
|
|
}
|
|
|
|
foreach ($forbidden in @(
|
|
'(?s)\.register-panel\s*\{[^}]*\bborder\s*:',
|
|
'(?s)\.register-panel\s*\{[^}]*\bbackground\s*:',
|
|
'(?s)\.register-submit\s*\{[^}]*\bborder\s*:',
|
|
'(?s)\.register-submit\s*\{[^}]*\bbackground\s*:',
|
|
'\.agreement-icon::(?:before|after)'
|
|
)) {
|
|
if ($register -match $forbidden) { throw "A-04 retains forbidden CSS visual construction: $forbidden" }
|
|
}
|
|
|
|
Write-Output 'A04-REGISTRATION-CONTRACT PASS'
|