24-7: about page — implemented, QA Review

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Naser Mansour
2026-10-31 18:52:36 +02:00
parent 7637294593
commit 7879ac7190
8 changed files with 177 additions and 265 deletions
@@ -0,0 +1,63 @@
<?php
function aboutHtml(string $locale): string
{
return test()->withSession(['locale' => $locale])->get('/about')->assertOk()->getContent();
}
test('about renders its sections in order with the existing content in both languages', function () {
foreach (['ar', 'en'] as $locale) {
$html = aboutHtml($locale);
app()->setLocale($locale);
$needles = [
__('about.title'), __('about.identity'), __('about.vision_title'), __('about.mission_institution_title'),
__('about.mission_society_title'), __('about.mission_diaspora_title'), __('about.values_title'), __('about.value_women'),
__('about.goals_title'), __('about.goals')[6], __('about.services_title'), __('about.service_business_items')[0],
__('site.about_cta_title'), __('about.services_cta'),
];
$last = -1;
foreach ($needles as $n) {
$pos = strpos($html, e($n), $last + 1);
$pos = $pos === false ? strpos($html, $n, $last + 1) : $pos;
expect($pos)->not->toBeFalse("missing or out of order [$locale]: $n");
$last = $pos;
}
expect(substr_count($html, 'class="sampler"'))->toBe(1);
expect(substr_count($html, 'class="val"'))->toBe(6);
expect(substr_count($html, 'row row-static'))->toBe(7);
}
});
test('about has one h1 and alt text on every image', function () {
$html = aboutHtml('ar');
expect(substr_count($html, '<h1'))->toBe(1);
preg_match_all('/<img\b[^>]*>/', $html, $m);
foreach ($m[0] as $img) {
expect($img)->toMatch('/\balt="[^"]+"/');
}
});
test('service rows link to booking and goal rows are static', function () {
$html = aboutHtml('en');
expect(substr_count($html, '<a class="row"'))->toBe(4);
expect(substr_count($html, 'href="'.route('booking').'"'))->toBeGreaterThanOrEqual(5);
expect(file_get_contents(resource_path('css/public.css')))
->toContain('body.site .row-static{grid-template-columns:90px 1fr}')
->toContain('body.site .row-static:hover{background:none;color:inherit;transform:none;box-shadow:none}')
->toContain('body.site .row-static::before{display:none}');
});
test('about page contains no scholarship content', function () {
expect(file_get_contents(resource_path('views/livewire/pages/about.blade.php')))->not->toContain('scholarship');
});
test('about site keys exist in both languages', function () {
foreach (['ar', 'en'] as $locale) {
$t = require base_path("lang/$locale/site.php");
foreach (['about_art_vision', 'about_art_values', 'about_art_goals', 'about_art_services', 'about_cta_title'] as $k) {
expect($t)->toHaveKey($k);
}
}
});