# -*-perl-*- use strict; use Test::More 'no_plan'; use lib "$ENV{LJHOME}/cgi-bin"; require 'ljlib.pl'; require 'cleanhtml.pl'; use HTMLCleaner; my $orig_post; my $clean_post; my $clean = sub { my $opts = shift; LJ::CleanHTML::clean_event(\$orig_post, $opts); }; # remove header tags $orig_post = qq{

test

testing this

testing again

}; $clean_post = qq{testtesting thistesting again}; $clean->({ remove_sizes => 1 }); ok($orig_post eq $clean_post, "Header tags removed"); # remove colors $orig_post = qq{test}; $clean_post = qq{test}; $clean->({ remove_colors => 1 }); ok($orig_post eq $clean_post, "Colors removed"); # remove colors and sizes $orig_post = qq{
test
}; $clean_post = qq{test}; $clean->({ remove_colors => 1, remove_sizes => 1 }); ok($orig_post eq $clean_post, "Colors and sizes removed"); # remove fonts and sizes $orig_post = qq{test}; $clean_post = qq{test}; $clean->({ remove_fonts => 1, remove_sizes => 1 }); ok($orig_post eq $clean_post, "Fonts and sizes removed"); # remove CSS colors $orig_post = qq{test}; $clean_post = qq{test<\\/span>}; $clean->({ remove_colors => 1 }); ok($orig_post =~ /^$clean_post$/, "CSS colors removed"); # remove CSS colors $orig_post = qq{test}; $clean_post = qq{test<\\/span>}; $clean->({ remove_colors => 1 }); ok($orig_post =~ /^$clean_post$/, "CSS colors removed"); # remove CSS colors and sizes $orig_post = qq{
test
}; $clean_post = qq{
test<\\/div>}; $clean->({ remove_colors => 1, remove_sizes => 1 }); ok($orig_post =~ /^$clean_post$/, "CSS colors and sizes removed"); # remove CSS fonts and sizes $orig_post = qq{
test
}; $clean_post = qq{
test<\\/div>}; $clean->({ remove_fonts => 1, remove_sizes => 1 }); ok($orig_post =~ /^$clean_post$/, "CSS fonts and sizes removed"); 1;