-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit also removes an old SKIP check that we don't need any more because we now depend on HTML::TreeBuilder.
- Loading branch information
Showing
2 changed files
with
51 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use warnings; | ||
use strict; | ||
use Test::More; | ||
|
||
BEGIN { delete @ENV{ qw( http_proxy HTTP_PROXY ) }; } | ||
BEGIN { | ||
use_ok( 'WWW::Mechanize' ); | ||
} | ||
|
||
my $html = <<'HTML'; | ||
<html> | ||
<head> | ||
<title>Test</title> | ||
</head> | ||
<body> | ||
<form name="foo"> | ||
<input type="text" name="asdf"> | ||
</form> | ||
</body> | ||
</html> | ||
HTML | ||
|
||
my $mech = WWW::Mechanize->new(); | ||
# Well actually there is no base (and therefore it does not belong to us | ||
# :-), so let's kludge a bit. | ||
$mech->{base} = 'http://example.com/'; | ||
|
||
$mech->update_html($html); | ||
|
||
like( $mech->content, qr/Test/, 'update_html has put the content in' ); | ||
|
||
is( | ||
ref( $mech->form_name('foo') ), | ||
'HTML::Form', | ||
'... and we now have forms' | ||
); | ||
|
||
$html =~ s/foo/bar/; | ||
$mech->update_html($html); | ||
|
||
is( | ||
ref( $mech->form_name('bar') ), | ||
'HTML::Form', | ||
'updating the HTML also updates the form' | ||
); | ||
|
||
|
||
done_testing; |