Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ->grep_submits(), ->grep_inputs() and ->lacks_uncapped_inputs()
- Loading branch information
Showing
5 changed files
with
222 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<html> | ||
<head> | ||
<title>Title</title> | ||
</head> | ||
<body> | ||
<form name="testform"> | ||
<input name="foo" type="text" size="12"> <!-- this is one bad one with a missin maxlength --> | ||
<input name="bar" type="radio"> | ||
<input name="bat" type="text" disabled> <!-- no maxlength, but disabled so it's OK --> | ||
<input name="baz" type="text" maxlength=" 14 "> <!-- spaces shouldn't be a problem --> | ||
<input name="quux" type="text" size="12" maxlength="dogs"> <!-- not an integer --> | ||
<input name="crunchy" type="text" size="12" maxlength="-1"> <!-- negative --> | ||
</form> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<html> | ||
<head> | ||
<title>Title</title> | ||
</head> | ||
<body> | ||
<form name="testform"> | ||
<input name="foo" type="text" size="12" maxlength="14"> | ||
<input name="bar" type="radio"> | ||
<input name="bat" type="text" disabled> <!-- no maxlength, but disabled so it's OK --> | ||
</form> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!perl -w | ||
|
||
use strict; | ||
use warnings; | ||
use Test::More tests => 4; | ||
use Test::Builder::Tester; | ||
|
||
use URI::file; | ||
|
||
BEGIN { | ||
use_ok( 'Test::WWW::Mechanize' ); | ||
} | ||
|
||
my $mech = Test::WWW::Mechanize->new(); | ||
isa_ok( $mech,'Test::WWW::Mechanize' ); | ||
|
||
GOOD: { | ||
my $uri = URI::file->new_abs( 't/lacks_uncapped_inputs-good.html' )->as_string; | ||
$mech->get( $uri ); | ||
|
||
test_out( 'ok 1 - This should have no failures' ); | ||
$mech->lacks_uncapped_inputs( 'This should have no failures' ); | ||
test_test( 'Finds the lacks' ); | ||
} | ||
|
||
BAD: { | ||
my $uri = URI::file->new_abs( 't/lacks_uncapped_inputs-bad.html' )->as_string; | ||
$mech->get( $uri ); | ||
|
||
test_out( 'not ok 1 - This should have three errors found' ); | ||
test_fail( +6 ); | ||
test_diag( q{ got: 3} ); | ||
test_diag( q{ expected: 0} ); | ||
test_diag( q{foo has no maxlength attribute} ); | ||
test_diag( q{quux has an invalid maxlength attribute of "dogs"} ); | ||
test_diag( q{crunchy has an invalid maxlength attribute of "-1"} ); | ||
$mech->lacks_uncapped_inputs( 'This should have three errors found' ); | ||
test_test( 'Detect uncapped' ); | ||
} | ||
|
||
done_testing(); |