From 2bc81f7757ceca4aa3f9b0b85d431685eca87cf2 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Wed, 28 Jan 2009 16:39:38 +0000 Subject: [PATCH] fixing tests for Form changes --- t/Form/CheckList.t | 31 +++++++++++++++++-------------- t/Form/SelectList.t | 2 +- t/Shop/PayDriver.t | 10 +++++++++- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/t/Form/CheckList.t b/t/Form/CheckList.t index ba8d9e063..ea942e178 100644 --- a/t/Form/CheckList.t +++ b/t/Form/CheckList.t @@ -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' ); diff --git a/t/Form/SelectList.t b/t/Form/SelectList.t index 7322120a8..4961da8d8 100644 --- a/t/Form/SelectList.t +++ b/t/Form/SelectList.t @@ -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 diff --git a/t/Shop/PayDriver.t b/t/Shop/PayDriver.t index b5cd72b33..077c82195 100644 --- a/t/Shop/PayDriver.t +++ b/t/Shop/PayDriver.t @@ -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'