1use strict; 2use warnings; 3 4use Test::More tests => 2; 5 6use HTML::FormFu; 7 8my $form = HTML::FormFu->new( 9 { tt_args => { INCLUDE_PATH => 'share/templates/tt/xhtml' } } ); 10 11my $foo = $form->element('Text')->name('foo')->label('My Foo'); 12my $bar = $form->element('Text')->name('bar'); 13 14$form->constraint( Number => 'foo' ); 15$form->constraint( Word => 'bar' ); 16$form->constraint( Required => 'foo', 'bar' ); 17 18my $foo_xhtml = qq{<div> 19<label>My Foo</label> 20<input name="foo" type="text" /> 21</div>}; 22 23is( "$foo", $foo_xhtml ); 24 25my $bar_xhtml = qq{<div> 26<input name="bar" type="text" /> 27</div>}; 28 29is( "$bar", $bar_xhtml ); 30