Commit | Line | Data |
0d8f057e |
1 | use strict; |
2 | use warnings FATAL => 'all'; |
3 | use Test::More qw(no_plan); |
4 | |
5 | use HTML::Zoom; |
6 | my $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> |
16 | MAIN |
17 | |
18 | my $body = HTML::Zoom |
19 | ->from_html(<<BODY); |
20 | <div id="stuff"> |
adb30a8a |
21 | <p>Well Now</p> |
22 | <p>Is the Time</p> |
0d8f057e |
23 | </div> |
24 | BODY |
25 | |
26 | my $output = $root |
27 | ->select('title') |
28 | ->replace_content('Hello World') |
29 | ->select('body') |
30 | ->replace_content($body) |
adb30a8a |
31 | ->select('p') |
32 | ->set_attribute(class=>'para') |
0d8f057e |
33 | ->to_html; |
34 | |
35 | |
36 | my $expect = <<HTML; |
37 | <html> |
38 | <head> |
39 | <title>Hello World</title> |
40 | </head> |
41 | <body><div id="stuff"> |
adb30a8a |
42 | <p class="para">Well Now</p> |
43 | <p class="para">Is the Time</p> |
0d8f057e |
44 | </div> |
45 | </body> |
46 | </html> |
47 | HTML |
48 | is($output, $expect, 'Synopsis code works ok'); |
49 | |