7879ac7190
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
64 lines
2.7 KiB
PHP
64 lines
2.7 KiB
PHP
<?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);
|
|
}
|
|
}
|
|
});
|