[Jifty-commit] r1731 - in jifty/trunk: lib/Jifty/Test/WWW
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Wed Aug 2 18:01:07 EDT 2006
Author: trs
Date: Wed Aug 2 18:01:06 2006
New Revision: 1731
Modified:
jifty/trunk/ (props changed)
jifty/trunk/Makefile.PL
jifty/trunk/lib/Jifty/Test/WWW/Mechanize.pm
Log:
r15044 at zot: tom | 2006-08-02 17:59:06 -0400
* Ignore "fluff" errors since they cause non-W3C attributes like "autocomplete" to be warned about
* Add html_ok method for checking the mech's current content so tests can use it while we retain control over Test::HTML::Lint
Modified: jifty/trunk/Makefile.PL
==============================================================================
--- jifty/trunk/Makefile.PL (original)
+++ jifty/trunk/Makefile.PL Wed Aug 2 18:01:06 2006
@@ -28,6 +28,7 @@
requires('File::MMagic');
requires('File::ShareDir' => '0.04');
requires('HTML::Entities');
+requires('HTML::Lint');
requires('HTML::Mason' => 1.3101); # HTML::Mason::Exceptions HTML::Mason::FakeApache HTML::Mason::MethodMaker HTML::Mason::Request HTML::Mason::Utils
requires('HTML::Mason::Plugin');
requires('HTTP::Cookies');
Modified: jifty/trunk/lib/Jifty/Test/WWW/Mechanize.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Test/WWW/Mechanize.pm (original)
+++ jifty/trunk/lib/Jifty/Test/WWW/Mechanize.pm Wed Aug 2 18:01:06 2006
@@ -6,7 +6,8 @@
$ENV{'http_proxy'} = ''; # Otherwise Test::WWW::Mechanize tries to go through your HTTP proxy
-use Test::HTML::Lint; # exports html_ok
+use HTML::Lint;
+use Test::HTML::Lint qw();
use HTTP::Cookies;
use XML::XPath;
use Hook::LexWrap;
@@ -15,6 +16,11 @@
my $Test = Test::Builder->new;
+# XXX TODO: We're leaving out FLUFF errors because it complains about non-standard
+# attributes such as "autocomplete" on <form> elements.
+my $lint = HTML::Lint->new( only_types => [HTML::Lint::Error::STRUCTURE,
+ HTML::Lint::Error::HELPER] );
+
=head1 NAME
Jifty::Test::WWW::Mechanize - Subclass of L<Test::WWW::Mechanize> with
@@ -329,9 +335,26 @@
{
local $Test::Builder::Level = $Test::Builder::Level;
$Test::Builder::Level++;
- html_ok($self->content);
+ Test::HTML::Lint::html_ok( $lint, $self->content );
}
-}
+}
+
+=head2 html_ok [STRING]
+
+Tests the current C<content> using L<Test::HTML::Lint>. If passed a string,
+tests against that instead of the current content.
+
+=cut
+
+sub html_ok {
+ my $self = shift;
+ my $content = shift || $self->content;
+ {
+ local $Test::Builder::Level = $Test::Builder::Level;
+ $Test::Builder::Level++;
+ Test::HTML::Lint::html_ok( $lint, $content );
+ }
+}
=head2 submit_html_ok
@@ -346,7 +369,7 @@
{
local $Test::Builder::Level = $Test::Builder::Level;
$Test::Builder::Level++;
- html_ok($self->content);
+ Test::HTML::Lint::html_ok( $lint, $self->content );
}
}
@@ -369,7 +392,7 @@
{
local $Test::Builder::Level = $Test::Builder::Level;
$Test::Builder::Level++;
- html_ok($self->content);
+ Test::HTML::Lint::html_ok( $lint, $self->content );
}
}
More information about the Jifty-commit
mailing list