slightly more clean separation of duties
[catagits/HTML-Zoom.git] / t / tags_as_zoom_events.t
index 7bbb1ca..9befab4 100644 (file)
@@ -58,24 +58,25 @@ use HTML::Zoom;
     return @{$data{content}};
   }
 
-  sub as_html {
+  sub merge_layout {
     my ($template, %data) = @_;
-    my @content = process_templates([$template, \&layout], %data);
-    return join '', HTML::Tags::to_html_string(@content);
+    process_templates([$template, \&layout], %data);
+  }
+
+  sub as_html {
+    join '', HTML::Tags::to_html_string(&merge_layout(@_));
   }
 
   sub as_events {
-    my ($template, %data) = @_;
-    my @content = process_templates([$template, \&layout], %data);
-    return [HTML::Tags::to_zoom_events(@content)];
+    HTML::Tags::to_zoom_events(&merge_layout(@_));
   }
 }
 
 ok my $html = BasicPage->show_landing_html;
 ok my $zoom = HTML::Zoom->from_html($html);
-ok my $events = BasicPage->show_landing_events;
+ok my @events = BasicPage->show_landing_events;
 
-is_deeply $zoom->to_events, $events,
+is_deeply $zoom->to_events, \@events,
   'Made HZoom events from XMLTags';
 
 #use Data::Dump 'dump';
@@ -84,4 +85,10 @@ is_deeply $zoom->to_events, $events,
 #warn "======================";
 #warn dump $events;
 
+use HTML::Tags;
+my @a = map { "$_" } (<html>,"Hi",</html>);
+
+warn @a;
+
+
 done_testing();