b2in/tests/Feature/LayoutScriptOrderTest.php
Kevin Adametz 6c6d683b9a Display CMS Optimierungen 29-05-2026
- Mediathek: Video-Vorschaubilder statt Icons (FFmpeg-Thumbnails + Backfill-Command), Kategorie "Sonstiges"
- B2in Media-Picker zeigt alle Medientypen, Typ wird automatisch erkannt; Thumbnail-Preview vor allen Medien-URL-Feldern
- B2in Marke/Footer: Footer ein/aus, Logo+Claim frei positionierbar (Ecken) mit Constraints, separate Anzeige-Schalter
- Angebote-Modul dynamisch: kein Slide-Typ mehr, einheitliches Detail-Layout mit ein-/ausblendbaren Bloecken, Logo/Brand pro Slide, Streichpreis-Option
- Player: leere Module stoppen Endlosschleife, dynamische Layout-Anpassung bei verstecktem Footer/Header
- Fix: Script-Ladereihenfolge (Livewire vor Flux), entfernte stale public/flux/flux.js, Modal-Crash beim Aktualisieren behoben

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-29 15:57:33 +00:00

41 lines
1.4 KiB
PHP

<?php
use App\Models\User;
use Illuminate\Support\Facades\URL;
beforeEach(function () {
URL::forceRootUrl('https://'.config('domains.domain_portal'));
});
test('admin layout loads livewire before flux so flux can register its alpine components', function () {
$user = User::factory()->create();
$content = $this->actingAs($user)
->get(route('admin.cms.display-modules'))
->assertSuccessful()
->getContent();
$livewirePosition = strpos($content, 'livewire.js?id=');
$fluxPosition = strpos($content, '/flux/flux');
expect($livewirePosition)->not->toBeFalse('Livewire script tag is missing from the layout.');
expect($fluxPosition)->not->toBeFalse('Flux script tag is missing from the layout.');
expect($livewirePosition)->toBeLessThan(
$fluxPosition,
'Livewire must be loaded before Flux; otherwise window.Alpine is undefined when flux.js registers fluxModal/fluxSelectSearchClearable.'
);
});
test('admin layout loads the livewire script only once', function () {
$user = User::factory()->create();
$content = $this->actingAs($user)
->get(route('admin.cms.display-modules'))
->assertSuccessful()
->getContent();
expect(substr_count($content, 'livewire.js?id='))->toBe(
1,
'Livewire must only be injected once; a duplicate script tag creates multiple Alpine instances.'
);
});