summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-07-08 06:59:55 +0200
committerDylan William Hardison <dylan@hardison.net>2018-07-08 06:59:55 +0200
commitbe1f92450788dc89280c9e04a4bf983b5d7fac54 (patch)
treeb5513fd846597fe5f152177dbbda88dca08fdf5f /t
parent9bbd8d368598046c47964ee043620621b6c3634b (diff)
parent446a08b30b0dbaac9f2b88e0a5cad410f0446140 (diff)
downloadbugzilla-be1f92450788dc89280c9e04a4bf983b5d7fac54.tar.gz
bugzilla-be1f92450788dc89280c9e04a4bf983b5d7fac54.tar.xz
Merge remote-tracking branch 'bmo/master'
Diffstat (limited to 't')
-rw-r--r--t/008filter.t3
-rw-r--r--t/markdown.t73
2 files changed, 76 insertions, 0 deletions
diff --git a/t/008filter.t b/t/008filter.t
index cae1e6880..443fb2b4f 100644
--- a/t/008filter.t
+++ b/t/008filter.t
@@ -147,6 +147,9 @@ sub directive_ok {
$directive =~ s/^\s*//;
$directive =~ s/\s*$//;
+ # Ignore blocks explicitly marked as ok
+ return 1 if $directive =~ /\b## no-008filter\b/;
+
# Empty directives are ok; they are usually line break helpers
return 1 if $directive eq '';
diff --git a/t/markdown.t b/t/markdown.t
new file mode 100644
index 000000000..0344706c9
--- /dev/null
+++ b/t/markdown.t
@@ -0,0 +1,73 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This Source Code Form is "Incompatible With Secondary Licenses", as
+# defined by the Mozilla Public License, v. 2.0.
+use 5.10.1;
+use strict;
+use warnings;
+use lib qw( . lib local/lib/perl5 );
+use Bugzilla;
+use Test::More;
+
+my $parser = Bugzilla->markdown_parser;
+
+is(
+ $parser->render_html('# header'),
+ "<h1>header</h1>\n",
+ 'Simple header'
+);
+
+is(
+ $parser->render_html('`code snippet`'),
+ "<p><code>code snippet</code></p>\n",
+ 'Simple code snippet'
+);
+
+is(
+ $parser->render_html('http://bmo-web.vm'),
+ "<p><a href=\"http://bmo-web.vm\">http://bmo-web.vm</a></p>\n",
+ 'Autolink extension'
+);
+
+is(
+ $parser->render_html('<script>hijack()</script>'),
+ "&lt;script>hijack()&lt;/script>\n",
+ 'Tagfilter extension'
+);
+
+is(
+ $parser->render_html('~~strikethrough~~'),
+ "<p><del>strikethrough</del></p>\n",
+ 'Strikethrough extension'
+);
+
+my $table_markdown = <<'MARKDOWN';
+| Col1 | Col2 |
+| ---- |:----:|
+| val1 | val2 |
+MARKDOWN
+
+my $table_html = <<'HTML';
+<table>
+<thead>
+<tr>
+<th>Col1</th>
+<th align="center">Col2</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>val1</td>
+<td align="center">val2</td>
+</tr></tbody></table>
+HTML
+
+is(
+ $parser->render_html($table_markdown),
+ $table_html,
+ 'Table extension'
+);
+
+done_testing;