Files
docs/悦/PDA(海外)/tests/pallet-photo-button-position.test.ps1
2026-09-08 14:05:30 +08:00

12 lines
778 B
PowerShell

$ErrorActionPreference = 'Stop'
$html = Get-Content -Raw -Encoding UTF8 -LiteralPath (Join-Path $PSScriptRoot '..\assets\app.js')
$buttonAt = $html.LastIndexOf('class="photo-add-tile photo-add-action"')
if ($buttonAt -lt 0) { throw 'Pallet photo add action class is missing' }
$buttonMarkup = $html.Substring($buttonAt, [Math]::Min(360, $html.Length - $buttonAt))
if (-not $buttonMarkup.Contains('margin:0;')) { throw 'Pallet photo add action is not left aligned' }
$detailView = [regex]::Match($html, '(?s)function consolidationDetailView\(\).*?(?=const basePalletView=)').Value
if (-not $detailView.Contains('const emptyPhotoMarkup')) { throw 'Consolidation empty photo state still reserves a separate empty row' }
Write-Output 'PASS: pallet photo button position contract'