r24462 - in /branches/upstream/libhtml-formfu-perl/current: ./ lib/HTML/ lib/HTML/FormFu/ lib/HTML/FormFu/Element/ lib/HTML/FormFu/Filter/ t/bugs/ t/elements/ t/elements/object/ t/form/ t/form/object/ t/nested/elements/
ansgar-guest at users.alioth.debian.org
ansgar-guest at users.alioth.debian.org
Fri Aug 22 13:46:25 UTC 2008
Author: ansgar-guest
Date: Fri Aug 22 13:46:23 2008
New Revision: 24462
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=24462
Log:
[svn-upgrade] Integrating new upstream version, libhtml-formfu-perl (0.03003)
Added:
branches/upstream/libhtml-formfu-perl/current/t/bugs/not_nested.t
branches/upstream/libhtml-formfu-perl/current/t/elements/object/
branches/upstream/libhtml-formfu-perl/current/t/elements/object.t
branches/upstream/libhtml-formfu-perl/current/t/elements/object/input
branches/upstream/libhtml-formfu-perl/current/t/form/object/
branches/upstream/libhtml-formfu-perl/current/t/form/object.t
branches/upstream/libhtml-formfu-perl/current/t/form/object/form
branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named.t
branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named.yml
branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named_filter.t
branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named_filter.yml
branches/upstream/libhtml-formfu-perl/current/t/nested/elements/multi.t
branches/upstream/libhtml-formfu-perl/current/t/nested/elements/multi_named.t
Removed:
branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Filter/CompoundDateTime.pm
Modified:
branches/upstream/libhtml-formfu-perl/current/Changes
branches/upstream/libhtml-formfu-perl/current/MANIFEST
branches/upstream/libhtml-formfu-perl/current/META.yml
branches/upstream/libhtml-formfu-perl/current/Makefile.PL
branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu.pm
branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Attribute.pm
branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element.pm
branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Block.pm
branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Date.pm
branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Hidden.pm
branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Multi.pm
branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Repeatable.pm
branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/_DateSelect.pm
branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/_Field.pm
branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/ObjectUtil.pm
Modified: branches/upstream/libhtml-formfu-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/Changes?rev=24462&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/Changes (original)
+++ branches/upstream/libhtml-formfu-perl/current/Changes Fri Aug 22 13:46:23 2008
@@ -1,3 +1,16 @@
+0.03003 2008-08-21
+
+ - Form and elements inside template files now have access to original
+ object via self.object
+
+ - Having a named Multi block within a Block with nested_name set, now works.
+
+ - New Element method is_block() which is true for Block elements.
+
+ - Multi no longers sets is_field(0) - it's now true for both is_field() and is_block().
+
+ - prereqs - set minimum version of Exporter.pm that exports import()
+
0.03002 2008-08-11
- Deprecate element_defaults() method.
Modified: branches/upstream/libhtml-formfu-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/MANIFEST?rev=24462&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/MANIFEST (original)
+++ branches/upstream/libhtml-formfu-perl/current/MANIFEST Fri Aug 22 13:46:23 2008
@@ -156,7 +156,6 @@
lib/HTML/FormFu/Filter.pm
lib/HTML/FormFu/Filter/_Compound.pm
lib/HTML/FormFu/Filter/Callback.pm
-lib/HTML/FormFu/Filter/CompoundDateTime.pm
lib/HTML/FormFu/Filter/CompoundJoin.pm
lib/HTML/FormFu/Filter/CompoundSprintf.pm
lib/HTML/FormFu/Filter/CopyValue.pm
@@ -240,6 +239,7 @@
t/bugs/field_no_name.t
t/bugs/filter_run_once.t
t/bugs/name_regex_chars.t
+t/bugs/not_nested.t
t/bugs/populate_element_coderef.t
t/bugs/render_processed_value_retain_default.t
t/bugs/render_processed_value_retain_default.yml
@@ -352,6 +352,8 @@
t/elements/no_block_tag.yml
t/elements/no_container_tag.t
t/elements/no_container_tag.yml
+t/elements/object.t
+t/elements/object/input
t/elements/password.t
t/elements/password_render_value.t
t/elements/password_retain_default.t
@@ -476,6 +478,8 @@
t/form/javascript_src.t
t/form/model.t
t/form/multiple_same_named_fields.t
+t/form/object.t
+t/form/object/form
t/form/param.t
t/form/param_array.t
t/form/param_list.t
@@ -533,6 +537,10 @@
t/nested/constraints/required.t
t/nested/element_name.t
t/nested/element_name.yml
+t/nested/elements/block_repeatable_multi_named.t
+t/nested/elements/block_repeatable_multi_named.yml
+t/nested/elements/block_repeatable_multi_named_filter.t
+t/nested/elements/block_repeatable_multi_named_filter.yml
t/nested/elements/block_without_name.t
t/nested/elements/block_without_name.yml
t/nested/elements/checkbox_force_default.t
@@ -540,6 +548,8 @@
t/nested/elements/date.t
t/nested/elements/file_post.t
t/nested/elements/file_post.txt
+t/nested/elements/multi.t
+t/nested/elements/multi_named.t
t/nested/elements/radio.t
t/nested/elements/radio_force_default.t
t/nested/elements/radio_retain_default.t
Modified: branches/upstream/libhtml-formfu-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/META.yml?rev=24462&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/META.yml (original)
+++ branches/upstream/libhtml-formfu-perl/current/META.yml Fri Aug 22 13:46:23 2008
@@ -34,6 +34,7 @@
DateTime::Format::Strptime: 0
DateTime::Locale: 0
Email::Valid: 0
+ Exporter: 5.57
File::ShareDir: 0
HTML::Scrubber: 0
HTML::TokeParser::Simple: 3.14
@@ -49,4 +50,4 @@
perl: 5.8.1
resources:
license: http://dev.perl.org/licenses/
-version: 0.03002
+version: 0.03003
Modified: branches/upstream/libhtml-formfu-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/Makefile.PL?rev=24462&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/Makefile.PL (original)
+++ branches/upstream/libhtml-formfu-perl/current/Makefile.PL Fri Aug 22 13:46:23 2008
@@ -3,6 +3,11 @@
name 'HTML-FormFu';
perl_version '5.008001';
all_from 'lib/HTML/FormFu.pm';
+
+# this is the lowest version of Exporter I can identify that exports import()
+# it's bundled with perl 5.83
+# version 5.567 that ships with perl 5.82 is no good
+requires 'Exporter' => '5.57';
requires 'Class::Accessor::Chained::Fast';
requires 'Class::C3';
Modified: branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu.pm?rev=24462&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu.pm (original)
+++ branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu.pm Fri Aug 22 13:46:23 2008
@@ -73,7 +73,7 @@
*plugins = \&plugin;
*add_plugins = \&add_plugin;
-our $VERSION = '0.03002';
+our $VERSION = '0.03003';
$VERSION = eval $VERSION;
Class::C3::initialize();
@@ -922,6 +922,8 @@
$render{form} = \%render;
weaken( $render{form} );
+ $render{object} = $self;
+
if ( $self->force_error_message
|| ( $self->has_errors && defined $self->form_error_message ) )
{
@@ -1516,7 +1518,7 @@
L<size|HTML::FormFu::Element/size> of C<10>, and make every C<Strftime>
deflator automatically get it's strftime set to C<%d/%m/%Y>:
- element_args:
+ default_args:
elements:
Text:
size: 10
@@ -1527,7 +1529,7 @@
To take it even further, you can even make all DateTime elements automatically
get an appropriate Strftime deflator and a DateTime inflator:
- element_args:
+ default_args:
elements:
DateTime:
deflators:
@@ -1542,7 +1544,7 @@
which is an alias for L</element> - the keys given to C<default_args> must
be of the plural form, e.g.:
- element_args:
+ default_args:
elements: {}
deflators: {}
filters: {}
Modified: branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Attribute.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Attribute.pm?rev=24462&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Attribute.pm (original)
+++ branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Attribute.pm Fri Aug 22 13:46:23 2008
@@ -311,7 +311,7 @@
=head1 AUTHOR
-Carl Franks, C<cfranks.org>
+Carl Franks, C<cfranks at cpan.org>
Based on the original source code of L<HTML::Widget::Accessor>, by
Sebastian Riedel, C<sri at oook.de>.
Modified: branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element.pm?rev=24462&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element.pm (original)
+++ branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element.pm Fri Aug 22 13:46:23 2008
@@ -29,7 +29,7 @@
__PACKAGE__->mk_accessors(
qw/
- name type filename is_field is_repeatable /
+ name type filename is_field is_block is_repeatable /
);
__PACKAGE__->mk_inherited_accessors(qw/ tt_args render_method /);
@@ -159,6 +159,7 @@
stash => $self->stash,
parent => $self->parent,
form => sub { return shift->{parent}->form },
+ object => $self,
@_ ? %{ $_[0] } : () );
weaken( $render{parent} );
Modified: branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Block.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Block.pm?rev=24462&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Block.pm (original)
+++ branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Block.pm Fri Aug 22 13:46:23 2008
@@ -37,6 +37,7 @@
$self->default_args( {} );
$self->filename('block');
$self->tag('div');
+ $self->is_block(1);
return $self;
}
Modified: branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Date.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Date.pm?rev=24462&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Date.pm (original)
+++ branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Date.pm Fri Aug 22 13:46:23 2008
@@ -604,7 +604,7 @@
=head1 AUTHOR
-Carl Franks, C<cfranks.org>
+Carl Franks, C<cfranks at cpan.org>
=head1 LICENSE
Modified: branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Hidden.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Hidden.pm?rev=24462&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Hidden.pm (original)
+++ branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Hidden.pm Fri Aug 22 13:46:23 2008
@@ -59,7 +59,7 @@
=head1 AUTHOR
-Carl Franks, C<cfranks.org>
+Carl Franks, C<cfranks at cpan.org>
=head1 LICENSE
Modified: branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Multi.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Multi.pm?rev=24462&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Multi.pm (original)
+++ branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Multi.pm Fri Aug 22 13:46:23 2008
@@ -42,7 +42,6 @@
$self->label_attributes( {} );
$self->label_filename('label');
$self->label_tag('label');
- $self->is_field(0);
return $self;
}
Modified: branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Repeatable.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Repeatable.pm?rev=24462&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Repeatable.pm (original)
+++ branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/Repeatable.pm Fri Aug 22 13:46:23 2008
@@ -114,7 +114,7 @@
sub _reparent_children {
my $self = shift;
- return if $self->is_field;
+ return if !$self->is_block;
for my $child ( @{ $self->get_elements } ) {
$child->parent($self);
Modified: branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/_DateSelect.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/_DateSelect.pm?rev=24462&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/_DateSelect.pm (original)
+++ branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/_DateSelect.pm Fri Aug 22 13:46:23 2008
@@ -18,8 +18,14 @@
while ( defined $parent->parent ) {
$parent = $parent->parent;
- push @names, $parent->nested_name
- if defined $parent->nested_name;
+ if ( $parent->can('is_field') && $parent->is_field ) {
+ push @names, $parent->name
+ if defined $parent->name;
+ }
+ else {
+ push @names, $parent->nested_name
+ if defined $parent->nested_name;
+ }
}
if (@names) {
Modified: branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/_Field.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/_Field.pm?rev=24462&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/_Field.pm (original)
+++ branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/Element/_Field.pm Fri Aug 22 13:46:23 2008
@@ -98,10 +98,17 @@
croak 'cannot set nested' if @_;
if ( defined $self->name ) {
- while ( defined $self->parent ) {
- $self = $self->parent;
-
- return 1 if defined $self->nested_name;
+ my $parent = $self;
+
+ while ( defined $parent->parent ) {
+ $parent = $parent->parent;
+
+ if ( $parent->can('is_field') && $parent->is_field ) {
+ return 1 if defined $parent->name;
+ }
+ else {
+ return 1 if defined $parent->nested_name;
+ }
}
}
@@ -139,8 +146,14 @@
while ( defined $parent->parent ) {
$parent = $parent->parent;
- push @names, $parent->nested_name
- if defined $parent->nested_name;
+ if ( $parent->can('is_field') && $parent->is_field ) {
+ push @names, $parent->name
+ if defined $parent->name;
+ }
+ else {
+ push @names, $parent->nested_name
+ if defined $parent->nested_name;
+ }
}
if (@names) {
Modified: branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/ObjectUtil.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/ObjectUtil.pm?rev=24462&op=diff
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/ObjectUtil.pm (original)
+++ branches/upstream/libhtml-formfu-perl/current/lib/HTML/FormFu/ObjectUtil.pm Fri Aug 22 13:46:23 2008
@@ -204,8 +204,8 @@
my $self = shift;
my %args = _parse_args(@_);
- my @e
- = map { $_->is_field ? $_ : @{ $_->get_fields } } @{ $self->_elements };
+ my @e = map { $_->is_field && !$_->is_block ? $_ : @{ $_->get_fields } }
+ @{ $self->_elements };
return _get_elements( \%args, \@e );
}
Added: branches/upstream/libhtml-formfu-perl/current/t/bugs/not_nested.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/t/bugs/not_nested.t?rev=24462&op=file
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/t/bugs/not_nested.t (added)
+++ branches/upstream/libhtml-formfu-perl/current/t/bugs/not_nested.t Fri Aug 22 13:46:23 2008
@@ -1,0 +1,14 @@
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+
+use HTML::FormFu;
+
+my $form = HTML::FormFu->new;
+
+$form->auto_fieldset(1);
+
+my $field = $form->element('Text')->name('foo');
+
+ok( !$field->nested );
Added: branches/upstream/libhtml-formfu-perl/current/t/elements/object.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/t/elements/object.t?rev=24462&op=file
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/t/elements/object.t (added)
+++ branches/upstream/libhtml-formfu-perl/current/t/elements/object.t Fri Aug 22 13:46:23 2008
@@ -1,0 +1,44 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+eval { require Template; };
+
+if ($@) {
+ plan skip_all => 'Template.pm required';
+ exit;
+}
+else {
+ plan tests => 1;
+}
+
+use HTML::FormFu;
+
+my $form = HTML::FormFu->new(
+ { tt_args => { INCLUDE_PATH => ['t/elements/object', 'share/templates/tt/xhtml'] } } );
+
+$form->render_method('tt');
+$form->auto_fieldset;
+
+$form->element('Text')->name('foo')->constraint('Required');
+$form->element('Text')->name('bar');
+$form->element('Hidden')->name('baz');
+$form->element('Submit')->name('submit');
+
+my $xhtml = <<EOF;
+<form action="" method="post">
+<div class="text">
+<input name="foo" type="text" /> **
+</div>
+<div class="text">
+<input name="bar" type="text" />
+</div>
+<input name="baz" type="hidden" />
+<div class="submit">
+<input name="submit" type="submit" />
+</div>
+</form>
+EOF
+
+is( $form, $xhtml );
Added: branches/upstream/libhtml-formfu-perl/current/t/elements/object/input
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/t/elements/object/input?rev=24462&op=file
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/t/elements/object/input (added)
+++ branches/upstream/libhtml-formfu-perl/current/t/elements/object/input Fri Aug 22 13:46:23 2008
@@ -1,0 +1,1 @@
+[% WRAPPER field %][% INCLUDE $self.field_filename %][% IF self.object.get_constraint({type => 'Required'}) %] **[% END %][% END %]
Added: branches/upstream/libhtml-formfu-perl/current/t/form/object.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/t/form/object.t?rev=24462&op=file
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/t/form/object.t (added)
+++ branches/upstream/libhtml-formfu-perl/current/t/form/object.t Fri Aug 22 13:46:23 2008
@@ -1,0 +1,36 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+eval { require Template; };
+
+if ($@) {
+ plan skip_all => 'Template.pm required';
+ exit;
+}
+else {
+ plan tests => 1;
+}
+
+use HTML::FormFu;
+
+my $form = HTML::FormFu->new(
+ { tt_args => { INCLUDE_PATH => ['t/form/object', 'share/templates/tt/xhtml'] } } );
+
+$form->render_method('tt');
+$form->auto_fieldset;
+
+$form->element('Text')->name('foo')->label('Foo');
+$form->element('Text')->name('bar')->label('Bar');
+$form->element('Hidden')->name('baz');
+$form->element('Submit')->name('submit');
+
+my $xhtml = <<EOF;
+foo
+bar
+baz
+submit
+EOF
+
+is( $form, $xhtml );
Added: branches/upstream/libhtml-formfu-perl/current/t/form/object/form
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/t/form/object/form?rev=24462&op=file
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/t/form/object/form (added)
+++ branches/upstream/libhtml-formfu-perl/current/t/form/object/form Fri Aug 22 13:46:23 2008
@@ -1,0 +1,2 @@
+[% FOREACH field = self.object.get_fields %][% field.name %]
+[% END %]
Added: branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named.t?rev=24462&op=file
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named.t (added)
+++ branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named.t Fri Aug 22 13:46:23 2008
@@ -1,0 +1,40 @@
+use strict;
+use warnings;
+
+use Test::More tests => 5;
+
+use HTML::FormFu;
+
+my $form = HTML::FormFu->new({ tt_args => { INCLUDE_PATH => 'share/templates/tt/xhtml' } });
+
+$form->load_config_file('t/nested/elements/block_repeatable_multi_named.yml');
+
+my $fieldset = $form->get_element;
+my $repeatable = $fieldset->get_element;
+my $multi = $repeatable->get_element;
+
+$form->process({
+ 'counter' => 1,
+ 'nested.foo_1' => 'aaa',
+ 'nested.multi_1.bar_1' => 'bbb',
+ 'nested.multi_1.baz_1' => 'ccc',
+});
+
+ok( $form->submitted_and_valid );
+
+is_deeply(
+ $form->params,
+ {
+ nested => {
+ foo_1 => 'aaa',
+ multi_1 => {
+ bar_1 => 'bbb',
+ baz_1 => 'ccc',
+ }
+ }
+ }
+);
+
+is( $form->param_value('nested.foo_1'), 'aaa' );
+is( $form->param_value('nested.multi_1.bar_1'), 'bbb' );
+is( $form->param_value('nested.multi_1.baz_1'), 'ccc' );
Added: branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named.yml?rev=24462&op=file
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named.yml (added)
+++ branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named.yml Fri Aug 22 13:46:23 2008
@@ -1,0 +1,16 @@
+---
+auto_fieldset: 1
+
+elements:
+ - type: Repeatable
+ nested_name: nested
+ counter_name: counter
+
+ elements:
+ - name: foo
+
+ - type: Multi
+ name: multi
+ elements:
+ - name: bar
+ - name: baz
Added: branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named_filter.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named_filter.t?rev=24462&op=file
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named_filter.t (added)
+++ branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named_filter.t Fri Aug 22 13:46:23 2008
@@ -1,0 +1,36 @@
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+
+use HTML::FormFu;
+
+my $form = HTML::FormFu->new({ tt_args => { INCLUDE_PATH => 'share/templates/tt/xhtml' } });
+
+$form->load_config_file('t/nested/elements/block_repeatable_multi_named_filter.yml');
+
+my $fieldset = $form->get_element;
+my $repeatable = $fieldset->get_element;
+my $multi = $repeatable->get_element;
+
+$form->process({
+ 'counter' => 1,
+ 'nested.foo_1' => 'aaa',
+ 'nested.multi_1.bar_1' => 'bbb',
+ 'nested.multi_1.baz_1' => 'ccc',
+});
+
+ok( $form->submitted_and_valid );
+
+is_deeply(
+ $form->params,
+ {
+ nested => {
+ foo_1 => 'aaa',
+ multi_1 => 'bbb ccc'
+ }
+ }
+);
+
+is( $form->param_value('nested.foo_1'), 'aaa' );
+is( $form->param_value('nested.multi_1'), 'bbb ccc' );
Added: branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named_filter.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named_filter.yml?rev=24462&op=file
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named_filter.yml (added)
+++ branches/upstream/libhtml-formfu-perl/current/t/nested/elements/block_repeatable_multi_named_filter.yml Fri Aug 22 13:46:23 2008
@@ -1,0 +1,18 @@
+---
+auto_fieldset: 1
+
+elements:
+ - type: Repeatable
+ nested_name: nested
+ counter_name: counter
+
+ elements:
+ - name: foo
+
+ - type: Multi
+ name: multi
+ elements:
+ - name: bar
+ - name: baz
+ filter:
+ - CompoundJoin
Added: branches/upstream/libhtml-formfu-perl/current/t/nested/elements/multi.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/t/nested/elements/multi.t?rev=24462&op=file
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/t/nested/elements/multi.t (added)
+++ branches/upstream/libhtml-formfu-perl/current/t/nested/elements/multi.t Fri Aug 22 13:46:23 2008
@@ -1,0 +1,29 @@
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+
+use HTML::FormFu;
+
+my $form = HTML::FormFu->new({ tt_args => { INCLUDE_PATH => 'share/templates/tt/xhtml' } });
+
+$form->auto_fieldset( { nested_name => 'nested' } );
+
+my $multi = $form->element('Multi');
+
+$multi->element('Text')->name('foo');
+
+my $form_xhtml = <<EOF;
+<form action="" method="post">
+<fieldset>
+<div class="multi">
+<span class="elements">
+<input name="nested.foo" type="text" />
+</span>
+</div>
+</fieldset>
+</form>
+EOF
+
+is( "$form", $form_xhtml, 'stringified form' );
+
Added: branches/upstream/libhtml-formfu-perl/current/t/nested/elements/multi_named.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhtml-formfu-perl/current/t/nested/elements/multi_named.t?rev=24462&op=file
==============================================================================
--- branches/upstream/libhtml-formfu-perl/current/t/nested/elements/multi_named.t (added)
+++ branches/upstream/libhtml-formfu-perl/current/t/nested/elements/multi_named.t Fri Aug 22 13:46:23 2008
@@ -1,0 +1,36 @@
+use strict;
+use warnings;
+
+use Test::More tests => 3;
+
+use HTML::FormFu;
+
+my $form = HTML::FormFu->new({ tt_args => { INCLUDE_PATH => 'share/templates/tt/xhtml' } });
+
+$form->auto_fieldset( { nested_name => 'nested' } );
+
+my $multi = $form->element('Multi')->name('foo');
+
+$multi->element('Text')->name('bar');
+
+my $form_xhtml = <<EOF;
+<form action="" method="post">
+<fieldset>
+<div class="multi">
+<span class="elements">
+<input name="nested.foo.bar" type="text" />
+</span>
+</div>
+</fieldset>
+</form>
+EOF
+
+is( "$form", $form_xhtml, 'stringified form' );
+
+$form->process({
+ 'nested.foo.bar' => 'aaa',
+});
+
+ok( $form->submitted_and_valid );
+
+is( $form->param_value('nested.foo.bar'), 'aaa' );
More information about the Pkg-perl-cvs-commits
mailing list