]> Dogcows Code - chaz/p5-CGI-Ex/blob - t/2_fill_16_ignore_fields.t
CGI::Ex 2.00
[chaz/p5-CGI-Ex] / t / 2_fill_16_ignore_fields.t
1 # -*- Mode: Perl; -*-
2
3 =head1 NAME
4
5 2_fill_16_ignore_fields.t - Test CGI::Ex::Fill's ability to fill ignore some fields
6
7 =cut
8
9 use strict;
10 use Test::More tests => 2;
11
12 use_ok('CGI::Ex::Fill');
13
14 my $hidden_form_in = qq{<select multiple name="foo1">
15 <option value="0">bar1</option>
16 <option value="bar2">bar2</option>
17 <option value="bar3">bar3</option>
18 </select>
19 <select multiple name="foo2">
20 <option value="bar1">bar1</option>
21 <option value="bar2">bar2</option>
22 <option value="bar3">bar3</option>
23 </select>
24 <select multiple name="foo3">
25 <option value="bar1">bar1</option>
26 <option selected value="bar2">bar2</option>
27 <option value="bar3">bar3</option>
28 </select>
29 <select multiple name="foo4">
30 <option value="bar1">bar1</option>
31 <option selected value="bar2">bar2</option>
32 <option value="bar3">bar3</option>
33 </select>};
34 my $q = {
35 foo1 => '0',
36 foo2 => ['bar1', 'bar2',],
37 foo3 => '',
38 };
39
40 my $output = CGI::Ex::Fill::form_fill($hidden_form_in, $q, undef, undef, ['asdf','foo1','asdf']);
41
42 my $is_selected = join(" ",map { m/selected/ ? "yes" : "no" } grep /option/, split ("\n",$output));
43
44 ok($is_selected eq "no no no yes yes no no no no no yes no",
45 "Should match ($is_selected)");
This page took 0.035618 seconds and 4 git commands to generate.