Display Module 13-05-2026
This commit is contained in:
parent
6a65354f4c
commit
9262132325
41 changed files with 496 additions and 334 deletions
|
|
@ -29,3 +29,10 @@ test('media picker zeigt ausgewähltes medium ohne livewire property fehler', fu
|
|||
->assertSee('test-image.jpg')
|
||||
->assertDontSee('Kein Medium ausgewählt');
|
||||
});
|
||||
|
||||
test('cms media picker und library uploader nutzen 200 mb dateigrenze', function () {
|
||||
expect(file_get_contents(app_path('Livewire/Admin/Cms/MediaPicker.php')))
|
||||
->toContain('max:204800')
|
||||
->and(file_get_contents(app_path('Livewire/Admin/Cms/MediaLibraryUploader.php')))
|
||||
->toContain('max:204800');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -79,9 +79,6 @@ test('can assign versions to a display', function () {
|
|||
->call('save');
|
||||
|
||||
$display->refresh();
|
||||
expect($display->versions)->toHaveCount(2);
|
||||
expect($display->versions->first()->id)->toBe($version1->id);
|
||||
expect($display->versions->last()->id)->toBe($version2->id);
|
||||
expect($display->livePlaylist->modules->pluck('id')->all())->toBe([$version1->id, $version2->id]);
|
||||
});
|
||||
|
||||
|
|
@ -100,8 +97,6 @@ test('can reorder versions in playlist', function () {
|
|||
->call('save');
|
||||
|
||||
$display->refresh();
|
||||
expect($display->versions->first()->id)->toBe($version2->id);
|
||||
expect($display->versions->last()->id)->toBe($version1->id);
|
||||
expect($display->livePlaylist->modules->pluck('id')->all())->toBe([$version2->id, $version1->id]);
|
||||
});
|
||||
|
||||
|
|
@ -110,10 +105,7 @@ test('can remove version from playlist', function () {
|
|||
$version1 = DisplayVersion::factory()->create();
|
||||
$version2 = DisplayVersion::factory()->create();
|
||||
$display = Display::factory()->create();
|
||||
$display->versions()->attach([
|
||||
$version1->id => ['sort_order' => 0],
|
||||
$version2->id => ['sort_order' => 1],
|
||||
]);
|
||||
createDisplayListPlaylist($display, DisplayPlaylist::STATUS_PUBLISHED, [$version1->id, $version2->id]);
|
||||
|
||||
Livewire::actingAs($user)
|
||||
->test(DisplayList::class)
|
||||
|
|
@ -122,8 +114,6 @@ test('can remove version from playlist', function () {
|
|||
->call('save');
|
||||
|
||||
$display->refresh();
|
||||
expect($display->versions)->toHaveCount(1);
|
||||
expect($display->versions->first()->id)->toBe($version2->id);
|
||||
expect($display->livePlaylist->modules->pluck('id')->all())->toBe([$version2->id]);
|
||||
});
|
||||
|
||||
|
|
@ -233,7 +223,6 @@ test('can publish a draft playlist over the live playlist', function () {
|
|||
|
||||
expect($display->draftPlaylist)->toBeNull();
|
||||
expect($display->livePlaylist->modules->pluck('id')->all())->toBe([$draftVersion->id]);
|
||||
expect($display->versions->pluck('id')->all())->toBe([$draftVersion->id]);
|
||||
});
|
||||
|
||||
test('can edit live playlist without changing draft playlist', function () {
|
||||
|
|
@ -277,7 +266,6 @@ test('can edit draft playlist without changing live playlist', function () {
|
|||
expect($display->preview_token)->not->toBeNull();
|
||||
expect($display->livePlaylist->modules->pluck('id')->all())->toBe([$liveVersion->id]);
|
||||
expect($display->draftPlaylist->modules->pluck('id')->all())->toBe([$draftVersion->id, $newDraftVersion->id]);
|
||||
expect($display->versions->pluck('id')->all())->toBe([]);
|
||||
});
|
||||
|
||||
test('draft editor renders iframe preview url', function () {
|
||||
|
|
@ -354,9 +342,26 @@ test('renders live and draft playlist columns', function () {
|
|||
->test(DisplayList::class)
|
||||
->assertSee('Live Modul')
|
||||
->assertSee('Draft Modul')
|
||||
->assertSee('Öffentliche Display-Übersicht')
|
||||
->assertSee('Display-Übersicht öffnen')
|
||||
->assertSee('https://cabinet.b2in.eu/display/', false)
|
||||
->assertSee('Live bearbeiten')
|
||||
->assertSee('Live-URL zum Kopieren')
|
||||
->assertSee(url('/_cabinet/display/index.html').'?id='.$display->id, false)
|
||||
->assertSee('https://cabinet.b2in.eu/display/?id='.$display->id, false)
|
||||
->assertSee('Entwurf bearbeiten')
|
||||
->assertSee('Test-Display');
|
||||
});
|
||||
|
||||
test('display live urls fall back to cabinet domain when config is empty', function () {
|
||||
config(['display.player_url' => '']);
|
||||
|
||||
$user = User::factory()->create();
|
||||
$version = DisplayVersion::factory()->create(['name' => 'Live Modul']);
|
||||
$display = Display::factory()->create();
|
||||
createDisplayListPlaylist($display, DisplayPlaylist::STATUS_PUBLISHED, [$version->id]);
|
||||
|
||||
Livewire::actingAs($user)
|
||||
->test(DisplayList::class)
|
||||
->assertSee('https://cabinet.b2in.eu/display/', false)
|
||||
->assertSee('https://cabinet.b2in.eu/display/?id='.$display->id, false);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ use App\Models\Display;
|
|||
use App\Models\DisplayPlaylist;
|
||||
use App\Models\DisplayPlaylistItem;
|
||||
use App\Models\DisplayVersion;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
it('creates the display_playlists table with unique status per display', function () {
|
||||
|
|
@ -27,64 +26,8 @@ it('adds is_test and preview_token to displays', function () {
|
|||
expect(Schema::hasColumns('displays', ['is_test', 'preview_token']))->toBeTrue();
|
||||
});
|
||||
|
||||
it('migrates existing pivot entries into a published playlist with same ordering', function () {
|
||||
$display = Display::factory()->create();
|
||||
$moduleA = DisplayVersion::factory()->create(['name' => 'Modul A']);
|
||||
$moduleB = DisplayVersion::factory()->create(['name' => 'Modul B']);
|
||||
|
||||
DB::table('display_playlists')->where('display_id', $display->id)->delete();
|
||||
|
||||
DB::table('display_display_version')->insert([
|
||||
['display_id' => $display->id, 'display_version_id' => $moduleA->id, 'sort_order' => 0],
|
||||
['display_id' => $display->id, 'display_version_id' => $moduleB->id, 'sort_order' => 1],
|
||||
]);
|
||||
|
||||
$migration = require database_path('migrations/2026_05_11_113330_migrate_pivot_to_display_playlists.php');
|
||||
$migration->up();
|
||||
|
||||
$playlist = DisplayPlaylist::query()
|
||||
->where('display_id', $display->id)
|
||||
->where('status', DisplayPlaylist::STATUS_PUBLISHED)
|
||||
->first();
|
||||
|
||||
expect($playlist)->not->toBeNull();
|
||||
expect($playlist->published_at)->not->toBeNull();
|
||||
|
||||
$orderedIds = $playlist->items()->pluck('display_version_id')->all();
|
||||
expect($orderedIds)->toBe([$moduleA->id, $moduleB->id]);
|
||||
});
|
||||
|
||||
it('is idempotent and does not duplicate published playlists on re-run', function () {
|
||||
$display = Display::factory()->create();
|
||||
$module = DisplayVersion::factory()->create();
|
||||
|
||||
DB::table('display_playlists')->where('display_id', $display->id)->delete();
|
||||
|
||||
DB::table('display_display_version')->insert([
|
||||
['display_id' => $display->id, 'display_version_id' => $module->id, 'sort_order' => 0],
|
||||
]);
|
||||
|
||||
$migration = require database_path('migrations/2026_05_11_113330_migrate_pivot_to_display_playlists.php');
|
||||
$migration->up();
|
||||
$migration->up();
|
||||
|
||||
$count = DisplayPlaylist::query()
|
||||
->where('display_id', $display->id)
|
||||
->where('status', DisplayPlaylist::STATUS_PUBLISHED)
|
||||
->count();
|
||||
|
||||
expect($count)->toBe(1);
|
||||
});
|
||||
|
||||
it('does not break the legacy versions() relation', function () {
|
||||
$display = Display::factory()->create();
|
||||
$module = DisplayVersion::factory()->create();
|
||||
|
||||
DB::table('display_display_version')->insert([
|
||||
['display_id' => $display->id, 'display_version_id' => $module->id, 'sort_order' => 0],
|
||||
]);
|
||||
|
||||
expect($display->fresh()->versions)->toHaveCount(1);
|
||||
it('drops the legacy display version pivot table', function () {
|
||||
expect(Schema::hasTable('display_display_version'))->toBeFalse();
|
||||
});
|
||||
|
||||
it('exposes a live playlist relation and a draft playlist relation on display', function () {
|
||||
|
|
|
|||
|
|
@ -214,14 +214,34 @@ test('check endpoint returns only updated_at', function () {
|
|||
$response->assertJsonStructure(['updated_at']);
|
||||
});
|
||||
|
||||
test('display config ignores legacy pivot and reads published playlist', function () {
|
||||
$legacyVersion = DisplayVersion::factory()->create(['type' => 'video-display', 'name' => 'Legacy']);
|
||||
DisplayVersionItem::factory()->create([
|
||||
'display_version_id' => $legacyVersion->id,
|
||||
'item_type' => 'video',
|
||||
'content' => ['filename' => 'legacy.mp4', 'title' => 'Legacy', 'position' => 25],
|
||||
test('display overview lists active displays with published modules', function () {
|
||||
$liveVersion = DisplayVersion::factory()->create(['name' => 'Live Module']);
|
||||
$activeDisplay = Display::factory()->create([
|
||||
'name' => 'Showroom Eingang',
|
||||
'location' => 'Bielefeld',
|
||||
'is_active' => true,
|
||||
]);
|
||||
publishDisplayModules($activeDisplay, [$liveVersion->id]);
|
||||
|
||||
$inactiveDisplay = Display::factory()->create(['is_active' => false]);
|
||||
publishDisplayModules($inactiveDisplay, [$liveVersion->id]);
|
||||
|
||||
Display::factory()->create(['name' => 'Ohne Live']);
|
||||
|
||||
$response = $this->getJson('/api/display/overview');
|
||||
|
||||
$response->assertSuccessful()
|
||||
->assertJsonCount(1, 'displays')
|
||||
->assertJsonPath('displays.0.id', $activeDisplay->id)
|
||||
->assertJsonPath('displays.0.name', 'Showroom Eingang')
|
||||
->assertJsonPath('displays.0.location', 'Bielefeld')
|
||||
->assertJsonPath('displays.0.is_active', true)
|
||||
->assertJsonPath('displays.0.is_live', true)
|
||||
->assertJsonPath('displays.0.module_count', 1)
|
||||
->assertJsonPath('displays.0.url', 'https://cabinet.b2in.eu/display/?id='.$activeDisplay->id);
|
||||
});
|
||||
|
||||
test('display config reads published playlist', function () {
|
||||
$publishedVersion = DisplayVersion::factory()->create(['type' => 'video-display', 'name' => 'Published']);
|
||||
DisplayVersionItem::factory()->create([
|
||||
'display_version_id' => $publishedVersion->id,
|
||||
|
|
@ -230,7 +250,6 @@ test('display config ignores legacy pivot and reads published playlist', functio
|
|||
]);
|
||||
|
||||
$display = Display::factory()->create();
|
||||
$display->versions()->attach($legacyVersion->id, ['sort_order' => 0]);
|
||||
publishDisplayModules($display, [$publishedVersion->id]);
|
||||
|
||||
$response = $this->getJson("/api/display/{$display->id}/config");
|
||||
|
|
@ -391,6 +410,11 @@ test('display player keeps previews in a strict 9 by 16 viewport', function () {
|
|||
->toContain('width: min(100vw, calc(100vh * 9 / 16));')
|
||||
->toContain('height: min(100vh, calc(100vw * 16 / 9));')
|
||||
->toContain('container-type: size;')
|
||||
->toContain("if (hostname === 'cabinet.b2in.eu') {")
|
||||
->toContain("return 'https://portal.b2in.eu';")
|
||||
->toContain('/api/display/overview')
|
||||
->toContain('Aktive Live-Displays')
|
||||
->toContain('renderOverview(data.displays || [])')
|
||||
->toContain('translate(${offsetX}px, ${offsetY}px) scale(${scale})')
|
||||
->toContain('this.settings.logo_url')
|
||||
->toContain('this.settings.footer_claim')
|
||||
|
|
|
|||
|
|
@ -36,6 +36,20 @@ test('display version list renders for authenticated users', function () {
|
|||
$response->assertSeeLivewire(DisplayVersionList::class);
|
||||
});
|
||||
|
||||
test('display dashboard documentation describes current workflow', function () {
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user);
|
||||
|
||||
$this->get(route('admin.cms.display-dashboard'))
|
||||
->assertSuccessful()
|
||||
->assertSee('Live und Entwurf')
|
||||
->assertSee('Meta-Einstellungen pflegen')
|
||||
->assertSee('SVG-Logos')
|
||||
->assertSee('/storage/...')
|
||||
->assertSee('Entwurf in der 9:16-Vorschau');
|
||||
});
|
||||
|
||||
test('can create a display version', function () {
|
||||
$user = User::factory()->create();
|
||||
|
||||
|
|
@ -104,19 +118,6 @@ test('display version editor renders with correct version data', function () {
|
|||
$response->assertSeeLivewire(DisplayVersionEditor::class);
|
||||
});
|
||||
|
||||
test('old display version routes redirect to module routes', function () {
|
||||
$user = User::factory()->create();
|
||||
$version = DisplayVersion::factory()->create();
|
||||
|
||||
$this->actingAs($user);
|
||||
|
||||
$this->get(route('admin.cms.display-versions'))
|
||||
->assertRedirect(route('admin.cms.display-modules'));
|
||||
|
||||
$this->get(route('admin.cms.display-version-edit', $version))
|
||||
->assertRedirect(route('admin.cms.display-module-edit', $version));
|
||||
});
|
||||
|
||||
test('display module editor renders module preview', function () {
|
||||
$user = User::factory()->create();
|
||||
$version = DisplayVersion::factory()->create(['name' => 'Preview Modul']);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue