XXX: multiple check values
[perl/html-form-simple.git] / t / html.t
index b7568b079cfa9ea14bfc9d0300c9d5d78009e008..c646cdb9810cbcb60314445f6cb2d3c8284825f5 100644 (file)
--- a/t/html.t
+++ b/t/html.t
@@ -5,7 +5,7 @@ use warnings;
 
 use Test::More;
 
-plan tests => 47;
+plan tests => 50;
 
 use_ok('HTML::Form::Simple');
 
@@ -330,28 +330,50 @@ is(
 );
 
 is(
-       $form->check(foo => 'test', {value => undef}),
-       '<label><input id="foo" name="foo" type="checkbox"> test</label>',
-       'check parameters'
+       $form->check(foo => '<">'),
+       '<label><input id="foo_1" name="foo" type="checkbox" value="1"> <"></label>',
+       'labeled checkbox'
 );
 
 is(
-       $form->check(undef, '', 1),
-       '<input checked type="checkbox" value="1">',
-       'simple checkbox'
+       $form->check(foo => {label => 'test', value => undef}, {disabled => 1}),
+       '<label><input disabled id="foo" name="foo" type="checkbox"> test</label>',
+       'check parameters'
+);
+
+is_deeply(
+       [ $form->check(undef, '', 1) ],
+       [ '<input checked type="checkbox" value="1">' ],
+       'anonymous checkbox'
 );
 
-TODO: {
-       local $TODO = 'shorthand';
 is_deeply(
        [ $form->check(undef, ['', '<">']) ],
        [
-               '<input checked type="checkbox" value="1">',
-               '<label><input checked type="checkbox" value="2"> &lt;&quot;></label>',
+               '<input type="checkbox" value="1">',
+               '<label><input type="checkbox" value="2"> <"></label>',
        ],
        'multiple checkboxes'
 );
-};
+
+is_deeply(
+       [ $form->check(undef, [{}, undef], 1) ],
+       [
+               '<input checked type="checkbox" value="1">',
+               '<input checked type="checkbox" value="2">',
+       ],
+       'multiple checked checkboxes'
+);
+
+is_deeply(
+       [ $form->check(undef, [{value => 4, type => 'radio'}], [1, 0, 0], {value => 3}) ],
+       [
+               '<input checked type="radio" value="4">',
+               '<input type="checkbox" value="2">',
+               '<input checked type="checkbox" value="3">',
+       ],
+       'various checkboxes'
+);
 
 #TODO