X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fsynopsis.t;h=8a3ac11275a638dfa9e6fbb1953e1d6326d98432;hb=4b4f6408880e2de12c1861e654233bdeb5a10236;hp=4089bf9f2007bc3c29391eaaed2dc9ef871f2aa8;hpb=23ba49c7b5c3c7ded4c94547c3a2952a0319a81c;p=catagits%2FHTML-Zoom.git
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');;