Biete Symbole auf redaktionellen Karten und in der FAQ an
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:
1 parent
390d61feaa
commit
219962daff
13 files changed
+190
-14
No files matched your search
@@ -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']));
|
||||
|
||||
@@ -75,6 +75,15 @@ public function test_the_lead_describes_what_a_view_needs_and_defaults_the_side_
|
||||
$this->assertNull(HeadingAccent::lead(['symbol_size' => 'large'], 'medium')['side'], 'Ohne Symbol nie ein Absatzlayout.');
|
||||
}
|
||||
|
||||
public function test_the_block_layout_falls_back_to_left_and_medium(): void
|
||||
{
|
||||
$this->assertSame(['align' => 'left', 'size' => 'medium'], HeadingAccent::block([]));
|
||||
$this->assertSame(['align' => 'center', 'size' => 'xlarge'], HeadingAccent::block(['align' => 'center', 'symbol_size' => 'xlarge']));
|
||||
$this->assertSame(['align' => 'left', 'size' => 'medium'], HeadingAccent::block(['align' => 'justify', 'symbol_size' => ['large']]));
|
||||
$this->assertSame(['left', 'center', 'right'], array_keys(HeadingAccent::TEXT_ALIGN));
|
||||
$this->assertSame(HeadingAccent::TEXT_ALIGN, FeaturesWidget::ALIGN, 'Merkmalszeile und Karten richten gleich aus.');
|
||||
}
|
||||
|
||||
public function test_the_alignment_defaults_to_top(): void
|
||||
{
|
||||
$this->assertSame('center', HeadingAccent::align(['symbol_align' => 'center']));
|
||||
|
||||
Reference in new issue
Block a user