60 lines
1.7 KiB
PowerShell
60 lines
1.7 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/f08-album-detail.vue'
|
|
$catalog = Read-Utf8 'data/page-catalog.js'
|
|
|
|
foreach ($expected in @(
|
|
'class="album-detail-page"',
|
|
'album-state--${albumState}',
|
|
'class="album-hero-photo"',
|
|
'class="album-photo-grid"',
|
|
'class="album-preview"',
|
|
'class="album-upload-action"',
|
|
'const albumState = ref("normal");',
|
|
'const photos = [',
|
|
'const openPreview = (index) =>',
|
|
'const closePreview = () =>',
|
|
'const showUploadNotice = () =>',
|
|
'query.state === "empty"',
|
|
'query.state === "preview"',
|
|
'query.state === "expired"',
|
|
'class="album-empty-state"',
|
|
'class="album-expired-state"',
|
|
'class="album-preview__position"',
|
|
':message="uploadNoticeMessage"',
|
|
'f08-reunion-hero.png',
|
|
'f08-family-portrait.png',
|
|
'f08-reunion-table.png',
|
|
'f08-ancestral-home.png',
|
|
'f08-ancestral-portrait.png',
|
|
':alt="photo.alt"',
|
|
'ModulePageBackground',
|
|
'PageHeader',
|
|
'AppButton',
|
|
'AppToast'
|
|
)) {
|
|
Assert-Contains $page $expected "F08 contract missing: $expected"
|
|
}
|
|
|
|
foreach ($forbidden in @('<ModulePage page-id="f08"', 'import ModulePage from', 'uni.showToast', 'uni.showModal')) {
|
|
if ($page.Contains($forbidden)) { throw "F08 retains forbidden dependency: $forbidden" }
|
|
}
|
|
|
|
if ($catalog -match '(?m)^\s*f08\s*:') {
|
|
throw 'F08 obsolete page-catalog owner must be removed'
|
|
}
|
|
|
|
Write-Output 'F08-ALBUM-DETAIL-CONTRACT PASS'
|