use Test::More;
-plan tests => 68;
+plan tests => 76;
use_ok('HTML::Form::Simple');
my $form = HTML::Form::Simple->new;
ok($form, 'new form');
+# basics
+
+is(
+ $form->quote('<"test">'),
+ '<"test">',
+ 'quote'
+);
+
+is(
+ $form->quote(\'<"test">'),
+ '<"test">',
+ 'quote unquoted'
+);
+
+is(
+ $form->tag('foo'),
+ '<foo>',
+ 'tag'
+);
+
+is(
+ $form->tag('a "' => {'b"' => 'c"'}),
+ '<a " b"="c"">',
+ 'tag attributes'
+);
+
# form
is(
'multiple radio labels'
);
+is_deeply(
+ [ $form->radio(undef, [0, 1], undef, 0) ],
+ [
+ '<input checked type="radio" value="0">',
+ '<input type="radio" value="1">',
+ ],
+ 'radio default'
+);
+
is_deeply(
[ $form->radio(foo => ['foo', ''], 'test', {value => '', id => ''}) ],
[
[ $form->check(foo => ['bar', {name => 'bar'}], {name => 'ignored'}) ],
[
'<label><input id="foo_1" name="foo" type="checkbox" value="1"> bar</label>',
- '<input id="bar_2" name="bar" type="checkbox" value="2">',
+ '<input id="foo_2" name="bar" type="checkbox" value="2">',
],
'checkbox names'
);