> $styles */ private function editor(array $styles): Testable { $user = User::factory()->redakteur()->create(); $user->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP'); $page = Page::query()->create(['path' => '/flaechen']); $sections = array_map(fn (array $style): array => [ 'layout' => 'u4', 'style' => $style, 'slots' => [['type' => 'cards', 'v' => 2, 'variant' => 'standard', 'settings' => ['link_style' => 'text'], 'data' => ['items' => [['title' => 'Eins', 'url' => '/a']]]]], ], $styles); app(PageService::class)->saveRevision($page, $sections, null, null, null); return Livewire::actingAs($user, 'staff')->test(EditPage::class, ['record' => $page->id]); } public function test_the_brand_surfaces_are_described_with_their_colours(): void { $dark = SectionSurface::of(['background' => 'dark']); $this->assertSame(['brand', '#032551', true], [$dark['kind'], $dark['bg'], $dark['dark']]); $light = SectionSurface::of(['background' => 'light']); $this->assertSame(['brand', '#f7f6f2', false], [$light['kind'], $light['bg'], $light['dark']]); $this->assertSame('', SectionSurface::css([]), 'Ohne eigene Fläche gibt es keine Eigenschaften.'); $this->assertSame('', SectionSurface::swatch(['background' => 'default'])); $this->assertSame('--luf-fl-bg: #3b7b09', SectionSurface::css(['background' => 'accent'])); } public function test_a_palette_colour_and_a_missing_palette_colour(): void { $this->assertSame([], DesignPalette::save(null, 'Sand', '#f3e9d2', '#15243a')); $id = DesignPalette::slots()[0]['id']; $surface = SectionSurface::of(['background' => 'palette', 'palette_slot' => $id]); $this->assertSame(['palette', 'Sand', '#f3e9d2'], [$surface['kind'], $surface['label'], $surface['bg']]); $this->assertStringContainsString('--luf-fl-bg: #f3e9d2', SectionSurface::css(['background' => 'palette', 'palette_slot' => $id])); // Wie auf der Website: eine Farbe, die es nicht mehr gibt, erscheint als Abschnitt ohne eigene Fläche. $this->assertSame('', SectionSurface::css(['background' => 'palette', 'palette_slot' => 'c99'])); } public function test_an_image_without_a_usable_address_gets_a_neutral_surface_and_never_leaks_markup(): void { $this->assertSame('--luf-fl-bg: #d9dee5', SectionSurface::css(['background' => 'image'])); $this->assertStringContainsString('Hintergrundbild', SectionSurface::swatch(['background' => 'image'])); } public function test_the_editor_shows_the_surface_behind_the_slots_and_in_the_header(): void { $this->assertSame([], DesignPalette::save(null, 'Sand', '#f3e9d2', '#15243a')); $component = $this->editor([ [], ['background' => 'dark'], ['background' => 'palette', 'palette_slot' => DesignPalette::slots()[0]['id']], ]); $html = $component->html(); $this->assertSame(2, substr_count($html, 'luf-slots luf-flaeche'), 'Nur die beiden Abschnitte mit eigener Fläche erhalten den Rahmen.'); $this->assertStringContainsString('--luf-fl-bg: #032551', $html); $this->assertStringContainsString('--luf-fl-bg: #f3e9d2', $html); $this->assertSame(2, substr_count($html, 'luf-abschnitt-flaeche" aria-hidden'), 'Je Abschnitt mit Fläche ein Farbfeld im Kopf.'); $this->assertStringContainsString('Hintergrund: Dunkle Markenfläche', $html); $this->assertStringContainsString('Hintergrund: Sand', $html); } }