60%
This commit is contained in:
@@ -1,61 +1,45 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
function Read-Utf8([string]$Path) {
|
||||
[System.IO.File]::ReadAllText(
|
||||
(Join-Path (Join-Path $PSScriptRoot '..') $Path),
|
||||
[System.Text.Encoding]::UTF8
|
||||
)
|
||||
}
|
||||
$root = Split-Path -Parent $PSScriptRoot
|
||||
$page = Get-Content -LiteralPath (Join-Path $root 'pages/family/f06-article-editor.vue') -Raw -Encoding UTF8
|
||||
|
||||
function Assert-Contains {
|
||||
param([string]$Content, [string]$Expected, [string]$Message)
|
||||
if (-not $Content.Contains($Expected)) { throw $Message }
|
||||
function Assert-Contains([string]$expected, [string]$message) {
|
||||
if (-not $page.Contains($expected)) { throw $message }
|
||||
}
|
||||
|
||||
$page = Read-Utf8 'pages/family/f06-article-editor.vue'
|
||||
|
||||
foreach ($expected in @(
|
||||
'class="article-editor-page"',
|
||||
'article-editor-state--${editorState}',
|
||||
'<textarea',
|
||||
'v-model="form.title"',
|
||||
'v-model="form.category"',
|
||||
'v-model="form.content"',
|
||||
'auto-height',
|
||||
'fieldErrors.title',
|
||||
'fieldErrors.category',
|
||||
'fieldErrors.content',
|
||||
'const editorState = ref("form");',
|
||||
'const allowedStates = new Set([',
|
||||
'"draft"',
|
||||
'"loading"',
|
||||
'"validation"',
|
||||
'"error"',
|
||||
'"preview"',
|
||||
'const isSubmitting = ref(false);',
|
||||
'if (isSubmitting.value || !hasValidContext.value) return;',
|
||||
'isSubmitting.value = true;',
|
||||
'editorState.value = submitSnapshot ? "preview" : "error";',
|
||||
':disabled="isSubmitting"',
|
||||
'findFamilyArticleFixture',
|
||||
'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',
|
||||
'onUnload(() => {',
|
||||
'onUnmounted(() =>',
|
||||
'ModulePageBackground',
|
||||
'AppLoading',
|
||||
'AppDialog',
|
||||
'AppButton',
|
||||
'@include adaptive.adaptive-family-panel;',
|
||||
'@include adaptive.adaptive-family-field;'
|
||||
)) {
|
||||
Assert-Contains $page $expected "F06 dedicated editor contract missing: $expected"
|
||||
Assert-Contains $expected "F06 article editor contract missing: $expected"
|
||||
}
|
||||
|
||||
foreach ($forbidden in @('<template><ModulePage', 'import ModulePage from', 'page-id="f06"', '@/utils/api.js', 'uni.showToast', 'uni.showModal', 'class="editor-panel__skin"', '"saving"', '"success"', 'finishPage(')) {
|
||||
if ($page.Contains($forbidden)) { throw "F06 retains forbidden dependency: $forbidden" }
|
||||
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'
|
||||
|
||||
Reference in New Issue
Block a user