Files
jiapuapp/tests/app-button-compact-contract.ps1
T

29 lines
1.2 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$button = Get-Content -LiteralPath (Join-Path $root 'components/AppButton.vue') -Raw -Encoding UTF8
foreach ($token in @(
'compact: { type: Boolean, default: false }',
"'app-button--compact': compact",
'@use "../styles/adaptive-frame-profiles.scss" as adaptive;',
'@include adaptive-scroll-button(primary);',
'@include adaptive-scroll-button(secondary);',
'a01-scroll-primary-v3.png',
'a01-scroll-secondary-v3.png'
)) {
if (-not $button.Contains($token)) { throw "AppButton compact contract missing: $token" }
}
if ($button.Contains('border-image-slice: 56 300 fill;')) {
throw 'AppButton must consume the shared adaptive frame profile instead of owning slice values'
}
if ($button -notmatch '(?s)\.app-button--compact \.app-button__skin\s*\{[^}]*display:\s*none;') {
throw 'AppButton compact mode must hide the aspectFit image skin'
}
if ($button -notmatch '(?s)\.app-button--compact \.app-button__label\s*\{[^}]*padding:\s*0;[^}]*font-size:\s*clamp\(14px, 23rpx, 17px\);[^}]*letter-spacing:\s*0;[^}]*white-space:\s*nowrap;') {
throw 'AppButton compact label must preserve four-character action capacity'
}
Write-Output 'APP-BUTTON-COMPACT-CONTRACT PASS'