aboutsummaryrefslogtreecommitdiff
path: root/t/htmlbalance.t
blob: e5a5db0ee949e5b2935b03d49a4017a096a1c2c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/perl
use warnings;
use strict;

BEGIN {
	eval q{
		use HTML::TreeBuilder;
	};
	if ($@) {
		eval q{use Test::More skip_all => "HTML::TreeBuilder not available"};
	}
	else {
		eval q{use Test::More tests => 7};
	}
	use_ok("IkiWiki::Plugin::htmlbalance");
}

is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<br></br>"), "<br />");
is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<div><p b=\"c\">hello world</div>"), "<div><p b=\"c\">hello world</p></div>");
is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<a></a></a>"), "<a></a>");
is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<b>foo <a</b>"), "<b>foo </b>");
is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<b> foo <a</a></b>"), "<b> foo </b>");
is(IkiWiki::Plugin::htmlbalance::sanitize(content => "a>"), "a&gt;");