Add tests for font size handling in comments.

        Patch by fu. 

diffs (38 lines):

diff -r 9135a526692e -r bf94c5f272c4 t/clean-comment.t
--- a/t/clean-comment.t Mon Feb 07 16:47:39 2011 +0800
+++ b/t/clean-comment.t Tue Feb 15 11:32:10 2011 +0800
@@ -2,7 +2,7 @@
 
 use strict;
 use Test::More;
-plan tests => 10;
+plan tests => 13;
 
 use lib "$ENV{LJHOME}/cgi-bin";
 require 'ljlib.pl';
@@ -59,6 +59,25 @@ ok($orig_comment =~/^$clean_comment$/, "
 $clean->({ remove_positioning => 1 });
 ok($orig_comment =~ /^$clean_comment$/, "Padding not removed; of reasonable 
size.");
 
+note( "Clean absolute sizes" );
+{
+    $orig_comment  = qq{<span style="font-size: larger">foo</span>};
+    $clean_comment = qq{<span style="font-size: larger">foo</span>};
+    $clean->();
+    is( $orig_comment, $clean_comment, "Retain relative font sizes" );
+
+    $orig_comment  = qq{<span style="font-size:   10px  ">foo</span>};
+    $clean_comment = qq{<span style="">foo</span>};
+    $clean->();
+    is( $orig_comment, $clean_comment, "Strip absolute font sizes" );
+
+    $orig_comment  = qq{<span style="font-size:0.2em; font-weight: 
bold">foo</span>};
+    $clean_comment = qq{<span style=" font-weight: bold">foo</span>};
+    $clean->();
+    is( $orig_comment, $clean_comment, "Strip absolute font sizes" );
+
+
+}
 
 # remove background urls from logged out users
 $orig_comment = qq{<span style="background: 
url('http://www.example.com/example.gif');"></span>};
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to