From: Simon Elliott Date: Wed, 24 Mar 2010 20:17:33 +0000 (+0000) Subject: doctype test X-Git-Tag: release_0.009004~67^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4b4f6408880e2de12c1861e654233bdeb5a10236;p=catagits%2FHTML-Zoom.git doctype test --- diff --git a/t/doctype.t b/t/doctype.t new file mode 100644 index 0000000..b0e5e1b --- /dev/null +++ b/t/doctype.t @@ -0,0 +1,17 @@ +use strict; +use warnings FATAL => 'all'; +use Test::More qw(no_plan); + +use HTML::Zoom; +my $template = < + +HTML + +my $output = HTML::Zoom + ->from_html($template)->to_html; +my $expect = < + +HTML +is($output, $expect, 'Synopsis code works ok');; diff --git a/t/synopsis.t b/t/synopsis.t index 4089bf9..8a3ac11 100644 --- a/t/synopsis.t +++ b/t/synopsis.t @@ -1,3 +1,71 @@ +use strict; +use warnings FATAL => 'all'; use Test::More qw(no_plan); -fail 'You forgot to run maint/synopsis-extract. Go do that.'; +use HTML::Zoom; +my $template = < + + Hello people + + +

Placeholder

+
+ +

Name: Bob

+

Age: 23

+
+
+
+ + +HTML +my $output = HTML::Zoom + ->from_html($template) + ->select('title, #greeting')->replace_content('Hello world & dog!') + ->select('#list')->repeat_content( + [ + sub { + $_->select('.name')->replace_content('Matt') + ->select('.age')->replace_content('26') + }, + sub { + $_->select('.name')->replace_content('Mark') + ->select('.age')->replace_content('0x29') + }, + sub { + $_->select('.name')->replace_content('Epitaph') + ->select('.age')->replace_content('') + }, + ], + { repeat_between => '.between' } + ) + ->to_html; +my $expect = < + + Hello world & dog! + + +

Hello world & dog!

+
+ +

Name: Matt

+

Age: 26

+
+
+ +

Name: Mark

+

Age: 0x29

+
+
+ +

Name: Epitaph

+

Age: <redacted>

+
+ +
+ + +HTML +is($output, $expect, 'Synopsis code works ok');;