Biete Symbolgrößen, Ausrichtung und 1 bis 12 Merkmale an
Deploy Test / test (push) Successful in 2m47s
CI Feature / test (push) Successful in 2m39s
Deploy Test / deploy (push) Successful in 26s

Nach der zweiten Sichtung auf luf-test:

- Symbol neben dem Absatz in drei Stufen (symbol_size: medium, large, xlarge)
  statt nur einer. "large" bleibt unverändert, schon gespeicherte Seiten
  ändern sich nicht. Neu: symbol_align (top, center, bottom) legt die
  senkrechte Lage neben dem Absatz fest; Vorgabe oben. Bei wenig Platz steht
  das Symbol darüber, immer links ausgerichtet.
- Merkmalszeile: ein bis zwölf statt zwei bis vier Merkmale und in jeder
  Platzbreite (1 bis 4 Einheiten). Die Spalten folgen weiter der Breite; ein
  einzelnes Merkmal wird nicht über die ganze Breite gezogen.

Die Tests zur Anzahl und zur Platzbreite sind bewusst geändert: Die alten
Grenzen (2 bis 4, nicht in 1 Einheit) waren eine Vorgabe, die das Raster nicht
braucht.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-24 08:16:41 +01:00
1 parent 3c7a71532f
commit 09889da099
14 files changed
+135 -48

No files matched your search

+32 -9
View File
@@ -108,11 +108,11 @@ public function test_the_features_row_renders_symbols_titles_and_text_with_one_c
$this->assertStringNotContainsString('motif-title', $html);
}
public function test_the_features_row_needs_two_to_four_items_with_a_known_symbol(): void
public function test_the_features_row_takes_one_to_twelve_items_with_a_known_symbol(): void
{
$item = fn (string $symbol = 'buch'): array => ['symbol' => $symbol, 'title' => 'Titel', 'text' => null];
foreach ([[$item()], array_fill(0, 5, $item()), [$item(), $item('nicht-vorhanden')], [$item(), ['symbol' => 'buch', 'title' => '', 'text' => null]]] as $index => $items) {
foreach ([[], array_fill(0, 13, $item()), [$item(), $item('nicht-vorhanden')], [$item(), ['symbol' => 'buch', 'title' => '', 'text' => null]]] as $index => $items) {
try {
$this->publish('/merkmale-falsch-'.$index, $this->widget('features', ['items' => $items]));
$this->fail("Fall $index wurde angenommen.");
@@ -122,18 +122,40 @@ public function test_the_features_row_needs_two_to_four_items_with_a_known_symbo
}
$this->assertStringContainsString('lf-features--2', $this->publish('/merkmale-zwei', $this->widget('features', ['items' => [$item(), $item('gruppe')]])));
$this->assertStringContainsString('lf-features--1', $this->publish('/merkmale-eins', $this->widget('features', ['items' => [$item()]])));
$this->assertStringContainsString('lf-features--4', $this->publish('/merkmale-vier', $this->widget('features', ['items' => array_fill(0, 4, $item())])));
$zwoelf = $this->publish('/merkmale-zwoelf', $this->widget('features', ['items' => array_fill(0, 12, $item())]));
$this->assertStringContainsString('lf-features--12', $zwoelf);
$this->assertSame(12, substr_count($zwoelf, 'class="lf-features__item"'));
}
public function test_a_large_symbol_stands_left_of_the_whole_paragraph_and_not_inside_the_heading(): void
public function test_a_symbol_beside_the_paragraph_has_a_size_and_a_vertical_alignment(): void
{
$html = $this->publish('/gross', $this->widget('heading', ['heading' => 'Filme', 'intro' => 'Kurz erklärt'], ['symbol' => 'filmklappe', 'symbol_size' => 'large']));
$this->assertMatchesRegularExpression('~<div class="lf-lead"><svg[^>]*class="brand-symbol lf-lead__symbol"[^>]*>.*?</svg><div class="lf-lead__body">\s*<h2>Filme</h2>\s*<p class="lede">Kurz erklärt</p>\s*</div></div>~s', $html);
$this->assertMatchesRegularExpression('~<div class="lf-lead lf-lead--large lf-lead--top"><svg[^>]*class="brand-symbol lf-lead__symbol"[^>]*>.*?</svg><div class="lf-lead__body">\s*<h2>Filme</h2>\s*<p class="lede">Kurz erklärt</p>\s*</div></div>~s', $html);
$this->assertStringNotContainsString('lf-heading-symbol', $html, 'Das kleine Symbol entfällt, sonst stünde es doppelt.');
$cta = $this->publish('/gross-aufruf', $this->widget('call_to_action', ['heading' => 'Jetzt', 'text' => 'Alles in einem.', 'label' => 'Los', 'url' => '/angebote'], ['symbol' => 'paket', 'symbol_size' => 'large']));
$this->assertMatchesRegularExpression('~<div class="cta">\s*<div class="lf-lead"><svg[^>]*lf-lead__symbol.*?<h2>Jetzt</h2>.*?<a class="button" href="/angebote">Los</a>\s*</div></div>\s*</div>~s', $cta);
foreach ([['medium', 'center'], ['xlarge', 'bottom']] as [$size, $align]) {
$this->assertStringContainsString(
'<div class="lf-lead lf-lead--'.$size.' lf-lead--'.$align.'">',
$this->publish("/gross-$size", $this->widget('heading', ['heading' => 'Filme'], ['symbol' => 'buch', 'symbol_size' => $size, 'symbol_align' => $align])),
);
}
$cta = $this->publish('/gross-aufruf', $this->widget('call_to_action', ['heading' => 'Jetzt', 'text' => 'Alles in einem.', 'label' => 'Los', 'url' => '/angebote'], ['symbol' => 'paket', 'symbol_size' => 'large', 'symbol_align' => 'center']));
$this->assertMatchesRegularExpression('~<div class="cta">\s*<div class="lf-lead lf-lead--large lf-lead--center"><svg[^>]*lf-lead__symbol.*?<h2>Jetzt</h2>.*?<a class="button" href="/angebote">Los</a>\s*</div></div>\s*</div>~s', $cta);
}
public function test_an_unknown_alignment_is_rejected_when_saving(): void
{
try {
$this->publish('/ausrichtung-falsch', $this->widget('heading', ['heading' => 'Filme'], ['symbol' => 'buch', 'symbol_size' => 'large', 'symbol_align' => 'diagonal']));
$this->fail('Eine unbekannte Ausrichtung wurde angenommen.');
} catch (ValidationException $exception) {
$this->assertStringContainsString('nicht freigegeben', implode(' ', array_merge(...array_values($exception->errors()))));
}
}
public function test_the_large_size_does_nothing_without_a_symbol_and_is_checked_when_saving(): void
@@ -192,9 +214,10 @@ public function test_feature_links_must_be_safe_and_a_label_without_a_link_is_dr
}
}
public function test_the_features_row_is_not_offered_in_a_single_unit_slot(): void
public function test_the_features_row_fits_every_slot_width(): void
{
$this->assertFalse(app(WidgetRegistry::class)->get('features')->supportsUnits(1));
$this->assertTrue(app(WidgetRegistry::class)->get('features')->supportsUnits(2));
foreach ([1, 2, 3, 4] as $units) {
$this->assertTrue(app(WidgetRegistry::class)->get('features')->supportsUnits($units), "$units Einheiten");
}
}
}