aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/includes/BBCodeTest.php
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2024-02-06 21:23:51 +0100
committerHarald Eilertsen <haraldei@anduin.net>2024-02-07 15:54:40 +0100
commite6ce2885c0b4586a270e0ace79598a92365df56f (patch)
tree6bb17f31c8334c34f573993c1d0e1291cc670849 /tests/unit/includes/BBCodeTest.php
parentec19ee9d82a9d06e5b86fcb58329767226b0676f (diff)
downloadvolse-hubzilla-e6ce2885c0b4586a270e0ace79598a92365df56f.tar.gz
volse-hubzilla-e6ce2885c0b4586a270e0ace79598a92365df56f.tar.bz2
volse-hubzilla-e6ce2885c0b4586a270e0ace79598a92365df56f.zip
Fix: Keep indentation in html and md code blocks.
Moves the logic for unwrapping broken lines in html (and Markdown) to the node processing, instead of doing it over the full html content. This allows us to skip if for code blocks (aka `<code>` elements within `<pre>` elements).
Diffstat (limited to 'tests/unit/includes/BBCodeTest.php')
-rw-r--r--tests/unit/includes/BBCodeTest.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/unit/includes/BBCodeTest.php b/tests/unit/includes/BBCodeTest.php
index 54c35e67d..035bcbdc7 100644
--- a/tests/unit/includes/BBCodeTest.php
+++ b/tests/unit/includes/BBCodeTest.php
@@ -37,6 +37,10 @@ class BBCodeTest extends UnitTestCase {
private function html2bbcode_provider(): array {
return [
+ 'paragraph over multiple lines' => [
+ "<p>A paragraph over\nmultiple lines\nshould be unwrapped</p>",
+ 'A paragraph over multiple lines should be unwrapped'
+ ],
'image with alt text' => [
'<img src="https://example.com/image.jpg" alt="Alt text">',
'[img=https://example.com/image.jpg]Alt text[/img]'
@@ -45,6 +49,10 @@ class BBCodeTest extends UnitTestCase {
"<pre><code>some\ncode</code></pre>",
"[code]some\ncode[/code]"
],
+ 'code block with indentation' => [
+ "<pre><code>some\n indented\ncode</code></pre>",
+ "[code]some\n indented\ncode[/code]"
+ ],
];
}
}