Files
jiapuapp/tests/module-page-visual-contract.ps1
T
2026-07-14 07:01:45 +08:00

32 lines
985 B
PowerShell

$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$componentPath = Join-Path $root 'components/ModulePage.vue'
if (-not (Test-Path -LiteralPath $componentPath)) {
throw 'Missing shared module page component'
}
$component = Get-Content -LiteralPath $componentPath -Raw -Encoding utf8
foreach ($anchor in @(
'a01-primary-button.png',
'background-image:',
'background-size: 100% 100%',
'.primary-action--compact'
)) {
if ($component -notmatch [regex]::Escape($anchor)) {
throw "ModulePage is missing primary-action visual anchor: $anchor"
}
}
if ($component -match '(?s)\.primary-action\s*\{[^}]*\bborder\s*:') {
throw 'ModulePage primary actions must not redraw the final button border with CSS'
}
if ($component -match '(?s)\.primary-action\s*\{[^}]*\bbackground\s*:\s*\$brand-red') {
throw 'ModulePage primary actions must not redraw the final button surface with a plain CSS color'
}
Write-Output 'MODULE-PAGE-VISUAL-CONTRACT PASS'