Biete Symbole auf redaktionellen Karten und in der FAQ an
Deploy Test / test (push) Successful in 3m5s
CI Feature / test (push) Successful in 3m5s
Deploy Test / deploy (push) Successful in 27s

Etappe 2 der Angleichung aller Widgets:

- Redaktionelle Karten: je Karte ein optionales Symbol über dem Titel
  (data.items[].symbol, nur Schlüssel aus HeadingAccent::SYMBOLS). Neue
  Einstellungen: Größe der Symbole (dieselben vier Stufen, Vorgabe Mittel) und
  Ausrichtung (links, zentriert, rechts). Der Schlüssel symbol wird nur
  gespeichert, wenn ein Symbol gewählt ist, und die Listenklassen erscheinen
  nur bei Abweichung von der Vorgabe: Karten ohne Symbol bleiben in Daten und
  Ausgabe unverändert.
- FAQ: Symbol neben dem ganzen Block (Größe, senkrechte Ausrichtung), Vorgabe
  Mittel. Die Oberkante der ersten Frage stimmt am gerenderten Bild auf einen
  Bruchteil eines Pixels.
- HeadingAccent::block() und TEXT_ALIGN bündeln Ausrichtung und Größe für
  Inhalte mit Symbol über dem Text; die Merkmalszeile verwendet sie ebenfalls.
- Bewusst ohne Symbol: Themen-, Medien-, Programm- sowie Programm- und
  Modulkarten. Ihr Inhalt kommt aus Katalogobjekten, Medienkarten tragen den
  Material-Tag.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-24 09:28:15 +01:00
1 parent 390d61feaa
commit 219962daff
13 files changed
+190 -14

No files matched your search

+46
View File
@@ -186,6 +186,52 @@ public function test_the_prose_widget_takes_a_symbol_beside_the_text_with_medium
$this->assertStringNotContainsString('lf-lead', $this->publish('/fliesstext-nur-groesse', $this->widget('prose', ['body' => 'Text.'], ['symbol_size' => 'large'])), 'Ohne Symbol nie ein Absatzlayout.');
}
public function test_editorial_cards_can_carry_a_symbol_with_size_and_alignment(): void
{
$items = [
['title' => 'Mit Symbol', 'text' => 'Text', 'url' => '/a', 'symbol' => 'buch'],
['title' => 'Ohne Symbol', 'text' => null, 'url' => null],
];
$plain = $this->publish('/karten-ohne', $this->widget('cards', ['items' => [['title' => 'Eins', 'text' => null, 'url' => null]]]));
$this->assertStringContainsString('<ul class="cards cards-grid">', $plain, 'Ohne Einstellungen bleibt die Liste unverändert.');
$this->assertStringNotContainsString('lf-card__symbol', $plain);
$html = $this->publish('/karten-symbol', $this->widget('cards', ['items' => $items], ['symbol_size' => 'large', 'align' => 'center']));
$this->assertStringContainsString('<ul class="cards cards-grid cards--center cards--size-large">', $html);
$this->assertSame(1, substr_count($html, 'lf-card__symbol'), 'Nur die Karte mit Symbol zeigt eins.');
$this->assertMatchesRegularExpression('~<div class="card-body">\s*<svg[^>]*aria-hidden="true"[^>]*class="brand-symbol lf-card__symbol"[^>]*>.*?</svg>\s*<h3 class="card-title">\s*<a href="/a">Mit Symbol</a>~s', $html);
$this->assertStringContainsString('<ul class="cards cards-grid cards--right">', $this->publish('/karten-rechts', $this->widget('cards', ['items' => $items], ['align' => 'right'])));
}
public function test_editorial_cards_reject_unknown_symbols_and_layout_values(): void
{
$card = fn (array $extra): array => ['items' => [['title' => 'Karte', 'text' => null, 'url' => null] + $extra]];
foreach ([[$card(['symbol' => '../../.env']), []], [$card(['symbol' => 'signalstrahlen']), []], [$card([]), ['symbol_size' => 'huge']], [$card([]), ['align' => 'justify']]] as $index => [$data, $settings]) {
try {
$this->publish('/karten-falsch-'.$index, $this->widget('cards', $data, $settings));
$this->fail("Fall $index wurde angenommen.");
} catch (ValidationException $exception) {
$this->assertNotEmpty($exception->errors(), "Fall $index");
}
}
}
public function test_the_faq_takes_a_symbol_beside_all_questions(): void
{
$data = ['items' => [['question' => 'Warum?', 'answer' => 'Darum.']]];
$plain = $this->publish('/faq-ohne', $this->widget('faq', $data));
$this->assertStringNotContainsString('lf-lead', $plain);
$this->assertStringContainsString('<dl class="faq">', $plain);
$html = $this->publish('/faq-symbol', $this->widget('faq', $data, ['symbol' => 'sprechblase-fragezeichen']));
$this->assertMatchesRegularExpression('~<div class="lf-lead lf-lead--medium lf-lead--top"><svg[^>]*lf-lead__symbol.*?<div class="lf-lead__body">\s*<dl class="faq">\s*<dt>Warum\?</dt>\s*<dd>Darum\.</dd>\s*</dl>\s*</div></div>~s', $html);
$this->assertStringContainsString('lf-lead--small lf-lead--bottom', $this->publish('/faq-klein', $this->widget('faq', $data, ['symbol' => 'buch', 'symbol_size' => 'small', 'symbol_align' => 'bottom'])));
}
public function test_the_call_to_action_can_underline_its_heading_with_the_brush(): void
{
$html = $this->publish('/aufruf-pinsel', $this->widget('call_to_action', ['heading' => 'Jetzt', 'label' => 'Los', 'url' => '/angebote'], ['accent' => 'brush']));