]> Dogcows Code - chaz/p5-CGI-Ex/blob - t/2_fill_16_ignore_fields.t
56ffe44daedba1c3459760df93f3e90c2f892ad9
[chaz/p5-CGI-Ex] / t / 2_fill_16_ignore_fields.t
1 # -*- Mode: Perl; -*-
2
3 use strict;
4
5 $^W = 1;
6
7 print "1..2\n";
8
9 use CGI::Ex;
10 use CGI;
11
12 print "ok 1\n";
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 = new CGI( { foo1 => '0',
35 foo2 => ['bar1', 'bar2',],
36 foo3 => '' }
37 );
38
39 my $fif = new CGI::Ex;
40 my $output = $fif->fill(scalarref => \$hidden_form_in,
41 fobject => $q,
42 ignore_fields => ['asdf','foo1','asdf']);
43
44 my $is_selected = join(" ",map { m/selected/ ? "yes" : "no" } grep /option/, split ("\n",$output));
45
46 if ($is_selected eq "no no no yes yes no no no no no yes no"){
47 print "ok 2\n";
48 } else {
49 print "Got unexpected is_seleced for select menus:\n$is_selected\n$output\n";
50 print "not ok 2\n";
51 }
52
This page took 0.032677 seconds and 3 git commands to generate.