test for collect on void element
[catagits/HTML-Zoom.git] / t / bugs / void.t
CommitLineData
533bdc1b 1use strictures 1;
9524c2f1 2use Test::More skip_all => 'TODO test';
533bdc1b 3
4use HTML::Zoom;
5
6my $tmpl = <<END;
7<body>
8 <input class="main"/>
9</body>
10END
11
12my $tmpl2 = <<END;
13<body>
14 <div>cluck</div><input class="main"/>
15</body>
16END
17
18my $z = HTML::Zoom->from_html($tmpl);
e1d0e35c 19
20my $count = 0;
21$z->select('input')->collect({
22 filter => sub { $count++; $_ },
23 passthrough => 1,
24})->run;
25
26is($count, 1,"collect on void");
27
533bdc1b 28is(
29 $z->select('input')
30 ->add_before(\"<div>cluck</div>")
31 ->to_html, $tmpl2,
32"added before void");
33
34done_testing;