diff --git a/t/content.t b/t/content.t index 2bc8622a..970622f8 100644 --- a/t/content.t +++ b/t/content.t @@ -43,14 +43,9 @@ $mech->update_html($html); =cut -SKIP: { - eval 'use HTML::TreeBuilder 5'; - skip 'HTML::TreeBuilder version 5 not installed', 2 if $@; - - my $text = $mech->content(format => 'text'); - like( $text, qr/Fine/, 'Found Fine' ); - unlike( $text, qr/html/i, 'Could not find "html"' ); -} +my $text = $mech->content(format => 'text'); +like( $text, qr/Fine/, 'Found Fine' ); +unlike( $text, qr/html/i, 'Could not find "html"' ); dies_ok { $mech->content(format => 'no_such_format' ) } 'Unkown format'; diff --git a/t/update_html.t b/t/update_html.t new file mode 100644 index 00000000..f8c375c5 --- /dev/null +++ b/t/update_html.t @@ -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'; + + +Test + + +
+ +
+ + +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; \ No newline at end of file