Files
jiapuapp/tests/tac-shell-accessibility-contract.ps1
T
2026-07-24 07:56:33 +08:00

40 lines
1.2 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$component = Get-Content -LiteralPath (Join-Path $root 'components/TacVerification.vue') -Raw -Encoding UTF8
foreach ($token in @(
'v-show="visible"',
'id="jiapu-tac-host"',
':prop="renderContext"',
':change:prop="tacRenderer.onContextChange"',
'btnCloseFun:',
'btnRefreshFun:',
'this.tac = new window.TAC(config);'
)) {
if (-not $component.Contains($token)) { throw "Missing native TAC shell token: $token" }
}
foreach ($forbidden in @(
'tac-panel',
'tac-heading',
'tac-tool',
'slider-bottom .close-btn',
'slider-bottom .refresh-btn',
'logoUrl:',
'i18n:',
'new window.TAC(config, {'
)) {
if ($component.Contains($forbidden)) { throw "TAC overrides vendor rendering: $forbidden" }
}
$styleStart = $component.IndexOf('<style scoped>')
if ($styleStart -lt 0) { throw 'Missing minimal TAC mount style' }
$style = $component.Substring($styleStart)
$visualTokens = @('background:', 'border:', 'border-radius:', 'box-shadow:', 'color:', 'font-', 'padding:', 'opacity:', 'transition:')
foreach ($forbidden in $visualTokens) {
if ($style.Contains($forbidden)) { throw "TAC mount adds visual styling: $forbidden" }
}
Write-Output 'TAC-VENDOR-NATIVE-SHELL-CONTRACT PASS'