File: default_args_alt.t

package info (click to toggle)
libhtml-formfu-perl 2.05000-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,328 kB
  • ctags: 831
  • sloc: perl: 12,785; makefile: 9; sql: 5
file content (33 lines) | stat: -rw-r--r-- 801 bytes parent folder | download
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
use strict;
use warnings;

use Test::More tests => 3;

use HTML::FormFu;
use Storable qw( dclone );

my $form = HTML::FormFu->new(
    { tt_args => { INCLUDE_PATH => 'share/templates/tt/xhtml' } } );

$form->load_config_file('t/form/default_args_alt.yml');

# longest match - 'not_in_multi' longer then 'is_input'
my $foo = $form->get_field({ name => 'foo' });
like( $foo->attrs->{class}, qr/not_in_multi/ );

# Input within the Multi does not get the 'not_in_multi' class
my $bar = $form->get_field({ name => 'bar' });
like( $bar->attrs->{class}, qr/is_input/ );

is ( "$form", <<HTML );
<form action="" method="post">
<div>
<input name="foo" type="text" class="not_in_multi" />
</div>
<div>
<span class="elements">
<input name="multi.bar" type="text" class="is_input" />
</span>
</div>
</form>
HTML