X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=t%2Fsame_as.t;fp=t%2Fsame_as.t;h=1fc78bae38e7fe4c304f491b5c9ab8da1ebb496a;hb=3dad7198e2d4d7e176428904ba6a4176726dc1f8;hp=0000000000000000000000000000000000000000;hpb=3c14ea1e4127f65aaf48989a5364977785b595cf;p=html-element-library.git diff --git a/t/same_as.t b/t/same_as.t new file mode 100644 index 0000000..1fc78ba --- /dev/null +++ b/t/same_as.t @@ -0,0 +1,38 @@ +# This might look like shell script, but it's actually -*- perl -*- +use strict; +use lib qw(t/ t/m/); + +use File::Slurp; +use Test::More qw(no_plan); + +use TestUtils; +use HTML::TreeBuilder; +use HTML::Element::Library; + +sub replace_age { + my $branch = shift; + my $age = shift; + $branch->look_down(id => 'age')->replace_content($age); +} + + +sub tage { + + my $root = "t/html/same_as/same_as"; + + my $tree = HTML::TreeBuilder->new_from_file("$root.initial"); + + warn "TREE: $tree" . $tree->as_HTML; + + my %data = (people_id => 888, phone => '444-4444', email => 'dont-you-dare-render@xml.com'); + + $tree->data_map(href => \%data, with_attr => 'sid', excluding => ['email']); + + my $generated_html = ptree($tree, "$root.gen"); + + is ($generated_html, File::Slurp::read_file("$root.exp"), "HTML for same_as"); +} + + +tage(); +