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