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"> |
21 | <p>Stuff</p> |
22 | </div> |
23 | BODY |
24 | |
25 | my $output = $root |
26 | ->select('title') |
27 | ->replace_content('Hello World') |
28 | ->select('body') |
29 | ->replace_content($body) |
30 | ->to_html; |
31 | |
32 | |
33 | my $expect = <<HTML; |
34 | <html> |
35 | <head> |
36 | <title>Hello World</title> |
37 | </head> |
38 | <body><div id="stuff"> |
39 | <p>Stuff</p> |
40 | </div> |
41 | </body> |
42 | </html> |
43 | HTML |
44 | is($output, $expect, 'Synopsis code works ok'); |
45 | |