Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ Revision history for WWW::Mechanize
- We now consistently use our own die() method and therefore the onerror
handler wherever possible (GH#80) (Julien Fiegehenn)

[TESTS]
- Add tests for field() when working on a <textarea> (GH#220) (Julien
Fiegehenn)

2.12 2022-07-20 06:45:40Z

[ENHANCEMENTS]
Expand Down
1 change: 1 addition & 0 deletions t/field.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<input type="hidden" name="__value" value>
<input type="hidden" name="__value_empty" value="">
<input type="hidden" name="__value_full" value="full">
<textarea rows="5" cols="60" id="textarea_id" name="textarea_name"></textarea>
</FORM>
</BODY>
</HTML>
10 changes: 8 additions & 2 deletions t/field.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use warnings;
use strict;
use Test::More tests => 14;
use Test::More;
use URI::file;

BEGIN {
Expand All @@ -29,6 +29,10 @@ $mech->set_visible( [ radio => 'wongo!' ], 'boingo' );
is( $mech->value( 'wango' ), 'wongo!', 'wango changed' );
is( $mech->value( 'dingo', 2 ), 'boingo', 'dingo changed' );

ok( ! $mech->value( 'textarea_name' ), 'textarea is empty' );
$mech->field( 'textarea_name' => 'foobar' );
is( $mech->value( 'textarea_name' ), 'foobar', 'textarea has been populated' );

for my $name (qw/__no_value __value_empty/) {
ok( ! $mech->value( $name ), "$name is empty" ) or diag $mech->field($name);
$mech->field( $name, 'foo');
Expand All @@ -42,4 +46,6 @@ for my $name (qw/__value/) {
}
$mech->field( $name, 'foo');
is( $mech->value( $name ), 'foo', "$name changed" );
}
}

done_testing;