Files
amare/tests/Feature/PublicSite/AccessibilityStructureTest.php
Manoel Freitas cf1589c916 feat: recreate public frontend with Heritage Editorial identity (#5)
* feat: recreate public frontend with Heritage Editorial identity

Replace placeholder visual system with EB Garamond/olive tokens, brand assets, editorial home narrative, São Paulo settings, real testimonials, and regenerated visual baselines.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: archive recreate-public-frontend and sync Heritage Editorial specs

Merge delta requirements into main OpenSpec capabilities and move the completed change into the dated archive.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 23:39:00 -03:00

105 lines
3.6 KiB
PHP

<?php
declare(strict_types=1);
namespace Tests\Feature\PublicSite;
use App\Models\PortfolioCase;
use App\Models\PortfolioImage;
use App\Models\SiteSetting;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Storage;
use Tests\TestCase;
class AccessibilityStructureTest extends TestCase
{
use RefreshDatabase;
public function test_public_pages_have_single_h1_and_landmarks(): void
{
Storage::fake('public');
SiteSetting::instance();
$case = PortfolioCase::factory()->published()->create([
'slug' => 'casamento-jardim',
'title' => 'Casamento Jardim',
'cover_image_path' => 'cases/cover.jpg',
'cover_image_alt' => 'Capa do casamento',
]);
$routes = [
route('home'),
route('services.index'),
route('portfolio.index'),
route('portfolio.show', $case->slug),
route('about'),
route('privacy'),
route('contact'),
];
foreach ($routes as $url) {
$html = $this->get($url)->assertOk()->getContent();
$this->assertSame(1, preg_match_all('/<h1\b/i', $html), "Expected one h1 on {$url}");
$this->assertMatchesRegularExpression('/<header\b/i', $html);
$this->assertMatchesRegularExpression('/<nav\b/i', $html);
$this->assertMatchesRegularExpression('/<main\b/i', $html);
$this->assertMatchesRegularExpression('/<footer\b/i', $html);
$this->assertStringContainsString('href="#conteudo"', $html);
$this->assertStringContainsString('Ir para o conteúdo', $html);
}
}
public function test_header_exposes_brand_mark_and_mobile_menu_toggle(): void
{
SiteSetting::instance()->update([
'brand_name' => 'Amare Assessoria',
]);
$html = $this->get(route('home'))->assertOk()->getContent();
$this->assertStringContainsString('class="brand-logo', $html);
$this->assertMatchesRegularExpression('/alt="[^"]*Amare[^"]*"/i', $html);
$this->assertStringContainsString('id="main-nav"', $html);
$this->assertStringContainsString('aria-controls="main-nav"', $html);
$this->assertStringContainsString('aria-expanded="false"', $html);
$this->assertStringContainsString('data-menu-button', $html);
$this->assertStringContainsString('Abrir menu', $html);
}
public function test_content_images_expose_alt_text(): void
{
Storage::fake('public');
SiteSetting::instance();
$case = PortfolioCase::factory()->published()->create([
'slug' => 'casamento-jardim',
'title' => 'Casamento Jardim',
'cover_image_path' => 'cases/cover.jpg',
'cover_image_alt' => 'Capa do casamento',
]);
PortfolioImage::query()->create([
'portfolio_case_id' => $case->id,
'path' => 'content/gallery-a.jpg',
'alt_text' => 'Galeria A',
'caption' => null,
'sort_order' => 1,
]);
$this->get(route('portfolio.show', $case->slug))
->assertOk()
->assertSee('alt="Capa do casamento"', false)
->assertSee('alt="Galeria A"', false);
}
public function test_interactive_elements_have_visible_focus_styles(): void
{
$css = file_get_contents(resource_path('css/app.css'));
$this->assertIsString($css);
$this->assertStringContainsString(':focus-visible', $css);
$this->assertStringContainsString('outline', $css);
}
}