do not quote scalar refs to pass literal html
[perl/html-form-simple.git] / t / html.t
index a3ac7996e530800210755a21afff19af0f89fe7e..a82c916d0b5fbecf87531d0f5538bf539b4a2c8a 100644 (file)
--- a/t/html.t
+++ b/t/html.t
@@ -5,13 +5,39 @@ use warnings;
 
 use Test::More;
 
-plan tests => 72;
+plan tests => 76;
 
 use_ok('HTML::Form::Simple');
 
 my $form = HTML::Form::Simple->new;
 ok($form, 'new form');
 
+# basics
+
+is(
+       $form->quote('<"test">'),
+       '&lt;&quot;test&quot;>',
+       'quote'
+);
+
+is(
+       $form->quote(\'<"test">'),
+       '<"test">',
+       'quote unquoted'
+);
+
+is(
+       $form->tag('foo'),
+       '<foo>',
+       'tag'
+);
+
+is(
+       $form->tag('a "' => {'b"' => 'c"'}),
+       '<a " b"="c&quot;">',
+       'tag attributes'
+);
+
 # form
 
 is(
@@ -472,7 +498,7 @@ is_deeply(
        [ $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'
 );