From 3ce20d9e84a715c6890988999a8ecac210a42d9c Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Mon, 21 Mar 2016 18:46:34 +0100 Subject: Markdown: Add the 'meta-tag' `.nomarkdown` which prevent a shaare from being parsed with markdown Also add the tag in tag list in edit_link, so it will appear on autocompletion. --- tests/plugins/PluginMarkdownTest.php | 37 +++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/plugins/PluginMarkdownTest.php b/tests/plugins/PluginMarkdownTest.php index 8e1a128a..fa7e1d52 100644 --- a/tests/plugins/PluginMarkdownTest.php +++ b/tests/plugins/PluginMarkdownTest.php @@ -102,7 +102,8 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase /** * Test sanitize_html(). */ - function testSanitizeHtml() { + function testSanitizeHtml() + { $input = '< script src="js.js"/>'; $input .= '< script attr>alert(\'xss\');'; $input .= ''; @@ -114,4 +115,38 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase $input = escape($input); $this->assertEquals($input, sanitize_html($input)); } + + /** + * Test the no markdown tag. + */ + function testNoMarkdownTag() + { + $str = 'All _work_ and `no play` makes Jack a *dull* boy.'; + $data = array( + 'links' => array(array( + 'description' => $str, + 'tags' => NO_MD_TAG + )) + ); + + $data = hook_markdown_render_linklist($data); + $this->assertEquals($str, $data['links'][0]['description']); + + $data = array( + // Columns data + 'cols' => array( + // First, second, third. + 0 => array( + // nth link + 0 => array( + 'formatedDescription' => $str, + 'tags' => NO_MD_TAG + ), + ), + ), + ); + + $data = hook_markdown_render_daily($data); + $this->assertEquals($str, $data['cols'][0][0]['formatedDescription']); + } } -- cgit v1.2.3