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 48 49 50 51 52 53 54 55 56 57 58
|
use strict;
use warnings;
use Test::More tests => 2;
use HTML::FormFu;
my $form = HTML::FormFu->new({ tt_args => { INCLUDE_PATH => 'share/templates/tt/xhtml' } });
$form->load_config_file('t/elements/repeatable_counter_name.yml');
my $fs = $form->get_element;
my $block = $fs->get_element;
# we don't call repeat() ourselves
# this should happen in $form->process()
$form->process( {
foo_1 => 'a',
bar_1 => 'b',
foo_2 => 'c',
bar_2 => 'd',
count => 2,
} );
is_deeply(
$form->params,
{ foo_1 => 'a',
bar_1 => 'b',
foo_2 => 'c',
bar_2 => 'd',
} );
is( $form, <<HTML );
<form action="" method="post">
<fieldset>
<div>
<div class="text">
<input name="foo_1" type="text" value="a" />
</div>
<div class="text">
<input name="bar_1" type="text" value="b" />
</div>
</div>
<div>
<div class="text">
<input name="foo_2" type="text" value="c" />
</div>
<div class="text">
<input name="bar_2" type="text" value="d" />
</div>
</div>
<div class="submit">
<input name="submit" type="submit" />
</div>
</fieldset>
</form>
HTML
|