Füge großes Symbol neben dem Absatz und Links in der Merkmalszeile hinzu
Nach der ersten Sichtung auf luf-test: - Einstellung "Größe des Symbols" (settings.symbol_size = large) bei Überschrift und Handlungsaufruf: das Symbol steht groß links neben Überschrift, Text und Schaltfläche, bei höchstens 24 rem Slotbreite darüber. Vorgabe bleibt das kleine Symbol vor der Überschrift. Ohne gewähltes Symbol hat die Größe keine Wirkung. - Merkmalszeile: je Merkmal optional Linkziel (SafeUrl) und Linktext (Vorgabe "Mehr erfahren", ohne Linkziel verworfen). Die Einstellung "Darstellung der Links" wählt für das Widget kleiner Textlink (Vorgabe) oder Pille. Der zugängliche Name des Links nennt das Merkmal. - Auf dunklen Flächen steht auch das große Symbol auf einer weißen Scheibe. - Doku: Die Tabelle in cms-widget-registry.md war durch meinen früheren Absatz zerrissen (Zeile "Höhe" stand außerhalb) und ist wieder in Ordnung. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ad581cb545
commit
3c7a71532f
14 files changed
+270
-12
No files matched your search
@@ -125,6 +125,73 @@ public function test_the_features_row_needs_two_to_four_items_with_a_known_symbo
|
||||
$this->assertStringContainsString('lf-features--4', $this->publish('/merkmale-vier', $this->widget('features', ['items' => array_fill(0, 4, $item())])));
|
||||
}
|
||||
|
||||
public function test_a_large_symbol_stands_left_of_the_whole_paragraph_and_not_inside_the_heading(): 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->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);
|
||||
}
|
||||
|
||||
public function test_the_large_size_does_nothing_without_a_symbol_and_is_checked_when_saving(): void
|
||||
{
|
||||
$this->assertStringNotContainsString('lf-lead', $this->publish('/gross-ohne', $this->widget('heading', ['heading' => 'Filme'], ['symbol_size' => 'large'])));
|
||||
$this->assertStringContainsString('<h2>Filme</h2>', $this->publish('/gross-ohne-2', $this->widget('heading', ['heading' => 'Filme'], ['symbol_size' => 'large'])));
|
||||
|
||||
try {
|
||||
$this->publish('/gross-falsch', $this->widget('heading', ['heading' => 'Filme'], ['symbol' => 'buch', 'symbol_size' => 'huge']));
|
||||
$this->fail('Eine unbekannte Größe wurde angenommen.');
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertStringContainsString('nicht freigegeben', implode(' ', array_merge(...array_values($exception->errors()))));
|
||||
}
|
||||
}
|
||||
|
||||
public function test_feature_links_are_small_text_by_default_and_a_pill_on_request(): void
|
||||
{
|
||||
$items = [
|
||||
['symbol' => 'filmklappe', 'title' => 'Film', 'text' => null, 'url' => '/materialien', 'link_label' => 'Alle Filme'],
|
||||
['symbol' => 'buch', 'title' => 'Buch', 'text' => null, 'url' => 'https://example.org/buch', 'link_label' => null],
|
||||
['symbol' => 'gruppe', 'title' => 'Gruppe', 'text' => null],
|
||||
];
|
||||
|
||||
$text = $this->publish('/links-text', $this->widget('features', ['items' => $items]));
|
||||
$this->assertStringContainsString('<a class="lf-features__link lf-features__link--text" href="/materialien" aria-label="Alle Filme: Film">Alle Filme</a>', $text);
|
||||
$this->assertStringContainsString('<a class="lf-features__link lf-features__link--text" href="https://example.org/buch" aria-label="Mehr erfahren: Buch">Mehr erfahren</a>', $text);
|
||||
$this->assertSame(2, substr_count($text, 'class="lf-features__more"'), 'Ohne Link gibt es keinen leeren Absatz.');
|
||||
|
||||
$pill = $this->publish('/links-pille', $this->widget('features', ['items' => $items], ['link_style' => 'pill']));
|
||||
$this->assertSame(2, substr_count($pill, 'lf-features__link--pill'));
|
||||
$this->assertStringNotContainsString('lf-features__link--text', $pill);
|
||||
}
|
||||
|
||||
public function test_feature_links_must_be_safe_and_a_label_without_a_link_is_dropped(): void
|
||||
{
|
||||
$item = fn (array $extra): array => ['symbol' => 'buch', 'title' => 'Titel', 'text' => null] + $extra;
|
||||
|
||||
foreach (['javascript:alert(1)', 'data:text/html,x', '//evil.example'] as $url) {
|
||||
try {
|
||||
$this->publish('/link-unsicher-'.md5($url), $this->widget('features', ['items' => [$item(['url' => $url]), $item([])]]));
|
||||
$this->fail("Die Adresse $url wurde angenommen.");
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertNotEmpty($exception->errors(), $url);
|
||||
}
|
||||
}
|
||||
|
||||
$html = $this->publish('/link-ohne-ziel', $this->widget('features', ['items' => [$item(['link_label' => 'Versteckt']), $item([])]]));
|
||||
$this->assertStringNotContainsString('Versteckt', $html);
|
||||
$this->assertStringNotContainsString('lf-features__link', $html);
|
||||
|
||||
try {
|
||||
$this->publish('/pille-falsch', $this->widget('features', ['items' => [$item([]), $item([])]], ['link_style' => 'button']));
|
||||
$this->fail('Eine unbekannte Link-Darstellung wurde angenommen.');
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertStringContainsString('nicht freigegeben', implode(' ', array_merge(...array_values($exception->errors()))));
|
||||
}
|
||||
}
|
||||
|
||||
public function test_the_features_row_is_not_offered_in_a_single_unit_slot(): void
|
||||
{
|
||||
$this->assertFalse(app(WidgetRegistry::class)->get('features')->supportsUnits(1));
|
||||
|
||||
Reference in new issue
Block a user