37 lines
1.9 KiB
PowerShell
37 lines
1.9 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
function Read-Utf8([string]$path) { Get-Content -LiteralPath (Join-Path $root $path) -Raw -Encoding UTF8 }
|
|
|
|
$button = Read-Utf8 'components/AppButton.vue'
|
|
foreach ($token in @('<button', ':disabled="disabled"', ':aria-label="label"', '@click="handleClick"')) {
|
|
if (-not $button.Contains($token)) { throw "AppButton accessibility contract missing: $token" }
|
|
}
|
|
if ($button -match '<view\s+[^>]*class="app-button"') { throw 'AppButton must use a native button root' }
|
|
|
|
$header = Read-Utf8 'components/PageHeader.vue'
|
|
foreach ($pattern in @(
|
|
'(?s)<button[^>]+class="header-back"[^>]+aria-label=',
|
|
'(?s)<button[^>]+class="header-icon-button header-notice"[^>]+aria-label=',
|
|
'(?s)<button[^>]+class="header-icon-button"[^>]+aria-label='
|
|
)) {
|
|
if ($header -notmatch $pattern) { throw "PageHeader accessibility contract missing: $pattern" }
|
|
}
|
|
if (-not $header.Contains('fallbackUrl')) { throw 'PageHeader must expose a deep-link fallback route' }
|
|
|
|
$dialog = Read-Utf8 'components/AppDialog.vue'
|
|
foreach ($token in @('role="dialog"', 'aria-modal="true"', 'tabindex="-1"', '@keydown.esc.stop="cancel"', 'max-height: calc(100vh - 80rpx)', 'overflow-y: auto')) {
|
|
if (-not $dialog.Contains($token)) { throw "AppDialog accessibility contract missing: $token" }
|
|
}
|
|
|
|
$toast = Read-Utf8 'components/AppToast.vue'
|
|
foreach ($token in @('v-show="visible"', 'role="status"', 'aria-live="polite"', 'aria-atomic="true"')) {
|
|
if (-not $toast.Contains($token)) { throw "AppToast accessibility contract missing: $token" }
|
|
}
|
|
|
|
$loading = Read-Utf8 'components/AppLoading.vue'
|
|
foreach ($token in @('role="status"', 'aria-live="polite"', 'aria-busy="true"', 'animation: none')) {
|
|
if (-not $loading.Contains($token)) { throw "AppLoading accessibility contract missing: $token" }
|
|
}
|
|
|
|
Write-Output 'SHARED-INTERACTION-ACCESSIBILITY-CONTRACT PASS'
|