fixing tests for Form changes

This commit is contained in:
Graham Knop 2009-01-28 16:39:38 +00:00
parent 744751a86f
commit 2bc81f7757
3 changed files with 27 additions and 16 deletions

View file

@ -32,7 +32,7 @@ my $session = WebGUI::Test->session;
my $formClass = 'WebGUI::Form::CheckList';
my $formType = 'Checkbox';
my $numTests = 20;
my $numTests = 23;
plan tests => $numTests;
@ -61,19 +61,22 @@ my @forms = HTML::Form->parse($html, 'http://www.webgui.org');
is(scalar @forms, 1, '1 form was parsed to test basic functionality');
my @inputs = $forms[0]->inputs;
is(scalar @inputs, 3, 'The form has 3 inputs');
is(scalar @inputs, 4, 'The form has 3 inputs');
#Basic tests
is($inputs[0]->name, 'CList1', 'Checking input name for checkbox 1');
is($inputs[0]->type, 'checkbox', 'Checking input type for checkbox 1');
is($inputs[0]->value, 'foo', 'Checking default value for checkbox 1');
is($inputs[1]->name, 'CList1', 'Checking input name for checkbox 2');
is($inputs[1]->type, 'checkbox', 'Checking input type for checkbox 2');
is($inputs[1]->value, undef, 'Checking default value for checkbox 2');
is($inputs[2]->name, 'CList1', 'Checking input name for checkbox 3');
is($inputs[2]->type, 'checkbox', 'Checking input type for checkbox 3');
is($inputs[2]->value, undef, 'Checking default value for checkbox 3');
is($inputs[0]->name, '__CList1_isIn', 'Checking input name for hidden element');
is($inputs[0]->type, 'hidden', 'Checking input type for hidden element');
is($inputs[0]->value, '1', 'Checking default value for hidden element');
is($inputs[1]->name, 'CList1', 'Checking input name for checkbox 1');
is($inputs[1]->type, 'checkbox', 'Checking input type for checkbox 1');
is($inputs[1]->value, 'foo', 'Checking default value for checkbox 1');
is($inputs[2]->name, 'CList1', 'Checking input name for checkbox 2');
is($inputs[2]->type, 'checkbox', 'Checking input type for checkbox 2');
is($inputs[2]->value, undef, 'Checking default value for checkbox 2');
is($inputs[3]->name, 'CList1', 'Checking input name for checkbox 3');
is($inputs[3]->type, 'checkbox', 'Checking input type for checkbox 3');
is($inputs[3]->value, undef, 'Checking default value for checkbox 3');
@ -92,10 +95,10 @@ my $html = join "\n",
is(scalar @forms, 1, '1 form was parsed to test showSelectAll');
@inputs = $forms[0]->inputs;
is(scalar @inputs, 4, 'The form has 4 inputs (1 button + 3 checkboxes)');
is(scalar @inputs, 5, 'The form has 5 inputs (1 hidden, 1 button, 3 checkboxes)');
is($inputs[0]->type, 'button', 'The Select All button is there and before all checkboxes');
is( $inputs[0]->{value},
is($inputs[1]->type, 'button', 'The Select All button is there and before all checkboxes');
is( $inputs[1]->{value},
WebGUI::International->new($session,"Form_CheckList")->get("selectAll label"),
'The value is internationalized'
);

View file

@ -89,7 +89,7 @@ is(scalar @forms, 1, '1 form was parsed');
my $form = $forms[0];
#use Data::Dumper;
my @inputs = $form->inputs;
is(scalar @inputs, 6, 'The form has 6 inputs');
is(scalar @inputs, 7, 'The form has 7 inputs');
#Basic tests

View file

@ -286,7 +286,7 @@ my @forms = HTML::Form->parse($html, 'http://www.webgui.org');
is (scalar @forms, 1, 'getEditForm generates just 1 form');
my @inputs = $forms[0]->inputs;
is (scalar @inputs, 11, 'getEditForm: the form has 11 controls');
is (scalar @inputs, 13, 'getEditForm: the form has 13 controls');
my @interestingFeatures;
foreach my $input (@inputs) {
@ -334,6 +334,10 @@ cmp_deeply(
name => 'groupToUse',
type => 'option',
},
{
name => '__groupToUse_isIn',
type => 'hidden',
},
{
name => 'receiptEmailTemplateId',
type => 'option',
@ -342,6 +346,10 @@ cmp_deeply(
name => 'saleNotificationGroupId',
type => 'option',
},
{
name => '__saleNotificationGroupId_isIn',
type => 'hidden',
},
],
'getEditForm made the correct form with all the elements'