Debian Codegraph @

t/repeatable/constraints/attach_errors_to.t

raw symbols SCIP
1 use strict;
2 use warnings;
3
4 use Test::More tests => 5;
5
6 use HTML::FormFu;
7 use lib 't/lib';
8 use HTMLFormFu::TestLib;
9
10 my $form = HTML::FormFu->new(
11 { tt_args => { INCLUDE_PATH => 'share/templates/tt/xhtml' } } );
12
13 $form->load_config_file('t/repeatable/constraints/attach_errors_to.yml');
14
15 $form->get_element( { type => 'Repeatable' } )->repeat(2);
16
17 # Missing - Invalid
18 {
19 $form->process(
20 { 'rep_1.foo' => 'AAA',
21 'rep_1.bar' => '',
22 count => 1,
23 } );
24
25 ok( !$form->submitted_and_valid );
26
27 ok( $form->has_errors('rep_1.foo') );
28 ok( $form->has_errors('rep_1.bar') );
29
30 like( $form->get_field( { nested_name => 'rep_1.foo' } ), qr/Error/ );
31 like( $form->get_field( { nested_name => 'rep_1.bar' } ), qr/Error/ );
32 }
33