Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix bug loading rendering roles; test prereqs; bump version

  • Loading branch information...
commit 168690f75463f958862a46681a6ded15d774181a 1 parent ba50cf3
Gerda Shank authored
6 Changes
View
@@ -1,3 +1,9 @@
+0.36002 Fri Feb 2, 2012
+ Fixed bug introduced in last release where rendering roles are overwritten
+ by HTML::FormHandler::Render::Simple being applied on top.
+ Add skip to t/config.t test for Config::Any
+ Set language handle in t/render_errors.t test.
+
0.36001 Tues Jan 24, 2012
Add two more widget tags: 'no_auto_fieldset' and 'no_compound_wrapper'
Remove automatic addition of 'class="label"' to labels; if you want that
6 dist.ini
View
@@ -2,12 +2,12 @@
name = HTML-FormHandler
main_module = lib/HTML/FormHandler.pm
-author = FormHandler Contributors - see HTML::FormHandler
+author = FormHandler Contributors - see HTML::FormHandler
license = Perl_5
-copyright_holder = Gerda Shank
+copyright_holder = Gerda Shank
copyright_year = 2012
-version = 0.36001
+version = 0.36002
[@Basic]
[InstallGuide]
5 lib/HTML/FormHandler.pm
View
@@ -21,7 +21,7 @@ use namespace::autoclean;
use 5.008;
# always use 5 digits after decimal because of toolchain issues
-our $VERSION = '0.36001';
+our $VERSION = '0.36002';
=head1 SYNOPSIS
@@ -970,7 +970,8 @@ sub BUILD {
my $self = shift;
$self->before_build; # hook to allow customizing forms
- $self->apply_widget_role( $self, $self->widget_form, 'Form' ) unless $self->no_widgets;
+ $self->apply_widget_role( $self, $self->widget_form, 'Form' )
+ unless ( $self->no_widgets || $self->widget_form eq 'Simple' );
$self->_build_fields($self->field_traits); # create the form fields (BuildFields.pm)
$self->build_active if $self->has_active || $self->has_inactive || $self->has_flag('is_wizard');
return if defined $self->item_id && !$self->item;
4 t/config.t
View
@@ -4,8 +4,10 @@ use Test::More;
use HTML::TreeBuilder;
BEGIN {
- plan skip_all => 'Install Template Toolkit to test Render::WithTT'
+ plan skip_all => 'Template Toolkit required'
unless eval { require Template };
+ plan skip_all => 'Config::Any required'
+ unless eval { require Config::Any };
}
use HTML::FormHandler::Foo;
1  t/render.t
View
@@ -4,7 +4,6 @@ use Test::More;
use HTML::FormHandler::Field::Text;
-
{
package Test::Form;
use HTML::FormHandler::Moose;
3  t/render_errors.t
View
@@ -3,6 +3,9 @@ use warnings;
use Test::More;
use HTML::TreeBuilder;
+use HTML::FormHandler::I18N;
+$ENV{LANGUAGE_HANDLE} = HTML::FormHandler::I18N->get_handle('en_en');
+
{
package Test::Form;
use HTML::FormHandler::Moose;
26 t/render_roles.t
View
@@ -0,0 +1,26 @@
+use strict;
+use warnings;
+use Test::More;
+
+{
+ package Test::Render;
+ use Moose::Role;
+
+ sub render { "This is the rendering role" }
+}
+
+{
+ package Test::Form;
+ use HTML::FormHandler::Moose;
+ extends 'HTML::FormHandler';
+ with 'Test::Render';
+
+ has_field 'foo';
+ has_field 'bar';
+}
+
+my $form = Test::Form->new;
+my $render = $form->render;
+is( $render, "This is the rendering role", 'rendered using role' );
+
+done_testing;
2  xt/captcha.t
View
@@ -76,7 +76,7 @@ ok( $form->validated, 'form validated; old captcha, valid fields' );
my $render = $form->render_field('captcha');
is( $render, '
-<div class="captcha"><label class="label" for="captcha">Verification: </label><img src="/captcha/test"/><input id="captcha" name="captcha"></div>
+<div class="captcha"><label for="captcha">Verification: </label><img src="/captcha/image"/><input id="captcha" name="captcha"></div>
', 'captcha renders ok' );
2  xt/captcha2.t
View
@@ -48,7 +48,7 @@ $mech->get_ok("/captcha/get_rnd");
my $rnd = $mech->content;
-$mech->get_ok("/captcha/test");
+$mech->get_ok("/captcha/image");
is $mech->res->content_type, "png";
4 xt/lib/MyCatalystApp/Controller/Captcha.pm
View
@@ -38,13 +38,13 @@ sub index :Path :Args(0) {
$c->res->body($form->render);
}
-=head2 test
+=head2 image
returns the image belonging to the current captcha
=cut
-sub test :Local{
+sub image :Local{
my ( $self, $c ) = @_;
my $captcha = $c->session->{captcha};
$c->res->content_type($captcha->{type});
2  xt/submit.t
View
@@ -32,7 +32,7 @@ my $rendered = $form->render;
is( $rendered,
'<form id="test_submit" method="post" >
<fieldset class="main_fieldset">
-<div><label class="label" for="some_field">Some field: </label><input type="text" name="some_field" id="some_field" value="test" /></div>
+<div><label for="some_field">Some field: </label><input type="text" name="some_field" id="some_field" value="test" /></div>
<div><input type="submit" name="submit" id="submit" value="Submit" /></div>
</fieldset></form>
2  xt/upload.t
View
@@ -84,7 +84,7 @@ my $form = My::Form::Upload->new;
ok( $form, 'created form with upload field' );
is( $form->field('file')->render, '
-<div><label class="label" for="file">File: </label><input type="file" name="file" id="file" /></div>
+<div><label for="file">File: </label><input type="file" name="file" id="file" /></div>
', 'renders ok' );
my $upload = Mock::Upload->new( filename => 'test.txt', size => 1024 );
Please sign in to comment.
Something went wrong with that request. Please try again.