# -*-perl-*- use strict; use Test::More 'no_plan'; use lib "$ENV{LJHOME}/cgi-bin"; require 'ljlib.pl'; require 'cleanhtml.pl'; use LJ::Test qw (temp_user); use HTMLCleaner; my $post; my $clean_post; my $clean = sub { $clean_post = $post; LJ::CleanHTML::clean_event(\$clean_post); }; $post = "bold text"; $clean->(); is($clean_post, $post, "Valid HTML is okay."); $post = "blah blah"; $clean->(); is($clean_post, qq {
[Error: Irreparable invalid markup ('<color="ff0000">') in entry. Owner must fix manually. Raw contents below.]

} . LJ::ehtml($post) . "
", "Invalid HTML is not okay."); my $u = temp_user(); $post = "user . "\">"; $clean->(); is($clean_post, $u->ljuser_display, "User tag is fine."); my $u = temp_user(); $post = "user . "\"> and some text blah blah"; $clean->(); is($clean_post, $u->ljuser_display . qq { and some text
[Error: Irreparable invalid markup ('<color="ff0000">') in entry. Owner must fix manually. Raw contents below.]

} . LJ::ehtml($post) . "
", "Invalid markup with a user tag renders correctly.");