use Test::More tests => 7; use strict; use warnings; use pQuery; # Test html() method # Test toHtml() method # Test with non DOM objects # Multiple is pQuery->html, undef, "html of empty object is undef"; is pQuery->toHtml, undef, "toHtml of empty object is undef"; is pQuery('

aaa bbb ccc

')->toHtml, '

aaa bbb ccc

', 'toHtml of single tree works'; is pQuery('

aaa bbb ccc

')->html, 'aaa bbb ccc', 'html of single tree works'; open FILE, 't/document1.html' or die $!; my $html = do {local $/; }; close FILE; chomp $html; my $html2 = pQuery($html)->toHtml; # XXX Work around HTML::TreeBuilder quirks $html2 =~ s{(?<=)\s*(?=\n)}{}; $html2 =~ s{(|)}{$1\n }g; is $html2, $html, 'toHtml output matches toHtml input'; my $html3 = '

Foo bar baz

'; is pQuery($html3)->toHtml, $html3, 'toHtml Snippet'; is pQuery($html3)->html, 'Foo bar baz', 'innerHTML works';