input method should be named text()
authorMischa Poslawsky <mischa@mediadesign.nl>
Thu, 31 Jul 2008 10:48:31 +0000 (12:48 +0200)
committerMischa Poslawsky <mischa@mediadesign.nl>
Thu, 31 Jul 2008 17:28:36 +0000 (19:28 +0200)
Thinko: while it does create an input tag, it's specifically for text
input elements.  Was already documented as text().

lib/HTML/Form/Simple.pm
t/html.t

index 730c41bc25b8c361738b2fa6ec5085856289c1e0..3a58c799761a27e880891e321a7ec375166b75c4 100644 (file)
@@ -88,7 +88,7 @@ sub hidden {
        return $self->tag(input => $attr);
 }
 
-sub input {
+sub text {
        my $self = shift;
        my ($name, $value, $attr) = $self->_attr(2, @_);
 
index a9ee150c42778b3b8a7a46d135c01fb661c0a15c..2fea804b2353d89b0eeb9d07dc09b83047150aef 100644 (file)
--- a/t/html.t
+++ b/t/html.t
@@ -118,43 +118,43 @@ is(
 # input
 
 is(
-       $form->input,
+       $form->text,
        '<input type="text">',
        'empty input'
 );
 
 is(
-       $form->input(undef, undef, undef),
+       $form->text(undef, undef, undef),
        '<input type="text">',
        'explicit empty input'
 );
 
 is(
-       $form->input('test'),
+       $form->text('test'),
        '<input id="test" name="test" type="text">',
        'input with name'
 );
 
 is(
-       $form->input(undef, 'test'),
+       $form->text(undef, 'test'),
        '<input type="text" value="test">',
        'input with value'
 );
 
 is(
-       $form->input(undef, {value => 'test'}),
+       $form->text(undef, {value => 'test'}),
        '<input type="text" value="test">',
        'input with attribute value'
 );
 
 is(
-       $form->input({name => 'test', value => ''}),
+       $form->text({name => 'test', value => ''}),
        '<input id="test" name="test" type="text" value="">',
        'input with only attributes'
 );
 
 is(
-       $form->input('', '', {
+       $form->text('', '', {
                disabled => 0,
                something => undef,
                class => undef,
@@ -167,31 +167,31 @@ is(
 );
 
 is(
-       $form->input(undef, undef, {name => '0', value => '0'}),
+       $form->text(undef, undef, {name => '0', value => '0'}),
        '<input id="0" name="0" type="text" value="0">',
        'input overrides'
 );
 
 is(
-       $form->input('name', {id => ''}),
+       $form->text('name', {id => ''}),
        '<input name="name" type="text">',
        'input with id override'
 );
 
 is(
-       $form->input('<">', '<">', {id => '>"<'}),
+       $form->text('<">', '<">', {id => '>"<'}),
        '<input id=">&quot;&lt;" name="&lt;&quot;>" type="text" value="&lt;&quot;>">',
        'input quoting'
 );
 
 is(
-       $form->input(undef, {disabled => 'something'}),
+       $form->text(undef, {disabled => 'something'}),
        '<input disabled type="text">',
        'disabled input'
 );
 
 is(
-       $form->input({type => 'password'}),
+       $form->text({type => 'password'}),
        '<input type="password">',
        'password'
 );
@@ -199,19 +199,19 @@ is(
 # textarea
 
 is(
-       $form->input({rows => 0}),
+       $form->text({rows => 0}),
        '<textarea rows="0"></textarea>',
        'minimal textarea'
 );
 
 is(
-       $form->input(foo => 'bar', {cols => 42, rows => 1, disabled => 1}),
+       $form->text(foo => 'bar', {cols => 42, rows => 1, disabled => 1}),
        '<textarea disabled cols="42" id="foo" name="foo" rows="1">bar</textarea>',
        'textarea'
 );
 
 is(
-       $form->input(undef, qq{<foo>&bl'a"\n    .}, {cols => undef, rows => '<">'}),
+       $form->text(undef, qq{<foo>&bl'a"\n    .}, {cols => undef, rows => '<">'}),
        qq{<textarea rows="&lt;&quot;>">&lt;foo>&amp;bl'a&quot;\n    .</textarea>},
        'textarea quoting'
 );