Skip to content

Commit 8b25569

Browse files
authored
Merge pull request #33 from libwww-perl/simbabque/old-pr-8
Resubmit PR for #8 (old #7)
2 parents 234d00b + d4e7c22 commit 8b25569

3 files changed

Lines changed: 33 additions & 1 deletion

File tree

Changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Change history for HTML-Form
22

33
{{$NEXT}}
44
- Remove Authority section from dist.ini (GH#27) (Olaf Alders)
5+
- Allow buttons to not have a value (GH#8) (Felix Ostmann and Julien Fiegehenn)
56

67
6.07 2020-02-21 03:50:52Z
78
- Restore =head1 NAME section to pod for HTML::Form

lib/HTML/Form.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,6 +1419,7 @@ sub click
14191419
my($self,$form,$x,$y) = @_;
14201420
for ($x, $y) { $_ = 1 unless defined; }
14211421
local($self->{clicked}) = [$x,$y];
1422+
local($self->{value}) = "" unless defined $self->value;
14221423
return $form->make_request;
14231424
}
14241425

t/form.t

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use strict;
44
use Test qw(plan ok);
55

6-
plan tests => 127;
6+
plan tests => 129;
77

88
use HTML::Form;
99

@@ -595,3 +595,33 @@ $f = HTML::Form->parse(<<EOT, "http://www.example.com");
595595
</form>
596596
EOT
597597
ok(@warn, 0);
598+
599+
$f = HTML::Form->parse(<<EOT, base => "http://localhost/");
600+
<form method=post>
601+
<form action="test" method="post">
602+
<button type="submit" name="submit" value="go">run</button>
603+
</form>
604+
EOT
605+
606+
ok($f->click->as_string, <<EOT);
607+
POST http://localhost/
608+
Content-Length: 9
609+
Content-Type: application/x-www-form-urlencoded
610+
611+
submit=go
612+
EOT
613+
614+
$f = HTML::Form->parse(<<EOT, base => "http://localhost/");
615+
<form method=post>
616+
<form action="test" method="post">
617+
<button type="submit" name="submit">run</button>
618+
</form>
619+
EOT
620+
621+
ok($f->click->as_string, <<EOT);
622+
POST http://localhost/
623+
Content-Length: 7
624+
Content-Type: application/x-www-form-urlencoded
625+
626+
submit=
627+
EOT

0 commit comments

Comments
 (0)