Tests for the marquee and blink tags in entries and comments.

        Patch by fu. 

diffs (64 lines):

diff -r 4a6a3eab7ac1 -r 4b2067151089 t/clean-comment.t
--- a/t/clean-comment.t Tue Feb 15 11:32:12 2011 +0800
+++ b/t/clean-comment.t Tue Feb 15 11:32:13 2011 +0800
@@ -2,7 +2,7 @@
 
 use strict;
 use Test::More;
-plan tests => 13;
+plan tests => 16;
 
 use lib "$ENV{LJHOME}/cgi-bin";
 require 'ljlib.pl';
@@ -90,4 +90,24 @@ ok($orig_comment =~ /^$clean_comment$/, 
 $clean->({ anon_comment => 1 });
 ok($orig_comment =~ /^$clean_comment$/, "Background URL removed: anonymous 
comment");
 
+
+note( "various allowed/disallowed tags" );
+{
+    $orig_comment  = qq{<em>abc</em>};
+    $clean_comment = qq{<em>abc</em>};
+    $clean->();
+    is( $orig_comment, $clean_comment, "em tag allowed" );
+
+    $orig_comment  = qq{<marquee>abc</marquee>};
+    $clean_comment = qq{abc};
+    $clean->();
+    is( $orig_comment, $clean_comment, "marquee tag not allowed" );
+
+    $orig_comment  = qq{<blink>abc</blink>};
+    $clean_comment = qq{abc};
+    $clean->();
+    is( $orig_comment, $clean_comment, "blink tag not allowed" );
+
+}
+
 1;
diff -r 4a6a3eab7ac1 -r 4b2067151089 t/clean-event.t
--- a/t/clean-event.t   Tue Feb 15 11:32:12 2011 +0800
+++ b/t/clean-event.t   Tue Feb 15 11:32:13 2011 +0800
@@ -179,4 +179,23 @@ note("<object> and <embed> tags");
 $clean->();
 is( $orig_post, $clean_post, "<object> and <embed> tags" );
 
+
+note( "various allowed/disallowed tags" );
+{
+    $orig_post  = qq{<em>abc</em>};
+    $clean_post = qq{<em>abc</em>};
+    $clean->();
+    is( $orig_post, $clean_post, "em tag allowed" );
+
+    $orig_post  = qq{<marquee>abc</marquee>};
+    $clean_post = qq{<marquee>abc</marquee>};
+    $clean->();
+    is( $orig_post, $clean_post, "marquee tag allowed" );
+
+    $orig_post  = qq{<blink>abc</blink>};
+    $clean_post = qq{<blink>abc</blink>};
+    $clean->();
+    is( $orig_post, $clean_post, "blink tag allowed" );
+
+}
 1;
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to