fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-02-15 04:07 am

[dw-free] http://bugs.dwscoalition.org/show_bug.cgi?id=3438

[commit: http://hg.dwscoalition.org/dw-free/rev/4b2067151089]

http://bugs.dwscoalition.org/show_bug.cgi?id=3438

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

Patch by [personal profile] fu.

Files modified:
  • t/clean-comment.t
  • t/clean-event.t
--------------------------------------------------------------------------------
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;
--------------------------------------------------------------------------------