File: repeatable_repeatable.t

package info (click to toggle)
libhtml-formfu-perl 2.07000-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 4,392 kB
  • sloc: perl: 12,777; makefile: 9; sql: 5
file content (71 lines) | stat: -rw-r--r-- 1,335 bytes parent folder | download | duplicates (2)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
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_repeatable.yml');

$form->process(
    {   count   => 2,
        foo_1   => 'a',
        foo_2   => 'b',
        count_1 => 1,
        foo_1_1 => 'c',
        bar_1_1 => 'd',
        count_2 => 2,
        foo_2_1 => 'e',
        foo_2_2 => 'f',
        bar_2_1 => 'g',
        bar_2_2 => 'h',
    } );

ok( $form->submitted_and_valid );

is( "$form", <<HTML );
<form action="" method="post">
<fieldset>
<input name="count" type="hidden" value="2" />
<div>
<div>
<input name="foo_1" type="text" value="a" />
</div>
<input name="count_1" type="hidden" value="1" />
<div>
<div>
<input name="foo_1_1" type="text" value="c" />
</div>
<div>
<input name="bar_1_1" type="text" value="d" />
</div>
</div>
</div>
<div>
<div>
<input name="foo_2" type="text" value="b" />
</div>
<input name="count_2" type="hidden" value="2" />
<div>
<div>
<input name="foo_2_1" type="text" value="e" />
</div>
<div>
<input name="bar_2_1" type="text" value="g" />
</div>
</div>
<div>
<div>
<input name="foo_2_2" type="text" value="f" />
</div>
<div>
<input name="bar_2_2" type="text" value="h" />
</div>
</div>
</div>
</fieldset>
</form>
HTML