X-Git-Url: http://git.shiar.net/perl/html-form-simple.git/blobdiff_plain/48891d33a852d6db31113e4e7c10e1cda5771ce3..61dd576040bbb86eb8925c1c80a830bfa998eb41:/t/html.t diff --git a/t/html.t b/t/html.t index b4420e1..89f82a1 100644 --- a/t/html.t +++ b/t/html.t @@ -5,7 +5,7 @@ use warnings; use Test::More; -plan tests => 59; +plan tests => 65; use_ok('HTML::Form::Simple'); @@ -455,5 +455,43 @@ is_deeply( 'various checkboxes' ); +# defaults + +my $defform = HTML::Form::Simple->new({foo => '<">', '' => 'empty', 0 => 0}); +ok($defform, 'form with defaults'); + +is( + $defform->hidden(''), + '', + 'hidden with default' +); + +is( + $defform->hidden(undef), + '', + 'nameless hidden' +); + +is( + $defform->text('foo'), + '', + 'input with default' +); + +is( + $defform->text('foo', {value => 'custom'}), + '', + 'input with value and default' +); + +is_deeply( + [ $defform->radio(0 => undef, [1, 0]) ], + [ + '', + '', + ], + 'select with default' +); + #TODO