diff options
Diffstat (limited to 'tests/unit/includes/BBCodeTest.php')
-rw-r--r-- | tests/unit/includes/BBCodeTest.php | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/unit/includes/BBCodeTest.php b/tests/unit/includes/BBCodeTest.php index daa66bf72..136fc6e0e 100644 --- a/tests/unit/includes/BBCodeTest.php +++ b/tests/unit/includes/BBCodeTest.php @@ -138,7 +138,23 @@ class BBCodeTest extends UnitTestCase { 'del tag' => [ 'some [s]strike through[/s] text', 'some <del>strike through</del> text' - ] + ], + 'naked url is converted to link' => [ + 'example url: https://example.com', + 'example url: <a href="https://example.com" target="_blank" rel="nofollow noopener">https://example.com</a>' + ], + 'naked url followed by newline' => [ + "https://www.example.com\nhave a great day.", + '<a href="https://www.example.com" target="_blank" rel="nofollow noopener">https://www.example.com</a><br />have a great day.', + ], + 'inline naked url' => [ + "This is a link https://example.com/some/path more info.", + 'This is a link <a href="https://example.com/some/path" target="_blank" rel="nofollow noopener">https://example.com/some/path</a> more info.', + ], + 'naked url within code block is not converted to link' => [ + "[code]\nhttp://example.com\n[/code]", + "<pre><code>http://example.com</code></pre>" + ], ]; } @@ -223,6 +239,10 @@ class BBCodeTest extends UnitTestCase { "<pre><code>some\n indented\ncode</code></pre>", "[code]some\n indented\ncode[/code]" ], + 'code block with URL' => [ + '<pre><code>\nproxy_pass http://example.com\n</code></pre>', + '[code]\nproxy_pass http://example.com\n[/code]' + ], 'paragraph with a mention and some text' => [ '<p><span class="h-card" translate="no"><a href="https://example.org/@profile" class="u-url mention">@<span>profile</span></a></span> some content</p>', '[url=https://example.org/@profile]@profile[/url] some content' @@ -266,6 +286,10 @@ class BBCodeTest extends UnitTestCase { 'del tag' => [ 'some <del>strike through</del> text', 'some [s]strike through[/s] text' + ], + 'table' => [ + '<table><tr><td>row1, col1</td><td>row1, col2</td></tr><tr><td>row2, col1</td><td>row2, col2</td></tr></table>', + '[table][tr][td]row1, col1[/td][td]row1, col2[/td][/tr][tr][td]row2, col1[/td][td]row2, col2[/td][/tr][/table]' ] ]; } |