Merge remote-tracking branch 'origin/develop' into feature/videoplayer-grundlagen
Deploy Test / test (push) Successful in 7m19s
Deploy Test / deploy (push) Successful in 37s

This commit is contained in:
Stommer committed 2026-12-01 11:20:08 +01:00
commit ec8c173053
6 files changed
+49 -1

No files matched your search

+16
View File
@@ -144,6 +144,22 @@ public function test_the_page_shows_classes_instead_of_inline_styles(): void
$this->assertSame('<p class="ta-center">x</p>', ProseWidget::render('<p style="text-align: center">x</p>'));
}
public function test_a_text_that_starts_with_a_level_two_heading_is_shown_formatted_and_not_as_markup(): void
{
// Zugeliefert (Import, Einfügen aus einem anderen Text): beginnt mit h2, nicht mit einem Absatz.
$body = '<h2>Was Kinder üben</h2><p>Text mit <strong>fett</strong>.</p><h3>Nein sagen</h3><ul><li><p>Eigene Ideen</p></li><li><p>Pause nutzen</p></li></ul>';
$page = Page::query()->create(['path' => '/ueberschrift-zwei']);
$service = app(PageService::class);
$service->publish($page, $service->saveRevision($page, [['layout' => 'u4', 'style' => [], 'slots' => [['type' => 'prose', 'v' => 2, 'settings' => [], 'data' => ['body' => $body]]]]], null, null, null));
$html = $this->get('/ueberschrift-zwei')->assertOk()->getContent();
$this->assertStringContainsString('<h3>Was Kinder üben</h3><p>Text mit <strong>fett</strong>.</p><h3>Nein sagen</h3><ul><li><p>Eigene Ideen</p></li><li><p>Pause nutzen</p></li></ul>', $html);
$this->assertStringNotContainsString('&lt;h2&gt;', $html);
$this->assertStringNotContainsString('&lt;p&gt;', $html);
$this->assertStringContainsString('<h3>Was Kinder üben</h3>', ProseWidget::render($body));
}
public function test_the_stylesheet_knows_every_size_and_color(): void
{
$css = (string) file_get_contents(resource_path('css/widgets.css'));
+18
View File
@@ -78,6 +78,24 @@ public function test_plain_text_that_only_looks_like_markup_stays_plain(): void
$this->assertFalse(FormattedText::isHtml('Preis < 5 und > 3'));
}
public function test_html_that_starts_with_h1_h2_or_div_is_html_and_not_masked_as_plain_text(): void
{
$html = '<h2>Was Kinder üben</h2><p>Text mit <strong>fett</strong>.</p><h3>Unterpunkt</h3><ul><li><p>Eins</p></li></ul>';
$this->assertTrue(FormattedText::isHtml($html));
$this->assertTrue(FormattedText::isHtml('
<h1>Titel</h1>'));
$this->assertTrue(FormattedText::isHtml('<div>Lose Zeile</div>'));
// h1 und h2 gehören der Seite und dem Kapitel; im Text werden sie zur Zwischenüberschrift h3.
$this->assertSame(
'<h3>Was Kinder üben</h3><p>Text mit <strong>fett</strong>.</p><h3>Unterpunkt</h3><ul><li><p>Eins</p></li></ul>',
FormattedText::canonical($html, true),
);
$this->assertStringNotContainsString('&lt;', FormattedText::html($html, null, true));
$this->assertSame('<p>Lose Zeile</p>', FormattedText::canonical('<div>Lose Zeile</div>'));
}
public function test_plain_text_and_excerpt_drop_markup_but_keep_structure(): void
{
$html = '<p>Erster <strong>Absatz</strong><br>mit Umbruch</p><ul><li><p>Eins</p></li><li><p>Zwei</p></li></ul><ol><li><p>A</p></li><li><p>B</p></li></ol>';