#!/usr/bin/perl -T
use lib '.';
-use t::lib tests => 26;
+use t::lib tests => 27;
##################################################
# Short tests based on mklol
$tree = mktree 't/html/crunch.html';
$tree->crunch(look_down => [ class => 'imageElement' ], leave => 1);
-isxml $tree, 't/html/crunch.exp', 'crunch';
+isxml $tree, 't/html/crunch-exp.html', 'crunch';
$tree = mktree 't/html/defmap.html';
$tree->defmap(smap => {pause => 'arsenal rules'}, $ENV{TEST_VERBOSE});
-isxml $tree, 't/html/defmap.exp', 'defmap';
+isxml $tree, 't/html/defmap-exp.html', 'defmap';
$tree = mktree 't/html/fillinform.html';
-isxml \($tree->fillinform({state => 'catatonic'})), 't/html/fillinform.exp', 'fillinform';
+isxml \($tree->fillinform({state => 'catatonic'})), 't/html/fillinform-exp.html', 'fillinform';
$tree = mktree 't/html/hashmap.html';
$tree->hash_map(
to_attr => 'sid',
excluding => ['email']
);
-isxml $tree, 't/html/hashmap.exp', 'hash_map';
+isxml $tree, 't/html/hashmap-exp.html', 'hash_map';
$tree = mktree 't/html/iter.html';
my $li = $tree->look_down(class => 'store_items');
$tree->iter($li, qw/bread butter vodka/);
-isxml $tree, 't/html/iter.exp', 'iter';
+isxml $tree, 't/html/iter-exp.html', 'iter';
my @list = map { [item => $_] } qw/bread butter beans/;
my $initial_lol = [ note => [ list => [ item => 'sample' ] ] ];
$tree = mktree 't/html/highlander2.html';
$tree->passover('under18');
-isxml $tree, 't/html/highlander2-passover.exp', 'passover';
+isxml $tree, 't/html/highlander2-passover-exp.html', 'passover';
$tree = mktree 't/html/position.html';
my $found = $tree->look_down(id => 'findme');
$tree = mktree 't/html/prune.html';
$tree->prune;
-isxml $tree, 't/html/prune.exp', 'prune';
+isxml $tree, 't/html/prune-exp.html', 'prune';
##################################################
# Longer tests
debug => $ENV{TEST_VERBOSE},
);
-isxml $tree, 't/html/dual_iter.exp', 'dual_iter';
+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';
###
],
$age
);
- isxml $tree, "t/html/highlander-$age.exp", "highlander for $age";
+ isxml $tree, "t/html/highlander-$age-exp.html", "highlander for $age";
}
###
cond_arg => [ $age ]
);
- isxml ($tree, "t/html/highlander2-$age.exp", "highlander2 for age $age");
+ isxml ($tree, "t/html/highlander2-$age-exp.html", "highlander2 for age $age");
}
###
debug => $ENV{TEST_VERBOSE},
);
-isxml $tree, 't/html/iter2.exp', 'iter2';
+isxml $tree, 't/html/iter2-exp.html', 'iter2';
###
data => \@data,
data_iter => sub { my $data = shift; shift @$data });
-isxml $tree, 't/html/unroll_select.exp', 'unroll_select';
+isxml $tree, 't/html/unroll_select-exp.html', 'unroll_select';