Add test for 'flush_before' option
[catagits/HTML-Zoom.git] / t / actions.t
index 1267bd3..584ec36 100644 (file)
@@ -18,9 +18,9 @@ my $tmpl = <<END;
 </body>
 END
 
-sub src_stream { HTML::Zoom::Parser::BuiltIn->html_to_stream($tmpl); }
+sub src_stream { HTML::Zoom::Parser::BuiltIn->new->html_to_stream($tmpl); }
 
-sub html_sink { HTML::Zoom::Producer::BuiltIn->html_from_stream($_[0]) }
+sub html_sink { HTML::Zoom::Producer::BuiltIn->new->html_from_stream($_[0]) }
 
 my $fb = HTML::Zoom::FilterBuilder->new;
 
@@ -67,7 +67,7 @@ is(
 ($expect = $tmpl) =~ s/class="main"/class="main foo"/;
 
 is(
-  run_for { $_->add_attribute({ name => 'class', value => 'foo' }) },
+  run_for { $_->add_to_attribute({ name => 'class', value => 'foo' }) },
   $expect,
   'add attribute on existing attribute'
 );
@@ -75,7 +75,7 @@ is(
 ($expect = $tmpl) =~ s/class="main"/class="main" foo="bar"/;
 
 is(
-  run_for { $_->add_attribute({ name => 'foo', value => 'bar' }) },
+  run_for { $_->add_to_attribute({ name => 'foo', value => 'bar' }) },
   $expect,
   'add attribute on non existing attribute'
 );
@@ -268,12 +268,12 @@ is(
     $_->repeat_content(
       [
         sub {
-          HTML::Zoom::CodeStream->from_array(
+          HTML::Zoom::ArrayStream->new({ array => [
             (filter
               filter($_ => '.name' => $r_content->('mst'))
               => '.career' => $r_content->('Chainsaw Wielder')),
-            HTML::Zoom::CodeStream->from_array(@between)
-          )->flatten
+            HTML::Zoom::ArrayStream->new({ array => \@between })
+          ] })->flatten
         },
         sub {
           filter