hash_map method about to be public for real
[html-element-library.git] / t / same_as.t
CommitLineData
3dad7198
TB
1# This might look like shell script, but it's actually -*- perl -*-
2use strict;
3use lib qw(t/ t/m/);
4
5use File::Slurp;
6use Test::More qw(no_plan);
7
8use TestUtils;
9use HTML::TreeBuilder;
10use HTML::Element::Library;
11
12sub replace_age {
13 my $branch = shift;
14 my $age = shift;
15 $branch->look_down(id => 'age')->replace_content($age);
16}
17
18
19sub 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
TB
26
27 my %data = (people_id => 888, phone => '444-4444', email => 'dont-you-dare-render@xml.com');
28
9b7a5679 29 $tree->hash_map(hash => \%data, to_attr => 'sid', excluding => ['email']);
3dad7198
TB
30
31 my $generated_html = ptree($tree, "$root.gen");
32
33 is ($generated_html, File::Slurp::read_file("$root.exp"), "HTML for same_as");
34}
35
36
37tage();
38
This page took 0.010694 seconds and 4 git commands to generate.