Story 2.3: page accueil hero

This commit is contained in:
2026-02-04 16:58:07 +01:00
parent 8dd68ef584
commit a1092c9f60
10 changed files with 137 additions and 87 deletions

View File

@@ -10,9 +10,17 @@ function Assert-True {
Assert-True (Test-Path 'index.php') 'Missing index.php'
$index = Get-Content -Raw 'index.php'
Assert-True ($index -match 'Portfolio') 'index.php missing Portfolio text'
Assert-True ($index -match 'text-primary') 'index.php missing text-primary class'
Assert-True ($index -match 'badge') 'index.php missing badge class'
Assert-True ($index -match 'btn-primary') 'index.php missing btn-primary class'
if ($index -match 'pages/home.php') {
Assert-True (Test-Path 'pages/home.php') 'Missing pages/home.php'
$homeContent = Get-Content -Raw 'pages/home.php'
Assert-True ($homeContent -match 'Portfolio') 'home.php missing Portfolio text'
Assert-True ($homeContent -match 'text-primary') 'home.php missing text-primary class'
Assert-True ($homeContent -match 'btn-primary') 'home.php missing btn-primary class'
} else {
Assert-True ($index -match 'Portfolio') 'index.php missing Portfolio text'
Assert-True ($index -match 'text-primary') 'index.php missing text-primary class'
Assert-True ($index -match 'badge') 'index.php missing badge class'
Assert-True ($index -match 'btn-primary') 'index.php missing btn-primary class'
}
'OK'
'OK'

22
tests/home.test.ps1 Normal file
View File

@@ -0,0 +1,22 @@
$ErrorActionPreference = 'Stop'
function Assert-True {
param(
[bool]$Condition,
[string]$Message
)
if (-not $Condition) { throw $Message }
}
Assert-True (Test-Path 'pages/home.php') 'Missing pages/home.php'
$homeContent = Get-Content -Raw 'pages/home.php'
Assert-True ($homeContent -match 'Découvrir mes projets') 'Home missing CTA projects'
Assert-True ($homeContent -match 'En savoir plus') 'Home missing CTA about'
Assert-True ($homeContent -match 'animate-fade-in') 'Home missing animations'
Assert-True ($homeContent -match 'include_template\(\x27navbar\x27') 'Home missing navbar include'
Assert-True (Test-Path 'index.php') 'Missing index.php'
$index = Get-Content -Raw 'index.php'
Assert-True ($index -match 'pages/home.php') 'index.php missing home include'
'OK'

View File

@@ -20,6 +20,10 @@ Assert-True ($js -match 'initNavbarScroll') 'Missing initNavbarScroll'
Assert-True (Test-Path 'index.php') 'Missing index.php'
$index = Get-Content -Raw 'index.php'
Assert-True ($index -match "include_template\('navbar'") 'index.php missing navbar include'
if (-not ($index -match "include_template\('navbar'")) {
Assert-True (Test-Path 'pages/home.php') 'Missing pages/home.php for navbar include'
$homeContent = Get-Content -Raw 'pages/home.php'
Assert-True ($homeContent -match "include_template\('navbar'") 'pages/home.php missing navbar include'
}
'OK'
'OK'

View File

@@ -6,4 +6,5 @@ $here = Split-Path -Parent $MyInvocation.MyCommand.Path
& (Join-Path $here 'canary.test.ps1')
& (Join-Path $here 'navbar.test.ps1')
& (Join-Path $here 'cta.test.ps1')
& (Join-Path $here 'home.test.ps1')
'OK'

View File

@@ -31,7 +31,9 @@ Assert-True (Test-Path 'logs/.gitkeep') 'Missing logs/.gitkeep'
Assert-True (Test-Path 'index.php') 'Missing index.php'
$index = Get-Content -Raw 'index.php'
if (-not ($index -match 'Hello World')) {
Assert-True ($index -match 'Portfolio') 'index.php missing expected content'
if (-not ($index -match 'Portfolio')) {
Assert-True ($index -match 'pages/home.php') 'index.php missing expected content'
}
}
if (-not ($index -match 'meta name="viewport"')) {
Assert-True (Test-Path 'templates/header.php') 'Missing templates/header.php for viewport meta'

View File

@@ -26,8 +26,12 @@ Assert-True ($footer -match '</body>') 'Footer missing closing body'
Assert-True (Test-Path 'index.php') 'Missing index.php'
$index = Get-Content -Raw 'index.php'
Assert-True ($index -match 'include_template\(') 'index.php missing include_template usage'
if (-not ($index -match 'include_template\(')) {
Assert-True (Test-Path 'pages/home.php') 'Missing pages/home.php for templates usage'
$homeContent = Get-Content -Raw 'pages/home.php'
Assert-True ($homeContent -match 'include_template\(') 'pages/home.php missing include_template usage'
}
Assert-True (Test-Path 'assets/js/main.js') 'Missing assets/js/main.js'
'OK'
'OK'