2026-08-24 19:10:22 +08:00
|
|
|
$ErrorActionPreference = 'Stop'
|
2026-09-08 14:05:30 +08:00
|
|
|
$html = Get-Content -Raw -LiteralPath (Join-Path $PSScriptRoot '..\assets\app.js')
|
2026-08-24 19:10:22 +08:00
|
|
|
|
|
|
|
|
$required = @(
|
|
|
|
|
'selectedRelabelId:null',
|
|
|
|
|
'relabelPhotos:{}',
|
|
|
|
|
"state.page='relabel-photo'",
|
|
|
|
|
'function relabelPhotoView()',
|
|
|
|
|
'function openRelabelPhoto(planId)',
|
|
|
|
|
'function handleRelabelPhoto(input)',
|
|
|
|
|
'function submitRelabelPhoto()',
|
|
|
|
|
'capture="environment"',
|
|
|
|
|
"state.page='relabel'"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
$missing = $required | Where-Object { -not $html.Contains($_) }
|
|
|
|
|
if ($missing) { throw "Missing relabel photo page contract: $($missing -join ', ')" }
|
|
|
|
|
|
|
|
|
|
$relabelView = [regex]::Match($html, '(?s)function relabelView\(\).*?(?=function openRelabelPhoto)').Value
|
|
|
|
|
if (-not $relabelView.Contains("onclick=`"openRelabelPhoto('")) { throw 'Relabel list does not open the photo page' }
|
|
|
|
|
if ($relabelView.Contains('capture="environment"')) { throw 'Relabel list still contains an inline camera input' }
|
|
|
|
|
|
|
|
|
|
$photoView = [regex]::Match($html, '(?s)function relabelPhotoView\(\).*?(?=function handleRelabelPhoto)').Value
|
|
|
|
|
if (-not $photoView.Contains("!photo?'disabled':''")) { throw 'Photo submit button is not gated by a captured photo' }
|
|
|
|
|
if (-not $photoView.Contains("'relabel'")) { throw 'Photo page does not return to the relabel list' }
|
|
|
|
|
|
|
|
|
|
Write-Output 'PASS: relabel photo page source contract'
|