Files
jiapuapp/tests/fixed-navigation-position-contract.ps1
T

14 lines
1.4 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$root = Split-Path $PSScriptRoot -Parent
$header = [System.IO.File]::ReadAllText((Join-Path $root 'components/PageHeader.vue'), [System.Text.Encoding]::UTF8)
$tabbar = [System.IO.File]::ReadAllText((Join-Path $root 'components/AppTabbar.vue'), [System.Text.Encoding]::UTF8)
$global = [System.IO.File]::ReadAllText((Join-Path $root 'styles/global.scss'), [System.Text.Encoding]::UTF8)
if ($header -notmatch 'class="page-header-slot"') { throw 'PageHeader must reserve normal-flow space for the fixed header' }
if ($header -notmatch '(?s)\.page-header\s*\{[^}]*position\s*:\s*fixed\s*;[^}]*top\s*:\s*0\s*;[^}]*right\s*:\s*0\s*;[^}]*left\s*:\s*0\s*;') { throw 'PageHeader must be fixed to the top viewport edge' }
if ($header -notmatch '(?s)\.page-header\s*\{[^}]*transform\s*:\s*translateZ\(0\)\s*;') { throw 'PageHeader must own a stable compositor layer above native media while scrolling' }
if ($global -notmatch '(?s)view:not\(\.page-header-slot\):has\(> \.page-header-slot\)\s*\{[^}]*position\s*:\s*relative\s*;[^}]*z-index\s*:\s*31\s*;') { throw 'Every direct PageHeader host must outrank later page content stacking contexts' }
if ($tabbar -notmatch '(?s)\.app-tabbar\s*\{[^}]*position\s*:\s*fixed\s*;[^}]*right\s*:\s*0\s*;[^}]*bottom\s*:\s*0\s*;[^}]*left\s*:\s*0\s*;') { throw 'AppTabbar must remain fixed to the bottom viewport edge' }
Write-Output 'FIXED-NAVIGATION-POSITION-CONTRACT PASS'