aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/plugins
diff options
context:
space:
mode:
authorArthur <arthur@hoa.ro>2016-03-26 16:46:04 +0100
committerArthur <arthur@hoa.ro>2016-03-26 16:46:04 +0100
commit1a84bf1e2bc45787d9cfa81fa427a11a3aba623a (patch)
treef9b72b6048b2ba2ab9e6a972a0a238e49e2882f1 /tests/plugins
parentf66a1990e5d93a6f302ce594968e5e717b93da72 (diff)
parent340252ae5de67f46ad43793858532da0cce8b4e2 (diff)
downloadShaarli-1a84bf1e2bc45787d9cfa81fa427a11a3aba623a.tar.gz
Shaarli-1a84bf1e2bc45787d9cfa81fa427a11a3aba623a.tar.zst
Shaarli-1a84bf1e2bc45787d9cfa81fa427a11a3aba623a.zip
Merge pull request #520 from ArthurHoaro/plugins/nomarkdown
Markdown: Add the 'meta-tag' `.nomarkdown` which prevent a shaare fro…
Diffstat (limited to 'tests/plugins')
-rw-r--r--tests/plugins/PluginMarkdownTest.php37
1 files changed, 36 insertions, 1 deletions
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
102 /** 102 /**
103 * Test sanitize_html(). 103 * Test sanitize_html().
104 */ 104 */
105 function testSanitizeHtml() { 105 function testSanitizeHtml()
106 {
106 $input = '< script src="js.js"/>'; 107 $input = '< script src="js.js"/>';
107 $input .= '< script attr>alert(\'xss\');</script>'; 108 $input .= '< script attr>alert(\'xss\');</script>';
108 $input .= '<style> * { display: none }</style>'; 109 $input .= '<style> * { display: none }</style>';
@@ -114,4 +115,38 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
114 $input = escape($input); 115 $input = escape($input);
115 $this->assertEquals($input, sanitize_html($input)); 116 $this->assertEquals($input, sanitize_html($input));
116 } 117 }
118
119 /**
120 * Test the no markdown tag.
121 */
122 function testNoMarkdownTag()
123 {
124 $str = 'All _work_ and `no play` makes Jack a *dull* boy.';
125 $data = array(
126 'links' => array(array(
127 'description' => $str,
128 'tags' => NO_MD_TAG
129 ))
130 );
131
132 $data = hook_markdown_render_linklist($data);
133 $this->assertEquals($str, $data['links'][0]['description']);
134
135 $data = array(
136 // Columns data
137 'cols' => array(
138 // First, second, third.
139 0 => array(
140 // nth link
141 0 => array(
142 'formatedDescription' => $str,
143 'tags' => NO_MD_TAG
144 ),
145 ),
146 ),
147 );
148
149 $data = hook_markdown_render_daily($data);
150 $this->assertEquals($str, $data['cols'][0][0]['formatedDescription']);
151 }
117} 152}