]> iEval git - html-element-library.git/blame - t/table2.t
Refactor tests (first pass)
[html-element-library.git] / t / table2.t
CommitLineData
aa016126
MG
1#!/usr/bin/perl
2use t::lib tests => 1;
3use lib 't';
67e78ff2 4use data::table2;
5
6my $root = 't/html/table2';
67e78ff2 7my $d = data::table2->load_data;
aa016126 8my $tree = mktree 't/html/table2.html';
67e78ff2 9
10for 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 34isxml $tree, 't/html/table2.exp', 'table2';
This page took 0.025721 seconds and 4 git commands to generate.