X-Git-Url: http://git.shiar.net/perl/html-form-simple.git/blobdiff_plain/cb6c92feb70f4246804078114bb8ef37874ab1cd..2ee16ffeffbdd0998c60f36a976169789e3c8e27:/t/html.t diff --git a/t/html.t b/t/html.t index c646cdb..a9ee150 100644 --- a/t/html.t +++ b/t/html.t @@ -5,7 +5,7 @@ use warnings; use Test::More; -plan tests => 50; +plan tests => 55; use_ok('HTML::Form::Simple'); @@ -52,7 +52,42 @@ is( 'hidden' ); -#TODO: hidden options +is( + $form->hidden(undef, undef, {value => 'bar', name => 'foo', id => 'foo'}), + '', + 'hidden options' +); + +is_deeply( + [ $form->hidden(foo => [1, 0], {class => 'test'}) ], + [ + '', + '', + ], + 'hidden array' +); + +is_deeply( + [ $form->hidden({2 => 0, 10 => 1}, {class => 'test'}) ], + [ + '', + '', + ], + 'hidden hash' +); + +{ + local $, = "\n"; + is( + scalar $form->hidden({2 => [1, 0], 10 => 2}, {class => 'test'}), + join("\n", + '', + '', + '', + ), + 'scalar hiddens' + ); +} # submit @@ -282,7 +317,7 @@ is( ); is( - $form->radio(foo => undef, [2]), #TODO + $form->radio(foo => undef, 2), '', 'labelless radio' ); @@ -365,6 +400,18 @@ is_deeply( 'multiple checked checkboxes' ); +{ + local $, = ' | '; + is( + scalar $form->check(foo => [1, 0], {value => 0}), + join(' | ', + '', + '', + ), + 'merged checkboxes' + ); +} + is_deeply( [ $form->check(undef, [{value => 4, type => 'radio'}], [1, 0, 0], {value => 3}) ], [