Merge branch 'master' into people/jnap/migrate_xmltags
[catagits/HTML-Zoom.git] / t / bugs / void.t
diff --git a/t/bugs/void.t b/t/bugs/void.t
new file mode 100644 (file)
index 0000000..520f15c
--- /dev/null
@@ -0,0 +1,34 @@
+use strictures 1;
+use Test::More skip_all => 'TODO test';
+
+use HTML::Zoom;
+
+my $tmpl = <<END;
+<body>
+  <input class="main"/>
+</body>
+END
+
+my $tmpl2 = <<END;
+<body>
+  <div>cluck</div><input class="main"/>
+</body>
+END
+
+my $z = HTML::Zoom->from_html($tmpl);
+
+my $count = 0;
+$z->select('input')->collect({
+  filter => sub { $count++; $_ },
+  passthrough => 1,
+})->run;
+
+is($count, 1,"collect on void");
+
+is(
+  $z->select('input')
+  ->add_before(\"<div>cluck</div>")
+  ->to_html, $tmpl2,
+"added before void");
+
+done_testing;