2008-11-16 19:11:39 +01:00
|
|
|
#!/usr/bin/perl
|
|
|
|
use warnings;
|
|
|
|
use strict;
|
|
|
|
|
2008-11-17 20:22:11 +01:00
|
|
|
BEGIN {
|
|
|
|
eval q{
|
|
|
|
use HTML::TreeBuilder;
|
|
|
|
};
|
|
|
|
if ($@) {
|
2008-11-17 20:27:11 +01:00
|
|
|
eval q{use Test::More skip_all => "HTML::TreeBuilder not available"};
|
2008-11-17 20:22:11 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
eval q{use Test::More tests => 7};
|
|
|
|
}
|
|
|
|
use_ok("IkiWiki::Plugin::htmlbalance");
|
|
|
|
}
|
2008-11-16 19:11:39 +01:00
|
|
|
|
|
|
|
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>");
|