59 lines
1.8 KiB
PowerShell
59 lines
1.8 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
|
|
function Read-Utf8([string]$Path) {
|
|
[System.IO.File]::ReadAllText(
|
|
(Join-Path (Join-Path $PSScriptRoot '..') $Path),
|
|
[System.Text.Encoding]::UTF8
|
|
)
|
|
}
|
|
|
|
function Assert-Contains {
|
|
param([string]$Content, [string]$Expected, [string]$Message)
|
|
if (-not $Content.Contains($Expected)) { throw $Message }
|
|
}
|
|
|
|
$page = Read-Utf8 'pages/family/f06-article-editor.vue'
|
|
$catalog = Read-Utf8 'data/page-catalog.js'
|
|
|
|
foreach ($expected in @(
|
|
'class="article-editor-page"',
|
|
'article-editor-state--${editorState}',
|
|
'<textarea',
|
|
'v-model="form.title"',
|
|
'v-model="form.category"',
|
|
'v-model="form.content"',
|
|
'fieldErrors.title',
|
|
'fieldErrors.category',
|
|
'fieldErrors.content',
|
|
'const editorState = ref("form");',
|
|
'const allowedStates = new Set([',
|
|
'"draft"',
|
|
'"loading"',
|
|
'"validation"',
|
|
'"saving"',
|
|
'"error"',
|
|
'"success"',
|
|
'if (editorState.value === "saving") return;',
|
|
'editorState.value = "saving";',
|
|
'? "error" : "success"',
|
|
':disabled="editorState === ''saving''"',
|
|
'onUnload(() => {',
|
|
'ModulePageBackground',
|
|
'AppLoading',
|
|
'AppButton',
|
|
'border-image-source: url("/static/assets/modules/family/transparent/module-content-frame.png");',
|
|
'border-image-slice: 72 fill;',
|
|
'border-image-width: 64rpx;',
|
|
'border-image-repeat: stretch;'
|
|
)) {
|
|
Assert-Contains $page $expected "F06 dedicated 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"')) {
|
|
if ($page.Contains($forbidden)) { throw "F06 retains forbidden dependency: $forbidden" }
|
|
}
|
|
|
|
if ($catalog -match '(?m)^\s*f06\s*:') { throw 'F06 obsolete page-catalog owner must be removed' }
|
|
|
|
Write-Output 'F06-ARTICLE-EDITOR-CONTRACT PASS'
|