sub radio {
my $self = shift;
- my ($name, $rows, $label, $attr) = $self->_attr(3, @_);
+ my ($name, $rows, $label, $default, $attr) = $self->_attr(4, @_);
if (not defined $rows) {
if (defined $label) {
}
}
- $self->select($name, $rows, {%$attr, type => 'radio'});
+ $self->select($name, $rows, $default, {%$attr, type => 'radio'});
}
sub check {
use Test::More;
-plan tests => 68;
+plan tests => 72;
use_ok('HTML::Form::Simple');
'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 => ''}) ],
[