完成50%
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
$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-dialog"', 'role="dialog"', 'aria-modal="true"',
|
||||
'tabindex="-1"', 'aria-labelledby="jiapu-tac-title"',
|
||||
'aria-describedby="jiapu-tac-description"', '@keydown.esc.stop.prevent="requestCancel"',
|
||||
'class="tac-tool tac-tool--refresh"', 'aria-label="刷新安全验证"',
|
||||
'class="tac-tool tac-tool--close"', 'aria-label="关闭安全验证"',
|
||||
'const previousFocus = document.activeElement', 'activateFocusTrap()',
|
||||
'deactivateFocusTrap(', 'event.key !== "Tab"', 'previousFocus?.focus?.()',
|
||||
':deep(.slider-bottom .close-btn)', ':deep(.slider-bottom .refresh-btn)',
|
||||
'min-width: 48px;', 'min-height: 48px;'
|
||||
)) {
|
||||
if (-not $component.Contains($token)) { throw "TAC 外壳无障碍预检缺少:$token" }
|
||||
}
|
||||
|
||||
$logicalScript = [regex]::Match($component, '(?s)<script>(?<Body>.*?)</script>').Groups['Body'].Value
|
||||
foreach ($browserOnly in @('document.', 'window.', 'querySelector(')) {
|
||||
if ($logicalScript.Contains($browserOnly)) {
|
||||
throw "TAC 逻辑层不得访问浏览器专属对象:$browserOnly"
|
||||
}
|
||||
}
|
||||
|
||||
$toolButtons = [regex]::Matches($component, '(?s)<button\b[^>]*class="[^"]*tac-tool\b')
|
||||
if ($toolButtons.Count -lt 2) { throw 'TAC 外壳至少要有刷新与关闭两个原生操作' }
|
||||
if ([regex]::Matches($component, 'class="tac-tool tac-tool--refresh"').Count -ne 1) { throw 'TAC 刷新操作必须有唯一 owner' }
|
||||
if ([regex]::Matches($component, 'class="tac-tool tac-tool--close"').Count -ne 1) { throw 'TAC 关闭操作必须有唯一 owner' }
|
||||
|
||||
Write-Output 'TAC-SHELL-ACCESSIBILITY-CONTRACT PASS'
|
||||
Reference in New Issue
Block a user