56 lines
2.9 KiB
PowerShell
56 lines
2.9 KiB
PowerShell
$projectRoot = Split-Path -Parent $PSScriptRoot
|
|
$mockupPath = Join-Path $projectRoot 'public\perspektivwerk\index.html'
|
|
$bookingScriptPath = Join-Path $projectRoot 'public\perspektivwerk\js\booking.js'
|
|
$bookingStylesPath = Join-Path $projectRoot 'public\perspektivwerk\js\booking.css'
|
|
$contaoBookingScriptPath = Join-Path $projectRoot 'public\booking\booking.js'
|
|
$contaoBookingStylesPath = Join-Path $projectRoot 'public\booking\booking.css'
|
|
$htaccessPath = Join-Path $projectRoot 'public\.htaccess'
|
|
|
|
Describe 'Perspektivwerk static route' {
|
|
It 'contains the static mockup entry point' {
|
|
(Test-Path -LiteralPath $mockupPath) | Should Be $true
|
|
}
|
|
|
|
It 'embeds the appointment booking component with its public assets' {
|
|
$mockup = Get-Content -LiteralPath $mockupPath -Raw
|
|
|
|
(Test-Path -LiteralPath $bookingScriptPath) | Should Be $true
|
|
(Test-Path -LiteralPath $bookingStylesPath) | Should Be $true
|
|
$mockup | Should Match 'href="js/booking\.css"'
|
|
$mockup | Should Match 'data-sufw-booking data-project="perspektivwerk"'
|
|
$mockup | Should Match 'data-sufw-booking data-project="produktionsschule"'
|
|
$mockup.IndexOf('data-project="perspektivwerk"') | Should BeLessThan $mockup.IndexOf('data-project="produktionsschule"')
|
|
$mockup | Should Match 'src="js/booking\.js"'
|
|
}
|
|
|
|
It 'keeps the Contao and static-preview asset copies identical' {
|
|
(Test-Path -LiteralPath $contaoBookingScriptPath) | Should Be $true
|
|
(Test-Path -LiteralPath $contaoBookingStylesPath) | Should Be $true
|
|
(Get-FileHash -LiteralPath $bookingScriptPath).Hash | Should Be (Get-FileHash -LiteralPath $contaoBookingScriptPath).Hash
|
|
(Get-FileHash -LiteralPath $bookingStylesPath).Hash | Should Be (Get-FileHash -LiteralPath $contaoBookingStylesPath).Hash
|
|
}
|
|
|
|
It 'keeps the enabled submit button visibly rendered' {
|
|
$script = Get-Content -LiteralPath $contaoBookingScriptPath -Raw
|
|
|
|
$script | Should Match "submitButton\.style\.visibility = 'visible'"
|
|
$script | Should Match "actions\.style\.position = 'sticky'"
|
|
}
|
|
|
|
It 'defines colours for the booking form action buttons' {
|
|
$styles = Get-Content -LiteralPath $contaoBookingStylesPath -Raw
|
|
|
|
$styles | Should Match '\.sufw-booking__form-actions button\s*\{[^}]*background-color:\s*#08752a'
|
|
$styles | Should Match '\.sufw-booking__form-actions button\s*\{[^}]*color:\s*#fff'
|
|
}
|
|
|
|
It 'routes /perspektivwerk to the static entry point before the Contao fallback' {
|
|
$htaccess = Get-Content -LiteralPath $htaccessPath -Raw
|
|
$staticRouteIndex = $htaccess.IndexOf('RewriteRule ^perspektivwerk/?$ perspektivwerk/index.html [L]')
|
|
$fallbackIndex = $htaccess.IndexOf('RewriteRule ^ %{ENV:BASE}/index.php [L]')
|
|
|
|
$staticRouteIndex | Should BeGreaterThan -1
|
|
$staticRouteIndex | Should BeLessThan $fallbackIndex
|
|
}
|
|
}
|