1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
use strict;
use warnings;
use Test::More tests => 4;
use HTML::FormFu;
use Storable qw( dclone );
SKIP:
{
skip "Need to figure out alternative way to set default_args() on parent classes\n" .
"after the move to Moose",
4;
my $form = HTML::FormFu->new({ tt_args => { INCLUDE_PATH => 'share/templates/tt/xhtml' } });
$form->default_args( {
elements => {
Block => { attributes => { class => 'block' } },
Multi => { label => 'My Label' },
_Field => { comment => 'My Comment' },
},
} );
# take a deep copy of element_defaults, so we can check they've not been butchered, later
my $default_args = dclone( $form->default_args );
$form->populate( {
elements => [
{ type => 'Multi',
name => 'foo',
},
],
} );
my $multi = $form->get_all_element({ type => 'Multi' });
like( $multi, qr/class="[^"]*block[^"]*"/ );
is( $multi->label, 'My Label' );
is( $multi->comment, 'My Comment' );
# original default_args hashref hasn't been butchered
is_deeply( $default_args, $form->default_args );
}
|