summaryrefslogtreecommitdiff
path: root/t/htmlbalance.t
blob: e5a5db0ee949e5b2935b03d49a4017a096a1c2c5 (plain)
  1. #!/usr/bin/perl
  2. use warnings;
  3. use strict;
  4. BEGIN {
  5. eval q{
  6. use HTML::TreeBuilder;
  7. };
  8. if ($@) {
  9. eval q{use Test::More skip_all => "HTML::TreeBuilder not available"};
  10. }
  11. else {
  12. eval q{use Test::More tests => 7};
  13. }
  14. use_ok("IkiWiki::Plugin::htmlbalance");
  15. }
  16. is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<br></br>"), "<br />");
  17. is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<div><p b=\"c\">hello world</div>"), "<div><p b=\"c\">hello world</p></div>");
  18. is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<a></a></a>"), "<a></a>");
  19. is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<b>foo <a</b>"), "<b>foo </b>");
  20. is(IkiWiki::Plugin::htmlbalance::sanitize(content => "<b> foo <a</a></b>"), "<b> foo </b>");
  21. is(IkiWiki::Plugin::htmlbalance::sanitize(content => "a>"), "a&gt;");