aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-11-03 12:38:38 +0100
committerArthurHoaro <arthur@hoa.ro>2020-11-03 12:43:35 +0100
commit740b32b520e6b1723512c6f9b78cef6575b1725b (patch)
tree01d976a30db84d4aa3cd2c0e6a429cc5ac15a187 /tests
parent38b55fbf3d4fdb515d0e82e5a3126d4671652b3e (diff)
downloadShaarli-740b32b520e6b1723512c6f9b78cef6575b1725b.tar.gz
Shaarli-740b32b520e6b1723512c6f9b78cef6575b1725b.tar.zst
Shaarli-740b32b520e6b1723512c6f9b78cef6575b1725b.zip
Default formatter: add a setting to disable auto-linkification
+ update documentation + single parameter for both URL and hashtags Fixes #1094
Diffstat (limited to 'tests')
-rw-r--r--tests/formatter/BookmarkDefaultFormatterTest.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/formatter/BookmarkDefaultFormatterTest.php b/tests/formatter/BookmarkDefaultFormatterTest.php
index 3fc6f8dc..4fcc5dd1 100644
--- a/tests/formatter/BookmarkDefaultFormatterTest.php
+++ b/tests/formatter/BookmarkDefaultFormatterTest.php
@@ -289,4 +289,24 @@ class BookmarkDefaultFormatterTest extends TestCase
289 $link['taglist_html'] 289 $link['taglist_html']
290 ); 290 );
291 } 291 }
292
293 /**
294 * Test default formatting with formatter_settings.autolink set to false:
295 * URLs and hashtags should not be transformed
296 */
297 public function testFormatDescriptionWithoutLinkification(): void
298 {
299 $this->conf->set('formatter_settings.autolink', false);
300 $this->formatter = new BookmarkDefaultFormatter($this->conf, false);
301
302 $bookmark = new Bookmark();
303 $bookmark->setDescription('Hi!' . PHP_EOL . 'https://thisisaurl.tld #hashtag');
304
305 $link = $this->formatter->format($bookmark);
306
307 static::assertSame(
308 'Hi!<br />' . PHP_EOL . 'https://thisisaurl.tld &nbsp;#hashtag',
309 $link['description']
310 );
311 }
292} 312}