Files
jiapuapp/tests/t07-module-baseline-contract.ps1
T
2026-07-20 06:52:33 +08:00

34 lines
2.6 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$page = Get-Content -LiteralPath (Join-Path $root 'pages/tree/t07-member-directory.vue') -Raw -Encoding utf8
function Assert-Match([string]$Pattern, [string]$Message) {
if ($page -notmatch $Pattern) { throw $Message }
}
Assert-Match 'class="directory-context"' 'T07 must show the current genealogy context.'
Assert-Match '\u6c64\u6c0f\u5bb6\u8c31' 'T07 baseline must identify the current genealogy in the H5 mock state.'
Assert-Match '''directory-state--loading'': directoryState === ''loading''' 'T07 loading state must have an explicit root class.'
Assert-Match 'v-if="directoryState === ''list'' \|\| directoryState === ''empty''"' 'T07 search must remain available for list and empty states only.'
Assert-Match 'class="directory-search__action"[^>]*role="button"[^>]*aria-label="\u67e5\u627e\u6210\u5458"' 'T07 search action must expose button semantics and an accessible label.'
Assert-Match '<AppButton\s+v-if="directoryState === ''error''"[^>]+type="secondary"[^>]+label="\u91cd\u65b0\u67e5\u770b"[^>]+@click="retryDirectory"' 'T07 error state must provide a custom recovery action.'
Assert-Match 'const retryDirectory = \(\) => \{ directoryState\.value = ''list'' \}' 'T07 retry action must return to the list state.'
Assert-Match '(?s)\.directory-page\s*\{[^}]*overflow-x:\s*hidden;[^}]*overflow-y:\s*auto;' 'T07 must allow natural vertical scrolling without horizontal overflow.'
Assert-Match '(?s)\.directory-search\s*\{[^}]*height:\s*44px;' 'T07 search field must preserve a 44 CSS px touch height at every viewport.'
Assert-Match '(?s)\.directory-search__action\s*\{[^}]*min-width:\s*88rpx;[^}]*min-height:\s*44px;' 'T07 search action must preserve a 44 CSS px touch target.'
Assert-Match 'modules/tree/transparent/t07-search-input-frame\.png' 'T07 search must use its dedicated transparent input frame.'
Assert-Match 'modules/genealogy/transparent/list-slip-frame\.png' 'T07 member cards must use the approved transparent list frame.'
if ($page -match 'g06-search-input-wide\.png|application-status-card\.png') {
throw 'T07 must not reuse opaque search or application-status skins.'
}
if ($page -match 'row-seal-frame\.png|directory-card__seal') {
throw 'T07 member cards must not repeat generation information in decorative seals.'
}
Assert-Match 'class="directory-card__status"' 'T07 member identity or profile state must use a dedicated status label.'
foreach ($state in @('loading', 'list', 'empty', 'error')) {
Assert-Match $state "T07 must preserve the $state state."
}
Write-Output 'T07-MODULE-BASELINE-CONTRACT PASS'