put('content/heroes/home.jpg', 'home image'); $settings = SiteSetting::instance(); $settings->update([ 'hero_image_path' => 'content/heroes/home.jpg', 'hero_image_alt' => 'Mesa preparada para uma celebração', 'default_og_image_path' => 'content/og/social.jpg', 'default_og_image_alt' => 'Imagem exclusiva das redes sociais', ]); $response = $this->get(route('home')); $response ->assertOk() ->assertSee('data-chapter="hero"', false) ->assertSee('data-motion="page-open"', false) ->assertSee('data-photo-hero', false) ->assertSee('min-h-[calc(100dvh-5rem)]', false) ->assertSee('data-hero-content', false) ->assertSee('data-split-hero', false) ->assertSee('data-motion-beat="media"', false) ->assertSee('lg:grid-cols-12', false) ->assertSee('content/heroes/home.jpg', false) ->assertSee('loading="eager"', false) ->assertSee('fetchpriority="high"', false) ->assertSee('sizes="(max-width: 1023px) 100vw, 58vw"', false) ->assertDontSee('data-tonal-hero', false) ->assertSee('content="http://localhost/storage/content/og/social.jpg"', false); } public function test_public_openings_fall_back_to_tonal_layout_when_no_image_is_configured(): void { $settings = SiteSetting::instance(); $settings->update([ 'hero_image_path' => null, 'hero_image_alt' => null, 'services_hero_image_path' => null, 'services_hero_image_alt' => null, 'portfolio_hero_image_path' => null, 'portfolio_hero_image_alt' => null, 'about_image_path' => null, 'about_image_alt' => null, ]); $case = PortfolioCase::factory()->published()->create(['cover_image_path' => '', 'cover_image_alt' => '']); foreach ([route('home'), route('services.index'), route('portfolio.index'), route('portfolio.show', $case->slug), route('about')] as $route) { $response = $this->get($route) ->assertOk() ->assertSee('data-tonal-hero', false); if ($route === route('home')) { $response ->assertSee('data-motion="page-open"', false) ->assertSee('id="hero-heading"', false) ->assertSee('data-testid="home-primary-cta"', false) ->assertDontSee('data-photo-hero', false) ->assertDontSee('data-split-hero', false) ->assertDontSee('content/heroes/home.jpg', false); } } } public function test_configured_route_and_case_images_render_as_immersive_heroes(): void { $settings = SiteSetting::instance(); $settings->update([ 'services_hero_image_path' => 'content/heroes/services.jpg', 'services_hero_image_alt' => 'Detalhe de uma mesa corporativa', 'portfolio_hero_image_path' => 'content/heroes/portfolio.jpg', 'portfolio_hero_image_alt' => 'Ambiente de celebração ao entardecer', 'about_image_path' => 'content/heroes/about.jpg', 'about_image_alt' => 'Caderno e flores no estúdio da Amare', ]); $case = PortfolioCase::factory()->published()->create([ 'cover_image_path' => 'content/cases/capa.jpg', 'cover_image_alt' => 'Cerimônia ao ar livre', ]); foreach ([route('services.index'), route('portfolio.index'), route('portfolio.show', $case->slug), route('about')] as $route) { $this->get($route) ->assertOk() ->assertSee('data-photo-hero', false) ->assertSee('loading="eager"', false) ->assertSee('fetchpriority="high"', false) ->assertSee('sizes="(max-width: 1023px) 100vw, 58vw"', false); } } public function test_hero_upload_requires_alt_text_only_when_an_image_is_uploaded(): void { Storage::fake('public'); $this->actingAs(User::factory()->admin()->create()); Livewire::test(ManageSiteSettings::class) ->set('data.hero_image_path', [UploadedFile::fake()->create('hero.jpg', 100, 'image/jpeg')]) ->set('data.hero_image_alt', null) ->call('save') ->assertHasFormErrors(['hero_image_alt' => 'required']); Livewire::test(ManageSiteSettings::class) ->set('data.hero_image_path', null) ->set('data.hero_image_alt', null) ->call('save') ->assertHasNoFormErrors(); } }