]> git.mxchange.org Git - friendica.git/blobdiff - tests/src/Content/Text/BBCodeTest.php
Normalize [ul] and [ol] BBCode output to <ul> and <ol> HTML tags
[friendica.git] / tests / src / Content / Text / BBCodeTest.php
index 16cbec330acea4f508649c804d1d180f60a338ef..698b37e70001ee4b5fa50b3c8007c06f4e2d9a49 100644 (file)
@@ -158,21 +158,21 @@ class BBCodeTest extends FixtureTest
        {
                return [
                        'bug-7271-condensed-space' => [
-                               'expectedHtml' => '<ul class="listdecimal" style="list-style-type:decimal;"><li> <a href="http://example.com/" target="_blank" rel="noopener noreferrer">http://example.com/</a></li></ul>',
+                               'expectedHtml' => '<ol><li> <a href="http://example.com/" target="_blank" rel="noopener noreferrer">http://example.com/</a></li></ol>',
                                'text' => '[ol][*] http://example.com/[/ol]',
                        ],
                        'bug-7271-condensed-nospace' => [
-                               'expectedHtml' => '<ul class="listdecimal" style="list-style-type:decimal;"><li><a href="http://example.com/" target="_blank" rel="noopener noreferrer">http://example.com/</a></li></ul>',
+                               'expectedHtml' => '<ol><li><a href="http://example.com/" target="_blank" rel="noopener noreferrer">http://example.com/</a></li></ol>',
                                'text' => '[ol][*]http://example.com/[/ol]',
                        ],
                        'bug-7271-indented-space' => [
-                               'expectedHtml' => '<ul class="listbullet" style="list-style-type:circle;"><li> <a href="http://example.com/" target="_blank" rel="noopener noreferrer">http://example.com/</a></li></ul>',
+                               'expectedHtml' => '<ul><li> <a href="http://example.com/" target="_blank" rel="noopener noreferrer">http://example.com/</a></li></ul>',
                                'text' => '[ul]
 [*] http://example.com/
 [/ul]',
                        ],
                        'bug-7271-indented-nospace' => [
-                               'expectedHtml' => '<ul class="listbullet" style="list-style-type:circle;"><li><a href="http://example.com/" target="_blank" rel="noopener noreferrer">http://example.com/</a></li></ul>',
+                               'expectedHtml' => '<ul><li><a href="http://example.com/" target="_blank" rel="noopener noreferrer">http://example.com/</a></li></ul>',
                                'text' => '[ul]
 [*]http://example.com/
 [/ul]',
@@ -221,7 +221,7 @@ class BBCodeTest extends FixtureTest
                                'text' => '[test] Space',
                        ],
                        'task-8800-pre-spaces' => [
-                               'expectedHtml' => '    Spaces',
+                               'expectedHtml' => '    Spaces',
                                'text' => '[pre]    Spaces[/pre]',
                        ],
                        'bug-9611-purify-xss-nobb' => [
@@ -257,6 +257,14 @@ Karl Marx - Die ursprüngliche Akkumulation
                        'task-10886-deprecate-class' => [
                                'expectedHTML' => '<span class="mastodon emoji"><img src="https://fedi.underscore.world/emoji/custom/custom/heart_nb.png" alt=":heart_nb:" title=":heart_nb:"></span>',
                                'text' => '[emoji=https://fedi.underscore.world/emoji/custom/custom/heart_nb.png]:heart_nb:[/emoji]',
+                       ],
+                       'task-12900-multiple-paragraphs' => [
+                               'expectedHTML' => '<h1>Header</h1><ul><li>One</li><li>Two</li></ul><p>This is a paragraph<br>with a line feed.</p><p>Second Chapter</p>',
+                               'text' => "[h1]Header[/h1][ul][*]One[*]Two[/ul]\n\nThis is a paragraph\nwith a line feed.\n\nSecond Chapter",
+                       ],
+                       'task-12900-header-with-paragraphs' => [
+                               'expectedHTML' => '<h1>Header</h1><p>Some Chapter</p>',
+                               'text' => '[h1]Header[/h1]Some Chapter',
                        ]
                ];
        }
@@ -274,8 +282,9 @@ Karl Marx - Die ursprüngliche Akkumulation
         *
         * @throws InternalServerErrorException
         */
-       public function testConvert(string $expectedHtml, string $text, $try_oembed = false, int $simpleHtml = 0, bool $forPlaintext = false)
+       public function testConvert(string $expectedHtml, string $text, bool $try_oembed = true, int $simpleHtml = BBCode::INTERNAL, bool $forPlaintext = false)
        {
+               // This assumes system.remove_multiplicated_lines = false
                $actual = BBCode::convert($text, $try_oembed, $simpleHtml, $forPlaintext);
 
                self::assertEquals($expectedHtml, $actual);