replace Makefile.PL with dist.ini
[catagits/HTML-Zoom.git] / t / apply.t
CommitLineData
fdb039c6 1use strict;
2use warnings FATAL => 'all';
3use Test::More 'no_plan';
4
5use HTML::Zoom;
6
7my $template = <<HTML;
8<html>
9 <body></body>
10</html>
11HTML
12
13my $expect = <<HTML;
14<html>
15 <body>Hello</body>
16</html>
17HTML
18
19my $output = HTML::Zoom
20 ->from_html($template)
21 ->apply_if(1, sub { $_->select('body')->replace_content('Hello') })
22 ->to_html;
23
24is( $output => $expect, 'apply_if with a true predicate' );
25
26$output = HTML::Zoom
27 ->from_html($template)
28 ->apply_if(0, sub { $_->select('body')->replace_content('Hello') })
29 ->to_html;
30
31is( $output => $template, 'apply_if with a false predicate' );