3 # Test for case when multiple forms are on a page with same-named <select> fields.
6 use Test::More tests => 2;
10 my $test = "the settings of a previous form should not interfere with a latter form (control test with one form)";
11 my @forms = HTML::Form->parse( FakeResponse::One->new );
12 my $cat_form = $forms[0];
13 my @vals = $cat_form->param('age');
14 is_deeply(\@vals,[''], $test);
17 my $test = "the settings of a previous form should not interfere with a latter form (test with two forms)";
18 my @forms = HTML::Form->parse( FakeResponse::TwoForms->new );
19 my $cat_form = $forms[1];
21 my @vals = $cat_form->param('age');
22 is_deeply(\@vals,[''], $test);
26 package FakeResponse::One;
31 return "http://foo.com"
35 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
36 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
37 <html xmlns="http://www.w3.org/1999/xhtml">
43 <form name="search_cats">
44 <select name="age" onChange="jumpTo(this)" class="sap-form-item">
45 <option value="" selected="selected">Any</option>
46 <option value="young">Young</option>
47 <option value="adult">Adult</option>
48 <option value="senior">Senior</option>
49 <option value="puppy">Puppy </option>
58 package FakeResponse::TwoForms;
63 return "http://foo.com"
67 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
68 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
69 <html xmlns="http://www.w3.org/1999/xhtml">
74 <form name="search_dogs" >
75 <select name="age" onChange="jumpTo(this)" class="sap-form-item">
76 <option value="" selected="selected">Any</option>
77 <option value="young">Young</option>
78 <option value="adult">Adult</option>
79 <option value="senior">Senior</option>
80 <option value="puppy">Puppy </option>
85 <form name="search_cats">
86 <select name="age" onChange="jumpTo(this)" class="sap-form-item">
87 <option value="" selected="selected">Any</option>
88 <option value="young">Young</option>
89 <option value="adult">Adult</option>
90 <option value="senior">Senior</option>
91 <option value="puppy">Puppy </option>