]>
Commit | Line | Data |
---|---|---|
3dad7198 TB |
1 | # This might look like shell script, but it's actually -*- perl -*- |
2 | use strict; | |
3 | use lib qw(t/ t/m/); | |
4 | ||
5 | use File::Slurp; | |
6 | use Test::More qw(no_plan); | |
7 | ||
8 | use TestUtils; | |
9 | use HTML::TreeBuilder; | |
10 | use HTML::Element::Library; | |
11 | ||
12 | sub replace_age { | |
13 | my $branch = shift; | |
14 | my $age = shift; | |
15 | $branch->look_down(id => 'age')->replace_content($age); | |
16 | } | |
17 | ||
18 | ||
19 | sub tage { | |
20 | ||
21 | my $root = "t/html/same_as/same_as"; | |
22 | ||
23 | my $tree = HTML::TreeBuilder->new_from_file("$root.initial"); | |
24 | ||
9b7a5679 | 25 | #warn "TREE: $tree" . $tree->as_HTML; |
3dad7198 | 26 | |
d9f4bd5a TB |
27 | my %data = (people_id => 888, phone => '444-4444', email => 'm@xml.com'); |
28 | ||
29 | $tree->hash_map | |
30 | (hash => \%data, | |
31 | to_attr => 'sid', | |
32 | excluding => [ 'email' ], | |
33 | debug => 1 | |
34 | ); | |
3dad7198 TB |
35 | |
36 | my $generated_html = ptree($tree, "$root.gen"); | |
37 | ||
38 | is ($generated_html, File::Slurp::read_file("$root.exp"), "HTML for same_as"); | |
39 | } | |
40 | ||
41 | ||
42 | tage(); | |
43 |