diff --git a/Changes b/Changes index d17d7e93..26f169c3 100644 --- a/Changes +++ b/Changes @@ -10,6 +10,7 @@ Revision history for WWW::Mechanize [TESTS] - Add a test for dump_forms() with multiselect (GH#133) (Julien Fiegehenn) - Add tests for select multiple (GH#132) (Michael G. Schwern) and (Julien Fiegehenn) + - Add tests for dump_forms() and field() with empty attributes (GH#125) (Julien Fiegehenn) 2.01 2020-09-18 17:51:10Z - Add rel filter to find_link() (GH#305) (Julien Fiegehenn) diff --git a/t/dump.t b/t/dump.t index eb57afb4..79e94cd3 100644 --- a/t/dump.t +++ b/t/dump.t @@ -109,6 +109,13 @@ POST http://localhost/ (multipart/form-data) [4th_form_2] x= (text) submit=Submit (submit) +POST https://localhost + 5a= (hidden readonly) + 5b=value (hidden readonly) + 5c= (hidden readonly) + 5d=foo (hidden readonly) + 5e=value (hidden readonly) + EXPECTED }; diff --git a/t/field.html b/t/field.html index b704e51d..3a538573 100644 --- a/t/field.html +++ b/t/field.html @@ -9,6 +9,10 @@ + + + + diff --git a/t/field.t b/t/field.t index 69900f9c..7dcfe4be 100644 --- a/t/field.t +++ b/t/field.t @@ -2,7 +2,7 @@ use warnings; use strict; -use Test::More tests => 8; +use Test::More tests => 14; use URI::file; BEGIN { @@ -28,3 +28,18 @@ is( $mech->value( 'bongo' ), 'bango', 'bongo changed' ); $mech->set_visible( [ radio => 'wongo!' ], 'boingo' ); is( $mech->value( 'wango' ), 'wongo!', 'wango changed' ); is( $mech->value( 'dingo', 2 ), 'boingo', 'dingo changed' ); + +for my $name (qw/__no_value __value_empty/) { + ok( ! $mech->value( $name ), "$name is empty" ) or diag $mech->field($name); + $mech->field( $name, 'foo'); + is( $mech->value( $name ), 'foo', "$name changed" ); +} + +for my $name (qw/__value/) { + TODO: { + local $TODO = 'HTML::TokeParser does not understand how to parse this and returns a value where it should not have one'; + ok( ! $mech->value( $name ), "$name is empty" ) or diag $mech->field($name); + } + $mech->field( $name, 'foo'); + is( $mech->value( $name ), 'foo', "$name changed" ); +} \ No newline at end of file diff --git a/t/form_with_fields.html b/t/form_with_fields.html index cdb4ae78..cacae71e 100644 --- a/t/form_with_fields.html +++ b/t/form_with_fields.html @@ -40,4 +40,12 @@ +
+ + + + + +
+ diff --git a/t/google.html b/t/google.html index 94d91c3f..1d8653e1 100644 --- a/t/google.html +++ b/t/google.html @@ -10,5 +10,5 @@ // -->
Google

-
 Web Images Groups Directory News 

 
 • Advanced Search
 • Preferences
 • Language Tools

Want more from Google? Try these expert search tips

+
 Web Images Groups Directory News 

 
 • Advanced Search
 • Preferences
 • Language Tools

Want more from Google? Try these expert search tips


Advertise with Us - Business Solutions - Services & Tools - Jobs, Press, & Help

©2003 Google - Searching 3,083,324,652 web pages

diff --git a/t/mech-dump/mech-dump.t b/t/mech-dump/mech-dump.t index 247a07b1..bff4710f 100644 --- a/t/mech-dump/mech-dump.t +++ b/t/mech-dump/mech-dump.t @@ -35,6 +35,7 @@ if ( $LWP::VERSION < 5.800 ) { GET file:/target-page [bob-the-form] hl=en (hidden) ie=ISO-8859-1 (hidden) + notgoogle= (hidden readonly) q= btnG=Google Search (submit) btnI=I'm Feeling Lucky (submit) @@ -62,6 +63,7 @@ EOF GET file:/target-page [bob-the-form] hl=en (hidden readonly) ie=ISO-8859-1 (hidden readonly) + notgoogle= (hidden readonly) q= (text) btnG=Google Search (submit) btnI=I'm Feeling Lucky (submit)