X-Git-Url: http://git.maemo.org/git/?p=dh-make-perl;a=blobdiff_plain;f=dev%2Fi386%2Flibhtml-tree-perl%2Flibhtml-tree-perl-3.23%2Ft%2Ftag-rendering.t;fp=dev%2Fi386%2Flibhtml-tree-perl%2Flibhtml-tree-perl-3.23%2Ft%2Ftag-rendering.t;h=c030e2b6aeab023281db3193dc209e558f6ceb86;hp=0000000000000000000000000000000000000000;hb=8977e561d8a9eae6959218b0306c9df2056a38a9;hpb=df794b845212301ea0d267c919232538bfef356a diff --git a/dev/i386/libhtml-tree-perl/libhtml-tree-perl-3.23/t/tag-rendering.t b/dev/i386/libhtml-tree-perl/libhtml-tree-perl-3.23/t/tag-rendering.t new file mode 100644 index 0000000..c030e2b --- /dev/null +++ b/dev/i386/libhtml-tree-perl/libhtml-tree-perl-3.23/t/tag-rendering.t @@ -0,0 +1,40 @@ +#!perl -w + +use Test::More tests => 8; +use strict; + +BEGIN { + use_ok( "HTML::Element" ); +} + + +my $img = + HTML::Element->new( 'img', ( + src => 'damian-conway-in-a-dress.jpg', + height=>540, width=>100, border=>0, + alt => "A few bottles of Chech'tluth later...", + ) ); + +my $href = '/report/fullcsv'; +my $literal_href = HTML::Element->new( + '~literal', 'text' => "window.location.href='$href'" + ); +$img->attr(onClick => $literal_href); + + + + +isa_ok( $img, 'HTML::Element' ); +my $html = $img->as_HTML; +print $html, "\n"; + +like( $html, qr//, "Tag is self-closed" ); +like( $html, qr/ height="540" /, "Height is quoted" ); +like( $html, qr/ border="0" /, "Border is quoted" ); +like( $html, qr/ width="100" /, "Width is quoted" ); +like( + $html, + qr! onclick="window.location.href='$href'!, + "Literal text is preserved" + ); +like( $html, qr/ alt="A few bottles of Chech'tluth later..." /, "Alt tag is quoted and escaped" );