Fix Hidden, Radio and Checkbox, which wouldn't allow
a value of zero to be set in them. It was translated to the empty string.
This commit is contained in:
parent
fd7a1d28a1
commit
c930c73d67
6 changed files with 70 additions and 7 deletions
|
|
@ -45,7 +45,7 @@ my $testBlock = [
|
|||
my $formClass = 'WebGUI::Form::Checkbox';
|
||||
my $formType = 'Checkbox';
|
||||
|
||||
my $numTests = 7 + scalar @{ $testBlock } + 3;
|
||||
my $numTests = 8 + scalar @{ $testBlock } + 3;
|
||||
|
||||
|
||||
plan tests => $numTests;
|
||||
|
|
@ -101,6 +101,18 @@ $html = join "\n",
|
|||
@forms = HTML::Form->parse($html, 'http://www.webgui.org');
|
||||
is( $forms[0]->param('cbox3'), ' ', 'WRONG: whitespace value');
|
||||
|
||||
$html = join "\n",
|
||||
$header,
|
||||
$formClass->new($session, {
|
||||
name => 'cbox0',
|
||||
value => 0,
|
||||
checked => 1,
|
||||
})->toHtml,
|
||||
$footer;
|
||||
|
||||
@forms = HTML::Form->parse($html, 'http://www.webgui.org');
|
||||
is( $forms[0]->param('cbox0'), 0, 'zero is a valid value');
|
||||
|
||||
##Test Form Output parsing
|
||||
|
||||
WebGUI::Form_Checking::auto_check($session, $formType, $testBlock);
|
||||
|
|
|
|||
|
|
@ -59,11 +59,17 @@ my $testBlock = [
|
|||
expected => 'EQUAL',
|
||||
comment => 'white space',
|
||||
},
|
||||
{
|
||||
key => 'Hidden6',
|
||||
testValue => 0,
|
||||
expected => 'EQUAL',
|
||||
comment => 'zero',
|
||||
},
|
||||
];
|
||||
|
||||
my $formClass = 'WebGUI::Form::Hidden';
|
||||
|
||||
my $numTests = 5 + scalar @{ $testBlock } + 1;
|
||||
my $numTests = 7 + scalar @{ $testBlock } + 1;
|
||||
|
||||
|
||||
plan tests => $numTests;
|
||||
|
|
@ -96,6 +102,20 @@ is($input->value, 'hiddenData', 'Checking default value');
|
|||
|
||||
##no need for secondary checking for now
|
||||
|
||||
$html = join "\n",
|
||||
$header,
|
||||
$formClass->new($session, {
|
||||
name => 'hiddenZero',
|
||||
value => 0,
|
||||
})->toHtml,
|
||||
$footer;
|
||||
|
||||
@forms = HTML::Form->parse($html, 'http://www.webgui.org');
|
||||
@inputs = $forms[0]->inputs;
|
||||
$input = $inputs[0];
|
||||
is($input->name, 'hiddenZero', 'Checking input name for zero input');
|
||||
is($input->value, 0, 'Checking value for zero input');
|
||||
|
||||
##Test Form Output parsing
|
||||
|
||||
WebGUI::Form_Checking::auto_check($session, 'Hidden', $testBlock);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ my $testBlock = [
|
|||
my $formClass = 'WebGUI::Form::Radio';
|
||||
my $formType = 'Radio';
|
||||
|
||||
my $numTests = 7 + scalar @{ $testBlock } + 1;
|
||||
my $numTests = 8 + scalar @{ $testBlock } + 1;
|
||||
|
||||
|
||||
plan tests => $numTests;
|
||||
|
|
@ -100,6 +100,18 @@ $html = join "\n",
|
|||
@forms = HTML::Form->parse($html, 'http://www.webgui.org');
|
||||
is( $forms[0]->param('radio2'), ' ', 'WRONG: whitespace value');
|
||||
|
||||
$html = join "\n",
|
||||
$header,
|
||||
$formClass->new($session, {
|
||||
name => 'radio3',
|
||||
value => 0,
|
||||
checked => 1,
|
||||
})->toHtml,
|
||||
$footer;
|
||||
|
||||
@forms = HTML::Form->parse($html, 'http://www.webgui.org');
|
||||
is( $forms[0]->param('radio3'), 0, 'zero is a valid value');
|
||||
|
||||
##Test Form Output parsing
|
||||
|
||||
WebGUI::Form_Checking::auto_check($session, $formType, $testBlock);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue