49 lines
2.1 KiB
PowerShell
49 lines
2.1 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
|
|
}
|
|
}
|
|
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
$loginPath = Join-Path $root 'pages/auth/a02-login.vue'
|
|
$pagesPath = Join-Path $root 'pages.json'
|
|
|
|
$login = Get-Content -LiteralPath $loginPath -Raw -Encoding utf8
|
|
$pages = Get-Content -LiteralPath $pagesPath -Raw -Encoding utf8 | ConvertFrom-Json
|
|
$registerPrompt = ConvertFrom-Utf8Base64 '6L+Y5rKh5pyJ6LSm5Y+377yf'
|
|
$registerEntry = ConvertFrom-Utf8Base64 '5rOo5YaM6LSm5Y+3'
|
|
|
|
Assert-Contains -Content $login -Expected 'class="register-entry"' -Message 'A-02 must expose a dedicated registration entry below its agreement row'
|
|
Assert-Contains -Content $login -Expected $registerPrompt -Message 'A-02 must explain the registration path to new users'
|
|
Assert-Contains -Content $login -Expected 'class="register-link" hover-class="text-hover" @click="prepareRegister"' -Message 'A-02 registration copy must provide a focused tap target'
|
|
Assert-Contains -Content $login -Expected (">$registerEntry</view>") -Message 'A-02 registration action must be visible'
|
|
Assert-Contains -Content $login -Expected "const prepareRegister = () => uni.navigateTo({ url: '/pages/auth/a04-register' })" -Message 'A-02 registration entry must navigate to A-04'
|
|
|
|
$agreementIndex = $login.IndexOf('class="agreement-row"')
|
|
$registerIndex = $login.IndexOf('class="register-entry"')
|
|
if ($registerIndex -le $agreementIndex) {
|
|
throw 'A-02 registration entry must follow its agreement row in reading order'
|
|
}
|
|
if ($login -notmatch '(?s)\.register-link\s*\{[^}]*min-height:\s*88rpx') {
|
|
throw 'A-02 registration entry must retain a touch-friendly height'
|
|
}
|
|
|
|
if (-not ($pages.pages.path -contains 'pages/auth/a04-register')) {
|
|
throw 'A-02 registration entry target must remain declared in pages.json'
|
|
}
|
|
|
|
Write-Output 'A02-REGISTER-ENTRY-CONTRACT PASS'
|