]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - t/htmlbalance.t
Announce 3.20160506
[git.ikiwiki.info.git] / t / htmlbalance.t
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
5 BEGIN {
6         eval q{
7                 use HTML::TreeBuilder;
8         };
9         if ($@) {
10                 eval q{use Test::More skip_all => "HTML::TreeBuilder not available"};
11         }
12         else {
13                 eval q{use Test::More tests => 7};
14         }
15         use_ok("IkiWiki::Plugin::htmlbalance");
16 }
18 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<br></br>"), "<br />");
19 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<div><p b=\"c\">hello world</div>"), "<div><p b=\"c\">hello world</p></div>");
20 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<a></a></a>"), "<a></a>");
21 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<b>foo <a</b>"), "<b>foo </b>");
22 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<b> foo <a</a></b>"), "<b> foo </b>");
23 is(IkiWiki::Plugin::htmlbalance::sanitize(content => "a>"), "a&gt;");