# -*-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 { $clean_post = $orig_post; LJ::CleanHTML::clean_event(\$clean_post, {tablecheck => 1}); }; # VALID: standard table $orig_post = "
Cell 1Cell 2
Cell 3Cell 4
"; $clean->(); ok($orig_post eq $clean_post, "Table okay if all tags are closed"); # VALID: table without closing tr/td tags $orig_post = "
Cell 1Cell 2
Cell 3Cell 4
"; $clean->(); ok($orig_post eq $clean_post, "Table okay if td and tr tags aren't closed"); # INVALID: table without opening table tag, should escape all tags $orig_post = "Cell 1Cell 2Cell 3Cell 4"; $clean->(); ok($clean_post !~ '(); ok($clean_post !~ '(); ok($clean_post !~ '(); ok($clean_post !~ '(); ok($clean_post !~ '(); ok($clean_post !~ '(); ok($clean_post eq "
foo
" || $clean_post eq "
foo
", "Fixed tbody -- optional");