57 lines
2.9 KiB
PowerShell
57 lines
2.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' }
|
|
foreach ($token in @(
|
|
'customBack: { type: Boolean, default: false }',
|
|
'const emit = defineEmits(["brand", "notice", "action", "back"]);',
|
|
'if (props.customBack) {',
|
|
'emit("back");',
|
|
'uni.navigateBack();',
|
|
'uni.reLaunch({ url: props.fallbackUrl });'
|
|
)) {
|
|
if (-not $header.Contains($token)) { throw "PageHeader back contract missing: $token" }
|
|
}
|
|
|
|
$dialog = Read-Utf8 'components/AppDialog.vue'
|
|
foreach ($token in @('role="dialog"', 'aria-modal="true"', 'tabindex="-1"', '@keydown.esc.stop="cancel"', 'max-height: calc(var(--app-viewport-height, 100vh) - 80rpx - env(safe-area-inset-top) - env(safe-area-inset-bottom))', '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" }
|
|
}
|
|
|
|
$tabbar = Read-Utf8 'components/AppTabbar.vue'
|
|
foreach ($token in @('role="tablist"', 'role="tab"', ':aria-selected="active === item.key"', 'hover-class="tab-item--pressed"')) {
|
|
if (-not $tabbar.Contains($token)) { throw "AppTabbar interaction contract missing: $token" }
|
|
}
|
|
|
|
$card = Read-Utf8 'components/GenealogyCard.vue'
|
|
foreach ($token in @('role="button"', ':aria-label="accessibleLabel"', 'hover-class="genealogy-card--pressed"', 'const accessibleLabel = computed(')) {
|
|
if (-not $card.Contains($token)) { throw "GenealogyCard interaction contract missing: $token" }
|
|
}
|
|
|
|
Write-Output 'SHARED-INTERACTION-ACCESSIBILITY-CONTRACT PASS'
|