]>
Commit | Line | Data |
---|---|---|
67e78ff2 | 1 | # This might look like shell script, but it's actually -*- perl -*- |
2 | use strict; | |
3 | use lib qw(t/ t/m/); | |
4 | ||
5 | ||
6 | use File::Slurp; | |
7 | use Test::More qw(no_plan); | |
8 | ||
9 | use TestUtils; | |
10 | use HTML::TreeBuilder; | |
11 | use HTML::Element::Library; | |
12 | ||
13 | use SelectData; | |
14 | ||
15 | my $root = 't/html/unroll_select'; | |
16 | ||
17 | my $tree = HTML::TreeBuilder->new_from_file("$root.html"); | |
18 | ||
19 | ||
20 | $tree->unroll_select | |
21 | ( | |
22 | select_label => 'clan_list', | |
23 | option_value => sub { my $row = shift; $row->{clan_id} }, | |
24 | option_content => sub { my $row = shift; $row->{clan_name} }, | |
25 | option_selected => sub { my $row = shift; $row->{selected} }, | |
26 | data => SelectData->load_data, | |
27 | data_iter => sub { my $data = shift; shift @$data } | |
28 | ); | |
29 | ||
30 | my $generated_html = ptree($tree, "$root.gen"); | |
31 | ||
32 | is ($generated_html, File::Slurp::read_file("$root.exp"), | |
33 | "HTML for non-alternating table"); |