started to fill out the set_attribute stub
[catagits/HTML-Zoom.git] / t / synopsis / filterbuilder.t
CommitLineData
0d8f057e 1use strict;
2use warnings FATAL => 'all';
3use Test::More qw(no_plan);
4
5use HTML::Zoom;
6my $root = HTML::Zoom
7 ->from_html(<<MAIN);
8<html>
9 <head>
10 <title>Default Title</title>
11 </head>
12 <body>
13 Default Content
14 </body>
15</html>
16MAIN
17
18my $body = HTML::Zoom
19 ->from_html(<<BODY);
20<div id="stuff">
adb30a8a 21 <p>Well Now</p>
f8ad684d 22 <p id="p2">Is the Time</p>
0d8f057e 23</div>
24BODY
25
26my $output = $root
f8ad684d 27 ->select('title')
28 ->replace_content('Hello World')
29 ->select('body')
30 ->replace_content($body)
31 ->then
32 ->set_attribute(class=>'main')
33 ->select('p')
34 ->set_attribute(class=>'para')
35 ->select('#p2')
36 ->set_attribute(class=>'para2')
37 ->to_html;
0d8f057e 38
39
40my $expect = <<HTML;
41<html>
42 <head>
43 <title>Hello World</title>
44 </head>
f8ad684d 45 <body class="main"><div id="stuff">
adb30a8a 46 <p class="para">Well Now</p>
f8ad684d 47 <p id="p2" class="para2">Is the Time</p>
0d8f057e 48</div>
49</body>
50</html>
51HTML
52is($output, $expect, 'Synopsis code works ok');
53