Added test to demonstrate bug
[catagits/HTML-Zoom.git] / t / bugs / repeat_replace_on_empty_tag.t
CommitLineData
0e082da7 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More;
7
8use HTML::Zoom;
9
10my $tmpla = <<END;
11<body>
12 <div class="main"></div>
13</body>
14END
15
16
17my $tmplb = <<END;
18<body>
19 <div class="main" />
20</body>
21END
22
23my $ra = HTML::Zoom->from_html( $tmpla )->select('.main')->repeat( [
24 sub{
25 $_->select('div')->replace_content('foo');
26 }
27])->to_html;
28
29like( $ra, qr^<div class="main">foo</div>^ );
30
31
32my $rb = HTML::Zoom->from_html( $tmplb )->select('.main')->repeat( [
33 sub{
34 $_->select('div')->replace_content('foo');
35 }
36])->to_html;
37
38like( $rb, qr^<div class="main">foo</div>^);
39
40done_testing;