X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=t%2Fmisc.t;fp=t%2Fmisc.t;h=2af0efc81f05523f9f00f3be102c7b94157d131e;hb=dbfa87a3950d2074807fee15619ae6c2a6cf8a67;hp=a0ae26cb7cefcf3350296f13d736b356e85478cc;hpb=e0dfa7be65c0072eff275132235091d71b40c4d7;p=html-element-library.git diff --git a/t/misc.t b/t/misc.t index a0ae26c..2af0efc 100644 --- a/t/misc.t +++ b/t/misc.t @@ -1,6 +1,6 @@ #!/usr/bin/perl -T use lib '.'; -use t::lib tests => 26; +use t::lib tests => 27; ################################################## # Short tests based on mklol @@ -123,6 +123,25 @@ isxml $tree, 't/html/dual_iter-exp.html', 'dual_iter'; ### +sub cb { + my ($data, $tr) = @_; + $tr->look_down(class => 'first')->replace_content($data->{first}); + $tr->look_down(class => 'last')->replace_content($data->{last}); + $tr->look_down(class => 'option')->replace_content($data->{option}); +} + +my @cbdata = ( + {first => 'Foo', last => 'Bar', option => 2}, + {first => 'Bar', last => 'Bar', option => 3}, + {first => 'Baz', last => 'Bar', option => 4}, +); + +$tree = mktree 't/html/itercb.html'; +$tree->find('table')->find('tbody')->find('tr')->itercb(\@cbdata, \&cb); +isxml $tree, 't/html/itercb-exp.html', 'itercb'; + +### + for my $age (qw/5 15 50/) { $tree = mktree 't/html/highlander.html'; $tree->highlander(