]>
Commit | Line | Data |
---|---|---|
aa016126 MG |
1 | #!/usr/bin/perl |
2 | use t::lib tests => 1; | |
3 | use lib 't'; | |
67e78ff2 | 4 | use data::table2; |
5 | ||
6 | my $root = 't/html/table2'; | |
67e78ff2 | 7 | my $d = data::table2->load_data; |
aa016126 | 8 | my $tree = mktree 't/html/table2.html'; |
67e78ff2 | 9 | |
10 | for my $dataset (keys %$d) { | |
aa016126 MG |
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 | ); | |
67e78ff2 | 32 | } |
33 | ||
aa016126 | 34 | isxml $tree, 't/html/table2.exp', 'table2'; |