# 07_booleans.t use strict; use File::Spec; use Test::More tests => 9; BEGIN { $^W = 1 } use_ok( 'HTML::Scrubber' ); use HTML::Scrubber; my @allow = qw[ br hr b a option button th ]; my $scrubber = HTML::Scrubber->new(); $scrubber->allow( @allow ); $scrubber->default( undef, # don't change { # default attribute rules '/' => 1, # '/' ia boolean (stand-alone) attribute 'pie' => 1, 'selected' => 1, 'disabled' => 1, 'nowrap' => 1, } ); ok( $scrubber, "got scrubber"); test( q~
hi
~, q~
hi
~, "br /"); test( q~~, q~~, "selected"); test( q~~, q~~, "disabled"); test( q~~, q~~, "dd"); test( q~ | ~, q~ | ~, "pie"); test( q~ | ~, q~ | ~, "selected pie"); #dependent on version of HTML::Parser, after 0.36 1st is returned (ie pie) #test(q~
~, q~
~, 'repeated mixed'); test( q~~, q~~, "th nowrap=nowrap"); sub test { my ($in, $out, $name) = @_; is( $scrubber->scrub($in), $out, $name ); }