Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m45s
- Baustein "Ausflugstipps" (tips): Karten mit Foto vorne, Tipp/Weg/beste Zeit hinten; Seebad als Ansichtskarten - Baustein "Sommer/Winter-Vergleich" (compare): Trennlinie ziehen, Tastatur ueber Range-Input, einmaliger Hinweis-Schwenk - Lightbox: Foto waechst aus der Vorschau, Blaettern (Pfeile, Tasten, Wischen), Zaehler, Bildunterschrift; partials/lightbox - Bewegung reduzieren: Ueberblenden statt Drehen, kein Schwenk, keine Zoom-Animation Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
105 lines
4.3 KiB
PHP
105 lines
4.3 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\Appearance;
|
|
use App\Models\Photo;
|
|
use App\Models\Site;
|
|
use Carbon\CarbonImmutable;
|
|
use Database\Seeders\PropertySeeder;
|
|
use Database\Seeders\SiteSeeder;
|
|
use Database\Seeders\WebsiteContentSeeder;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Http\UploadedFile;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use Tests\TestCase;
|
|
|
|
class DesignElementsTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
Storage::fake('public');
|
|
$this->travelTo(CarbonImmutable::parse('2026-10-22 10:00'));
|
|
$this->seed([PropertySeeder::class, WebsiteContentSeeder::class, SiteSeeder::class]);
|
|
$this->withoutVite();
|
|
}
|
|
|
|
public function test_tip_cards_show_photo_and_name_in_front_and_the_tip_on_the_back(): void
|
|
{
|
|
$photo = $this->photoWithImage('Buchen im Gespensterwald');
|
|
$this->addSection(['type' => 'tips', 'data' => [
|
|
'heading' => 'Unsere Tipps',
|
|
'signature' => 'Brigitte',
|
|
'tips' => [
|
|
['title' => 'Gespensterwald', 'photo_id' => $photo->id, 'tip' => 'Am späten Nachmittag, wenn die Sonne durch die Buchen fällt.', 'way' => '25 Minuten mit dem Rad', 'best_time' => 'Später Nachmittag'],
|
|
['title' => 'Molli', 'photo_id' => null, 'tip' => 'Einmal bis Bad Doberan und zurück.', 'way' => null, 'best_time' => null],
|
|
['title' => 'Ohne Tipp', 'tip' => ''],
|
|
],
|
|
]]);
|
|
|
|
$this->get('/')
|
|
->assertOk()
|
|
->assertSee('data-flip-face="back"', false)
|
|
->assertSeeInOrder(['Gespensterwald', 'Buchen im Gespensterwald', 'Tipp lesen', 'Am späten Nachmittag', 'Brigitte', '25 Minuten mit dem Rad', 'Später Nachmittag', 'Molli', 'Einmal bis Bad Doberan'])
|
|
->assertDontSee('Ohne Tipp');
|
|
}
|
|
|
|
public function test_season_comparison_shows_both_photos_whatever_the_appearance_and_needs_both(): void
|
|
{
|
|
$summer = $this->photoWithImage('Terrasse im Sommer');
|
|
$winter = $this->photoWithImage('Terrasse im Schnee');
|
|
$winter->update(['appearance_ids' => [Appearance::factory()->create(['site_id' => Site::sole()->id, 'name' => 'Winter', 'is_active' => false])->id]]);
|
|
$this->addSection(['type' => 'compare', 'data' => [
|
|
'heading' => 'Derselbe Blick',
|
|
'first_photo_id' => $summer->id, 'first_label' => 'Sommer',
|
|
'second_photo_id' => $winter->id, 'second_label' => 'Winter',
|
|
]]);
|
|
|
|
$this->get('/')
|
|
->assertOk()
|
|
->assertSee('data-compare-range', false)
|
|
->assertSee('alt="Terrasse im Sommer"', false)
|
|
->assertSee('alt="Terrasse im Schnee"', false)
|
|
->assertSee('Trennlinie zwischen Sommer und Winter verschieben');
|
|
|
|
$winter->update(['is_published' => false]);
|
|
|
|
$this->get('/')->assertOk()->assertDontSee('data-compare-range', false)->assertDontSee('Derselbe Blick');
|
|
}
|
|
|
|
public function test_gallery_photos_open_in_the_lightbox_with_caption_and_browsing(): void
|
|
{
|
|
$photo = $this->photoWithImage('Wohnzimmer mit Ledersofa');
|
|
$photo->update(['caption' => 'Abends am Kamin']);
|
|
$page = Site::sole()->pages()->where('slug', 'wohnung')->sole();
|
|
$page->update(['sections' => [['type' => 'gallery', 'data' => ['heading' => 'Bilder', 'photo_source' => 'selection', 'photo_ids' => [$photo->id]]]]]);
|
|
|
|
$this->get('/wohnung')
|
|
->assertOk()
|
|
->assertSee('data-lightbox data-alt="Wohnzimmer mit Ledersofa" data-caption="Abends am Kamin"', false)
|
|
->assertSee('id="lightbox"', false)
|
|
->assertSee('aria-label="Nächstes Foto"', false);
|
|
}
|
|
|
|
private function photoWithImage(string $alt): Photo
|
|
{
|
|
$photo = Photo::factory()->create(['alt_text' => $alt]);
|
|
$photo->addMedia(UploadedFile::fake()->image('foto.jpg', 1200, 800))->toMediaCollection(Photo::COLLECTION);
|
|
|
|
return $photo->fresh();
|
|
}
|
|
|
|
/**
|
|
* @param array{type: string, data: array<string, mixed>} $section
|
|
*/
|
|
private function addSection(array $section): void
|
|
{
|
|
$page = Site::sole()->pages()->where('slug', 'start')->sole();
|
|
$page->update(['sections' => [...$page->sections, $section]]);
|
|
}
|
|
}
|