summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/tickets
diff options
context:
space:
mode:
authorwei <>2006-12-09 09:17:22 +0000
committerwei <>2006-12-09 09:17:22 +0000
commit3c03a42d1edb0ec26110ace00f42e156cabff67b (patch)
tree66baa1cd4afca87668be07e62406e7d538dd1fbb /tests/FunctionalTests/tickets
parent33b2284955a8f0015922d4c69c5082141b584f27 (diff)
Fixed #433, #384, #439, #477, #435, #422, #401, #359. Add more class docs for sqlmap.
Diffstat (limited to 'tests/FunctionalTests/tickets')
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket359.page40
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket359.php13
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket384.page51
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket384.php46
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket422.page25
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket422.php108
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket433.page6
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket433.php24
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket439.page6
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket439.php15
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket477.page29
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket477.php16
-rw-r--r--tests/FunctionalTests/tickets/tests/Ticket433TestCase.php18
-rw-r--r--tests/FunctionalTests/tickets/tests/Ticket439TestCase.php16
-rw-r--r--tests/FunctionalTests/tickets/tests/Ticket477TestCase.php24
15 files changed, 437 insertions, 0 deletions
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket359.page b/tests/FunctionalTests/tickets/protected/pages/Ticket359.page
new file mode 100644
index 00000000..036560e6
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket359.page
@@ -0,0 +1,40 @@
+<com:TContent ID="Content">
+<style>
+ .loader
+ {
+ position:absolute;
+ right:0px;
+ top:0px;
+ color:white;
+ background-color:#900;
+ padding: 0.5em 1em;
+ }
+ input.required
+ {
+ border: 1px solid red;
+ background-color: pink;
+ }
+</style>
+ <h1>Callback Custom Validator Test</h1>
+
+ <com:TTextBox ID="text1" />
+
+ <com:TActiveCustomValidator
+ ControlToValidate="text1"
+ ErrorMessage="*"
+ ControlCssClass="required"
+ OnServerValidate="validate_text1">
+ <prop:ClientSide
+ OnValidationError="$('status').innerHTML='Error '+(new Date())"
+ OnValidationSuccess="$('status').innerHTML='Success '+(new Date())"
+ OnLoading="Element.show('loader')"
+ OnComplete="Element.hide('loader')" />
+ </com:TActiveCustomValidator>
+
+ <span id="status"></span>
+
+ <com:TActiveButton Text="Submit" />
+
+ <span id="loader" style="display:none;" onfocus="alert('ok')" class="loader">Loading...</span>
+
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket359.php b/tests/FunctionalTests/tickets/protected/pages/Ticket359.php
new file mode 100644
index 00000000..1e544e9b
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket359.php
@@ -0,0 +1,13 @@
+<?php
+
+Prado::using('System.Web.UI.ActiveControls.*');
+
+class Ticket359 extends TPage
+{
+ function validate_text1($sender, $param)
+ {
+ $param->IsValid = $param->Value == 'Prado';
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket384.page b/tests/FunctionalTests/tickets/protected/pages/Ticket384.page
new file mode 100644
index 00000000..79e5c0c1
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket384.page
@@ -0,0 +1,51 @@
+<com:TContent ID="Content">
+<style>
+.autocomplete
+{
+ border:1px solid #919EA9;
+ background-color:white;
+}
+.autocomplete ul, .autocomplete li
+{
+ margin: 0;
+ padding: 0;
+ list-style: none;
+ font-size: 12px;
+ font-family: Tahoma, Arial, Helvetica, sans-serif;
+ color: #333;
+}
+
+ul.different
+{
+ background-color: pink;
+}
+
+.autocomplete li
+{
+ padding: 4px;
+ border-top: 1px solid #ccc;
+}
+
+.autocomplete .selected
+{
+ background-color: #ffc;
+}
+
+</style>
+
+<h1>Dynamic TAutoComplete Functional Test</h1>
+<com:TActivePanel ID="AutoCompletePanel">
+ <com:TRepeater ID="AutoCompleteRepeater">
+ <prop:ItemTemplate>
+ <com:TAutoComplete
+ Style="width: 20em"
+ ID="textbox1"
+ OnSuggest="Page.suggestCountries"
+ Separator=", "
+ ResultPanel.CssClass="autocomplete" />
+ </prop:ItemTemplate>
+ </com:TRepeater>
+</com:TActivePanel>
+
+<com:TActiveButton Text="Submit" OnClick="submitCallback"/>
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket384.php b/tests/FunctionalTests/tickets/protected/pages/Ticket384.php
new file mode 100644
index 00000000..e928632d
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket384.php
@@ -0,0 +1,46 @@
+<?php
+
+Prado::using('System.Web.UI.ActiveControls.*');
+
+class Ticket384 extends TPage
+{
+ public function initRecursive($namingContainer=null)
+ {
+ parent::initRecursive($namingContainer);
+ $this->AutoCompleteRepeater->setDataSource(array(1, 2));
+ $this->AutoCompleteRepeater->dataBind();
+ }
+
+ public function submitCallback($sender, $param)
+ {
+ $this->AutoCompleteRepeater->setDataSource(array(1,2,3,4));
+ $this->AutoCompleteRepeater->dataBind();
+ $this->AutoCompletePanel->render($this->getResponse()->createHtmlWriter());
+ }
+
+ public function suggestCountries($sender, $param)
+ {
+ $sender->setDataSource($this->matchCountries($param->getCallbackParameter()));
+ $sender->dataBind();
+ }
+
+ protected function matchCountries($token)
+ {
+ $info = Prado::createComponent('System.I18N.core.CultureInfo', 'en');
+ $list = array();
+ $count = 0;
+ $token = strtolower($token);
+ foreach($info->getCountries() as $country)
+ {
+ if(strpos(strtolower($country), $token) === 0)
+ {
+ $list[] = $country;
+ $count++;
+ if($count > 10) break;
+ }
+ }
+ return $list;
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket422.page b/tests/FunctionalTests/tickets/protected/pages/Ticket422.page
new file mode 100644
index 00000000..d6303d84
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket422.page
@@ -0,0 +1,25 @@
+<com:TContent ID="Content">
+
+<com:TActiveDropDownList
+ ID="list1"
+ AutoPostBack="true"
+ OnSelectedIndexChanged="list1_changed"/>
+
+<com:TActiveDropDownList
+ ID="list2"
+ Enabled="false"
+ AutoPostBack="true"
+ OnSelectedIndexChanged="list2_changed" />
+
+<div style="margin:1em; padding:1em; border:1px solid #ccc; text-align:center;">
+ <com:TActiveLabel ID="label1" Text="Label 1" />
+</div>
+
+<div style="margin:1em; padding:0.5em; text-align:center; border:1px solid #ccc;">
+ <com:TActiveButton ID="button1" Text="Select Index 3" OnClick="select_index_3" />
+ <com:TActiveButton ID="button2" Text="Clear selection" OnClick="clear_selections" />
+ <com:TActiveButton ID="button3" Text="Select Value 'value 2'" OnClick="select_value_2" />
+ <com:TActiveButton ID="button4" Text="Select Item 3 And Sub Item 3" OnClick="select_index_3_plus" />
+</div>
+
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket422.php b/tests/FunctionalTests/tickets/protected/pages/Ticket422.php
new file mode 100644
index 00000000..9a46ff75
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket422.php
@@ -0,0 +1,108 @@
+<?php
+
+Prado::using('System.Web.UI.ActiveControls.*');
+
+class Ticket422 extends TPage
+{
+ private $_listItemsA;
+ private $_listItemsB;
+
+ public function onInit($param)
+ {
+ parent::onInit($param);
+ $this->_listItemsA[] = array("title" => "Please select", "id" => -1,"category" => -1);
+ $this->_listItemsA[] = array("title" => "Item A", "id" => 1,"category" => 1);
+ $this->_listItemsA[] = array("title" => "Item B", "id" => 2,"category" => 1);
+ $this->_listItemsA[] = array("title" => "Item C", "id" => 3,"category" => 1);
+ $this->_listItemsA[] = array("title" => "Item D", "id" => 4,"category" => 1);
+ $this->_listItemsA[] = array("title" => "Item E", "id" => 5,"category" => 1);
+
+ $this->_listItemsB[] = array("title" => "List 2 Item A", "id" => 1,"category" => 1);
+ $this->_listItemsB[] = array("title" => "List 2 Item B", "id" => 2,"category" => 1);
+ $this->_listItemsB[] = array("title" => "List 2 Item C", "id" => 3,"category" => 1);
+ $this->_listItemsB[] = array("title" => "List 2 Item D", "id" => 4,"category" => 2);
+ $this->_listItemsB[] = array("title" => "List 2 Item E", "id" => 5,"category" => 2);
+ $this->_listItemsB[] = array("title" => "List 2 Item F", "id" => 6,"category" => 2);
+ $this->_listItemsB[] = array("title" => "List 2 Item G", "id" => 7,"category" => 3);
+ $this->_listItemsB[] = array("title" => "List 2 Item H", "id" => 8,"category" => 3);
+ $this->_listItemsB[] = array("title" => "List 2 Item I", "id" => 9,"category" => 3);
+ $this->_listItemsB[] = array("title" => "List 2 Item J", "id" => 10,"category" => 4);
+ $this->_listItemsB[] = array("title" => "List 2 Item K", "id" => 11,"category" => 4);
+ $this->_listItemsB[] = array("title" => "List 2 Item L", "id" => 12,"category" => 4);
+
+ $this->list1->DataValueField ='id';
+ $this->list1->DataTextField = 'title';
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->list1->DataSource = $this->_listItemsA;
+ $this->list1->dataBind();
+ }
+ }
+
+ function list1_changed($sender)
+ {
+ if ($sender->getSelectedValue() == -1)
+ {
+ $this->label1->setText("Please select a category");
+ $this->list2->setEnabled(false);
+ return;
+ }
+
+ $this->addOptionsToListProblem($sender->getSelectedValue());
+ }
+
+ function addOptionsToListProblem($parent)
+ {
+ $foo = array();
+ $bar = 0;
+ $sel = array("title" => "Please select", "id" => -1,"category" => -1);
+ $foo[] = $sel;
+ foreach ($this->_listItemsB as $p)
+ {
+ if ($p["category"] == $parent)
+ {
+ $foo[] = $p;
+ }
+ }
+
+ $this->list2->DataValueField = 'id';
+ $this->list2->DataTextField = 'title';
+ $this->list2->DataSource = $foo;
+ $this->list2->dataBind();
+ $this->list2->setEnabled(true);
+ }
+
+ function list2_changed($sender)
+ {
+ $this->label1->setText("Selection 2: ".$sender->getSelectedValue());
+ }
+
+ function select_index_3()
+ {
+ $this->list1->setSelectedIndex(3);
+ }
+
+ function clear_selections()
+ {
+ $this->list1->clearSelection();
+ }
+
+ function select_value_2()
+ {
+ $this->list1->setSelectedValue("value 2");
+ }
+
+ function select_index_3_plus()
+ {
+ $this->list1->setSelectedValue("value 3");
+ $this->list1_changed($this->list1);
+ $this->list2->setSelectedValue("value 3 - item 3");
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket433.page b/tests/FunctionalTests/tickets/protected/pages/Ticket433.page
new file mode 100644
index 00000000..b76245f5
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket433.page
@@ -0,0 +1,6 @@
+<com:TContent ID="Content">
+ <com:TActiveLinkButton
+ ID="VoteClick" Text=""
+ OnClick="Page.onUpdateVoteClick"
+ OnCallback="Page.onUpdateVoteCallback" />
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket433.php b/tests/FunctionalTests/tickets/protected/pages/Ticket433.php
new file mode 100644
index 00000000..2e5c1ff7
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket433.php
@@ -0,0 +1,24 @@
+<?php
+
+Prado::using('System.Web.UI.ActiveControls.*');
+
+class Ticket433 extends TPage
+{
+ public function onLoad($param)
+ {
+ if(!$this->IsPostBack)
+ $this->VoteClick->Text = "BEFORE click";
+ }
+
+ public function onUpdateVoteClick($sender, $param)
+ {
+ $sender->Text = 'AFTER click';
+ }
+
+ public function onUpdateVoteCallback($sender, $param)
+ {
+ $sender->Text .= ' CALLBACK DONE';
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket439.page b/tests/FunctionalTests/tickets/protected/pages/Ticket439.page
new file mode 100644
index 00000000..554696e2
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket439.page
@@ -0,0 +1,6 @@
+<com:TContent ID="Content">
+ <com:TActiveLinkButton
+ ID="button1"
+ Text="Goto Test Home"
+ OnClick="button_clicked"/>
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket439.php b/tests/FunctionalTests/tickets/protected/pages/Ticket439.php
new file mode 100644
index 00000000..eaebc250
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket439.php
@@ -0,0 +1,15 @@
+<?php
+
+Prado::using('System.Web.UI.ActiveControls.*');
+
+class Ticket439 extends TPage
+{
+
+ function button_clicked($sender, $param)
+ {
+ $page = $this->Service->constructUrl('Home');
+ $this->Response->redirect($page);
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket477.page b/tests/FunctionalTests/tickets/protected/pages/Ticket477.page
new file mode 100644
index 00000000..b7f23bc3
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket477.page
@@ -0,0 +1,29 @@
+<com:TContent ID="Content">
+
+<com:TCheckBoxList ID="list1" AutoPostBack="true" ValidationGroup="group1" >
+ <com:TListItem Text="Item 1" />
+ <com:TListItem Text="Item 2" />
+ <com:TListItem Text="Item 3" />
+</com:TCheckBoxList>
+
+<com:TCustomValidator
+ ID="validator1"
+ ControlToValidate="list1"
+ OnServerValidate="do_validate_1"
+ ValidationGroup="group1"
+ ErrorMessage="group1 error" />
+
+<com:TRadioButtonList ID="list2" AutoPostBack="true" ValidationGroup="group2" >
+ <com:TListItem Text="Item 1" />
+ <com:TListItem Text="Item 2" />
+ <com:TListItem Text="Item 3" />
+</com:TRadioButtonList>
+
+<com:TCustomValidator
+ ID="validator2"
+ ControlToValidate="list2"
+ OnServerValidate="do_validate_2"
+ ValidationGroup="group2"
+ ErrorMessage="group2 error" />
+
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket477.php b/tests/FunctionalTests/tickets/protected/pages/Ticket477.php
new file mode 100644
index 00000000..49c72b9e
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket477.php
@@ -0,0 +1,16 @@
+<?php
+
+class Ticket477 extends TPage
+{
+ function do_validate_1($sender, $param)
+ {
+ $param->IsValid=false;
+ }
+
+ function do_validate_2($sender, $param)
+ {
+ $param->IsValid=false;
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/tests/Ticket433TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket433TestCase.php
new file mode 100644
index 00000000..1bbfb7ec
--- /dev/null
+++ b/tests/FunctionalTests/tickets/tests/Ticket433TestCase.php
@@ -0,0 +1,18 @@
+<?php
+
+class Ticket433TestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $base = 'ctl0_Content_';
+ $this->open('tickets/index.php?page=Ticket433');
+ $this->assertTitle("Verifying Ticket 433");
+ $this->assertText("{$base}VoteClick", "BEFORE click");
+
+ $this->click("{$base}VoteClick");
+ $this->pause(800);
+ $this->assertText("{$base}VoteClick", "AFTER click CALLBACK DONE");
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/tests/Ticket439TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket439TestCase.php
new file mode 100644
index 00000000..8ba47e87
--- /dev/null
+++ b/tests/FunctionalTests/tickets/tests/Ticket439TestCase.php
@@ -0,0 +1,16 @@
+<?php
+
+class Ticket439TestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $base = 'ctl0_Content_';
+ $this->open('tickets/index.php?page=Ticket439');
+ $this->assertTitle("Verifying Ticket 439");
+ $this->click("{$base}button1");
+ $this->waitForPageToLoad(3000);
+ $this->pause(800);
+ $this->assertTitle("Verifying Ticket Home");
+ }
+}
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/tests/Ticket477TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket477TestCase.php
new file mode 100644
index 00000000..ea32ff5f
--- /dev/null
+++ b/tests/FunctionalTests/tickets/tests/Ticket477TestCase.php
@@ -0,0 +1,24 @@
+<?php
+
+class Ticket477TestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $base = 'ctl0_Content_';
+ $this->open('tickets/index.php?page=Ticket477');
+ $this->assertTitle("Verifying Ticket 477");
+ $this->assertNotVisible("{$base}validator1");
+ $this->assertNotVisible("{$base}validator2");
+
+ $this->clickAndWait("{$base}list1_c1");
+ $this->assertVisible("{$base}validator1");
+ $this->assertNotVisible("{$base}validator2");
+
+
+ $this->clickAndWait("{$base}list2_c1");
+ $this->assertNotVisible("{$base}validator1");
+ $this->assertVisible("{$base}validator2");
+ }
+}
+
+?> \ No newline at end of file