Führe einen gemeinsamen Layoutvertrag ein und integriere die Premium-Widgets.
Layoutvertrag (ADR-38) in der bestehenden Registry: Jede Widget-Art erklärt zulässige Rasterbreiten (supportedUnits), Höhen aus einem gemeinsamen Vokabular (heights, gespeichert als settings.height), Darstellungsmodi und Verhalten bei wenig Platz. Unzulässige Breiten werden beim Speichern verständlich abgewiesen; Höhe „fill“ streckt den Handlungsaufruf auf die Abschnittszeile. Premium-Widgets nach Brand-UI-Kit v1.6: - hero Version 2: photo_split/editorial_solid, Höhen compact/normal/ large, Label, Überschriftenebene, Akzent, Bildfokus in Prozent, zwei Schaltflächen; nur 3 oder 4 Einheiten. Upgrade aus Version 1. - image_text Version 3: Fläche cream/clear/navy, Höhen compact/normal/ spacious, Label, zwei Schaltflächen, Bildfokus; 1 bis 4 Einheiten. Upgrade aus Version 2 (format entfällt, Fokus in Prozent). - Kit-CSS ersetzt das bisherige Hero- und Bild-und-Text-CSS; der Randlos-Mechanismus der Designiteration 1 entfällt. Editor: Reiter Inhalt/Medien/Darstellung aus der Registry, Auswahl- knöpfe mit Symbolen, Schieberegler für den Bildfokus und eine Live- Vorschau im Dialog mit demselben Renderer in wählbarer Platzbreite. Tests bewusst angepasst: Einstieg braucht jetzt 3 oder 4 Einheiten (vorher Mindestbreite 2), image_text ist Version 3, Klassen der neuen Ansichten; die Hero-/Bild-Tests der Designiteration 1 sind durch CmsPremiumWidgetsTest ersetzt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3cdb36e7a3
commit
0bfb53463a
38 files changed
+1755
-856
No files matched your search
@@ -7,12 +7,11 @@
|
||||
use App\Domain\Cms\PageService;
|
||||
use App\Domain\Cms\Widgets\WidgetRegistry;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Designiteration 1: stabiler Website-Rahmen, Markenakzente und neue Widget-Varianten.
|
||||
* Alle Erweiterungen sind additiv: gespeicherte Widgets bleiben gültig und werden wie bisher dargestellt.
|
||||
* Designiteration 1: stabiler Website-Rahmen, Markenakzente und Karten-Varianten.
|
||||
* Einstieg und Bild und Text sind seit Kit v1.6 Premium-Widgets (Tests in CmsPremiumWidgetsTest).
|
||||
*/
|
||||
class CmsDesignIterationTest extends TestCase
|
||||
{
|
||||
@@ -65,91 +64,6 @@ public function test_footer_shows_legal_links_in_the_base_row_and_a_decorative_a
|
||||
$this->assertMatchesRegularExpression('#<svg class="brand-arc site-footer-arc"[^>]*aria-hidden="true"#', $html);
|
||||
}
|
||||
|
||||
public function test_hero_stored_before_this_iteration_renders_unchanged_content(): void
|
||||
{
|
||||
$html = $this->publish('/alt', [[
|
||||
'type' => 'hero', 'v' => 1, 'variant' => 'standard',
|
||||
'data' => ['heading' => 'Stark im Alltag', 'text' => 'Einstieg', 'cta_label' => 'Mehr', 'cta_url' => '/praevention', 'alt' => 'Bild'],
|
||||
'refs' => ['image' => 'cms/alt.jpg'],
|
||||
]]);
|
||||
|
||||
$this->assertStringContainsString('class="hero hero-standard hero-with-image"', $html);
|
||||
$this->assertStringContainsString('<h1>Stark im Alltag</h1>', $html);
|
||||
$this->assertStringContainsString('<p class="lede">Einstieg</p>', $html);
|
||||
$this->assertSame(1, substr_count($html, 'class="button button-brand"'));
|
||||
$this->assertStringNotContainsString('button-secondary', $html);
|
||||
$this->assertStringContainsString('alt="Bild" loading="eager" fetchpriority="high" decoding="async"', $html);
|
||||
$this->assertStringNotContainsString('section-bleed', $html);
|
||||
}
|
||||
|
||||
public function test_brand_stage_bleeds_only_when_it_is_alone_in_its_section_and_has_an_image(): void
|
||||
{
|
||||
$stage = fn (?string $image) => [
|
||||
'type' => 'hero', 'v' => 1, 'variant' => 'stage',
|
||||
'settings' => ['focus' => 'left', 'text_side' => 'left'],
|
||||
'data' => ['heading' => 'Bühne', 'alt' => $image ? 'Motiv' : null],
|
||||
'refs' => ['image' => $image],
|
||||
];
|
||||
|
||||
$html = $this->publish('/buehne', [
|
||||
$this->section('u4', [$stage('cms/buehne.jpg')], ['width' => 'full']),
|
||||
$this->section('u2_2', [$stage('cms/buehne.jpg'), ['type' => 'prose', 'v' => 1, 'data' => ['body' => '<p>Text</p>']]]),
|
||||
$this->section('u4', [$stage(null)]),
|
||||
]);
|
||||
|
||||
$this->assertSame(1, substr_count($html, 'section-bleed'));
|
||||
$this->assertMatchesRegularExpression('#class="page-section [^"]*section-bleed"#', $html);
|
||||
$this->assertStringContainsString('class="hero hero-stage hero-with-image hero-text-left" style="--hero-focus: 0% 50%"', $html);
|
||||
$this->assertStringContainsString('<div class="hero-media">', $html);
|
||||
// Nur das erste Bild der Seite wird sofort geladen.
|
||||
$this->assertSame(1, substr_count($html, 'fetchpriority="high"'));
|
||||
}
|
||||
|
||||
public function test_hero_renders_a_second_action_and_rejects_unsafe_targets(): void
|
||||
{
|
||||
$html = $this->publish('/zwei', [[
|
||||
'type' => 'hero', 'v' => 1, 'variant' => 'editorial',
|
||||
'data' => ['heading' => 'Konzept', 'cta_label' => 'Programme', 'cta_url' => '/programme', 'cta2_label' => 'Mitgliederbereich', 'cta2_url' => '/bereich'],
|
||||
]]);
|
||||
|
||||
$this->assertStringContainsString('class="hero hero-editorial"', $html);
|
||||
$this->assertStringContainsString('<a class="button button-brand" href="/programme">Programme</a>', $html);
|
||||
$this->assertStringContainsString('<a class="button button-secondary" href="/bereich">Mitgliederbereich</a>', $html);
|
||||
|
||||
try {
|
||||
app(WidgetRegistry::class)->normalize([[
|
||||
'type' => 'hero', 'v' => 1, 'variant' => 'stage',
|
||||
'data' => ['heading' => 'X', 'cta2_label' => 'Böse', 'cta2_url' => 'javascript:alert(1)'],
|
||||
]]);
|
||||
$this->fail('Unsicheres zweites Linkziel wurde angenommen.');
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertArrayHasKey('blocks.0.data.cta2_url', $exception->errors());
|
||||
}
|
||||
}
|
||||
|
||||
public function test_image_settings_are_enumerations_only(): void
|
||||
{
|
||||
$html = $this->publish('/format', [[
|
||||
'type' => 'image_text', 'v' => 2, 'variant' => 'image_left',
|
||||
'settings' => ['format' => 'portrait', 'focus' => 'top_right'],
|
||||
'data' => ['title' => 'Hochformat', 'body' => '<p>Text</p>', 'alt' => 'Motiv'],
|
||||
'refs' => ['image' => 'cms/hoch.jpg'],
|
||||
]]);
|
||||
|
||||
$this->assertStringContainsString('class="image-text image-text-left image-format-portrait" style="--image-focus: 100% 0%"', $html);
|
||||
|
||||
try {
|
||||
app(WidgetRegistry::class)->normalize([[
|
||||
'type' => 'image_text', 'v' => 2, 'variant' => 'image_left',
|
||||
'settings' => ['format' => 'panorama; color: red'],
|
||||
'data' => ['body' => '<p>Text</p>'],
|
||||
]]);
|
||||
$this->fail('Freier Einstellungswert wurde angenommen.');
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertArrayHasKey('blocks.0.settings.format', $exception->errors());
|
||||
}
|
||||
}
|
||||
|
||||
public function test_featured_cards_lead_with_the_first_card_and_link_the_whole_card(): void
|
||||
{
|
||||
$html = $this->publish('/karten', [[
|
||||
|
||||
Reference in new issue
Block a user