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
|
use strict;
use warnings;
use Test::More tests => 2;
use HTML::FormFu;
#
# The HTML below should never be changed
# If necessary, the form config should be changed to show
# how to achieve legacy HTML generation
#
my $form = HTML::FormFu->new(
{ tt_args => { INCLUDE_PATH => 'share/templates/tt/xhtml' } } );
$form->load_config_file('t/bugs/pre_1_00_compat.yml');
is( "$form", <<HTML );
<form action="" id="formfu" method="post">
<fieldset>
<div class="text comment label">
<label for="formfu_foo">Foo</label>
<input name="foo" type="text" id="formfu_foo" />
<span class="comment">
The Foo
</span>
</div>
</fieldset>
</form>
HTML
$form->process( { foo => '', } );
is( "$form", <<HTML );
<form action="" id="formfu" method="post">
<fieldset>
<div class="text comment label error error_constraint_required">
<span class="error_message error_constraint_required">This field is required</span>
<label for="formfu_foo">Foo</label>
<input name="foo" type="text" value="" id="formfu_foo" />
<span class="comment">
The Foo
</span>
</div>
</fieldset>
</form>
HTML
|