]>
Commit | Line | Data |
---|---|---|
aa016126 | 1 | #!/usr/bin/perl |
67e78ff2 | 2 | # Test the 3 possible look_down calls to table2() |
3 | # a = default | |
4 | # b = supplied array ref | |
5 | # c = supplied code ref | |
aa016126 | 6 | use t::lib tests => 3; |
67e78ff2 | 7 | use lib qw(t/ t/m/); |
67e78ff2 | 8 | use data::table2; |
9 | ||
67e78ff2 | 10 | my $o = data::table2->new; |
11 | ||
12 | # a - default table_ld | |
13 | ||
aa016126 | 14 | my $tree = mktree 't/html/table2.html'; |
67e78ff2 | 15 | |
16 | my $table = HTML::Element::Library::ref_or_ld( | |
aa016126 MG |
17 | $tree, |
18 | ['_tag' => 'table'] | |
19 | ); | |
67e78ff2 | 20 | |
aa016126 | 21 | isxml $table, 't/html/table2-table_ld.exp', 'table2 look_down default'; |
67e78ff2 | 22 | |
23 | # b - arrayref table_ld | |
24 | ||
67e78ff2 | 25 | $table = HTML::Element::Library::ref_or_ld( |
aa016126 MG |
26 | $tree, |
27 | [frame => 'hsides', rules => 'groups'] | |
67e78ff2 | 28 | ); |
29 | ||
aa016126 | 30 | isxml $table, 't/html/table2-table_ld.exp', 'table2 look_down arrayref'; |
67e78ff2 | 31 | |
32 | # c - coderef table_ld | |
33 | ||
67e78ff2 | 34 | $table = HTML::Element::Library::ref_or_ld( |
aa016126 MG |
35 | $tree, |
36 | sub { | |
37 | my ($t) = @_; | |
38 | my $caption = $t->look_down('_tag' => 'caption'); | |
39 | $caption->parent; | |
40 | } | |
41 | ); | |
42 | ||
43 | isxml $table, 't/html/table2-table_ld.exp', 'table2 look_down coderef'; |