From: Simon Elliott Date: Wed, 17 Nov 2010 10:22:41 +0000 (+0000) Subject: test for broken void elements X-Git-Tag: release_0.009004~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FHTML-Zoom.git;a=commitdiff_plain;h=a5dc5af154aad9ddc3a5450185b13ff22db59634 test for broken void elements --- diff --git a/t/bugs/void_element.t b/t/bugs/void_element.t new file mode 100644 index 0000000..1af789a --- /dev/null +++ b/t/bugs/void_element.t @@ -0,0 +1,33 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use Test::More; +use HTML::Zoom; +use Test::Fatal; + +foreach my $void (qw/ area base br col command embed hr + img input keygen link meta param source wbr/) { + my $tmpla = < +
+ <$void class="void" src="moo"> +
+
+ <$void class="void" src="moo"> +
+ +END + my $ra; + is( + exception { + $ra = HTML::Zoom->from_html( $tmpla ) + ->select('.main')->replace_content('foo')->to_html; + }, + undef, + "Zoom didn't die for $void" + ); + #like( $ra, qr^
foo
^ ); +} + +done_testing;