Files
jiapuapp/tests/f06-article-editor-contract.ps1
T
2026-07-24 18:03:14 +08:00

46 lines
1.5 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$page = Get-Content -LiteralPath (Join-Path $root 'pages/family/f06-article-editor.vue') -Raw -Encoding UTF8
function Assert-Contains([string]$expected, [string]$message) {
if (-not $page.Contains($expected)) { throw $message }
}
foreach ($expected in @(
'class="article-editor-page"',
'article-editor-state--${editorState}',
'appApi.createArticle(',
'v-model="form.articleTitle"',
'v-model="form.articleSummary"',
'v-model="form.articleContent"',
'v-model="form.authorName"',
'v-model="form.sortOrder"',
'pickAndUploadImage',
'toConsumerOssId',
'coverOssId: coverOssId.value',
'class="required-mark"',
'editor-control--unavailable',
'createDiscardConfirmation',
'runBackGuard',
'onUnmounted(() =>',
'ModulePageBackground',
'AppDialog',
'AppButton',
'@include adaptive.adaptive-family-panel;',
'@include adaptive.adaptive-family-field;'
)) {
Assert-Contains $expected "F06 article editor contract missing: $expected"
}
if ($page -match 'v-model="form\.(categoryId|status)"') {
throw 'F06 must not ask users to enter category or status codes'
}
if ($page -match 'placeholder="[^"]*(分类 ID|状态码|例如:0)') {
throw 'F06 must not expose raw category or status code inputs'
}
if ($page -match 'border-image-slice\s*:') { throw 'F06 must consume border-image geometry from the adaptive profile owner' }
if ($page -match 'position\s*:') { throw 'F06 must keep editor content in document flow' }
Write-Output 'F06-ARTICLE-EDITOR-CONTRACT PASS'