]> iEval git - html-element-library.git/blob - t/table2.t
Refactor tests (first pass)
[html-element-library.git] / t / table2.t
1 #!/usr/bin/perl
2 use t::lib tests => 1;
3 use lib 't';
4 use data::table2;
5
6 my $root = 't/html/table2';
7 my $d = data::table2->load_data;
8 my $tree = mktree 't/html/table2.html';
9
10 for my $dataset (keys %$d) {
11 my %tbody = ('4dig' => 0, '3dig' => 1);
12 $tree->table2 (
13 debug => $ENV{TEST_VERBOSE},
14 table_data => $d->{$dataset},
15 tr_base_id => $dataset,
16 tr_ld => sub {
17 my $t = shift;
18 my $tbody = ($t->look_down('_tag' => 'tbody'))[$tbody{$dataset}];
19 my @tbody_child = $tbody->content_list;
20 $tbody_child[$_]->detach for (1 .. $#tbody_child) ;
21 $tbody->content_list;
22 },
23 td_proc => sub {
24 my ($tr, $data) = @_;
25 my @td = $tr->look_down('_tag' => 'td');
26 for my $i (0..$#td) {
27 # warn $i;
28 $td[$i]->splice_content(0, 1, $data->[$i]);
29 }
30 }
31 );
32 }
33
34 isxml $tree, 't/html/table2.exp', 'table2';
This page took 0.053144 seconds and 4 git commands to generate.