use strict; use warnings; use Test::More tests => 3; use HTML::FormFu; my $form = HTML::FormFu->new({ tt_args => { INCLUDE_PATH => 'share/templates/tt/xhtml' } }); $form->form_error_message_loc('form_error_message'); my $field = $form->element('Text'); $field->name('foo'); $field->constraint('Number'); unlike( "$form", qr/there were errors/i ); $form->process( { foo => '1', } ); unlike( "$form", qr/there were errors/i ); $form->process( { foo => 'a', } ); my $xhtml = <
There were errors with your submission, see below for details
This field must be a number
EOF is( "$form", $xhtml );