]> iEval git - html-element-library.git/blame - t/unroll_select.t
first commit
[html-element-library.git] / t / unroll_select.t
CommitLineData
67e78ff2 1# This might look like shell script, but it's actually -*- perl -*-
2use strict;
3use lib qw(t/ t/m/);
4
5
6use File::Slurp;
7use Test::More qw(no_plan);
8
9use TestUtils;
10use HTML::TreeBuilder;
11use HTML::Element::Library;
12
13use SelectData;
14
15my $root = 't/html/unroll_select';
16
17my $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");
This page took 0.026758 seconds and 4 git commands to generate.