File tree 4 files changed +16
-3
lines changed
4 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 1
1
Revision history for WWW::Mechanize
2
2
3
3
{{$NEXT}}
4
+ [FIXED]
5
+ - tick() can now handle checkboxes without a value (GH#331) (Jordan M Adler
6
+ and Julien Fiegehenn)
4
7
5
8
[DOCUMENTATION]
6
9
- Explain that file URIs need url encoding (GH#329) (Julien Fiegehenn and
Original file line number Diff line number Diff line change @@ -2043,6 +2043,11 @@ as the third optional argument will cause the checkbox to be unticked.
2043
2043
The third value does not need to be set if you wish to merely tick the
2044
2044
box.
2045
2045
2046
+ $mech->tick('extra', 'cheese');
2047
+ $mech->tick('extra', 'mushrooms');
2048
+
2049
+ $mech->tick('no_value', ''); # <input type="checkbox" name="no_value">
2050
+
2046
2051
=cut
2047
2052
2048
2053
sub tick {
Original file line number Diff line number Diff line change 4
4
5
5
< input type ="checkbox " name ="foo " value ="hello " /> Hello< br />
6
6
< input type ="checkbox " name ="foo " value ="bye " /> Bye< br />
7
- < input type ="checkbox " name ="foo " value ="arse " /> Arse < br />
7
+ < input type ="checkbox " name ="foo " value ="parse " /> Parse < br />
8
8
< input type ="checkbox " name ="foo " value ="wibble " /> Wibble< br />
9
9
< input type ="checkbox " name ="foo " value ="foo " /> Foo< br />
10
+ < label >
11
+ < input type ="checkbox " name ="no_value " /> I have no value
12
+ </ label >
10
13
11
14
< input type ="Submit " name ="submit " value ="Submit " label ="Submit " />
12
15
</ form >
Original file line number Diff line number Diff line change @@ -22,17 +22,19 @@ $mech->tick('foo','hello');
22
22
$mech -> tick(' foo' ,' bye' );
23
23
$mech -> untick(' foo' ,' hello' );
24
24
25
+ $mech -> tick(' no_value' , ' ' );
26
+
25
27
my $form = $mech -> form_number(1);
26
28
isa_ok( $form , ' HTML::Form' );
27
29
28
30
my $reqstring = $form -> click-> as_string;
29
31
30
32
my $wanted = <<'EOT' ;
31
33
POST http://localhost/
32
- Content-Length: 21
34
+ Content-Length: 31
33
35
Content-Type: application/x-www-form-urlencoded
34
36
35
- foo=bye&submit=Submit
37
+ foo=bye&no_value=& submit=Submit
36
38
EOT
37
39
38
40
is( $reqstring , $wanted , ' Proper posting' );
You can’t perform that action at this time.
0 commit comments