summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/active-controls/protected/pages
diff options
context:
space:
mode:
authorwei <>2006-06-17 01:55:05 +0000
committerwei <>2006-06-17 01:55:05 +0000
commitb3ceed048bb533a00bbea542f7c12b49c8c83d9b (patch)
tree97962fc3cb6746ae404c4f1d0095834bbb0e1ac7 /tests/FunctionalTests/active-controls/protected/pages
parent6c0154fb4e292ad22667e618f598a37cc5f9d524 (diff)
Update changes to active controls, add FT tests for active controls, add comments.
Diffstat (limited to 'tests/FunctionalTests/active-controls/protected/pages')
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/ActiveButtonTest.page9
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/ActiveButtonTest.php16
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.page22
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.php12
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/ActiveTextBoxCallback.page5
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/ActiveTextBoxCallback.php11
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.page48
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php34
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/Calculator.page31
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/Calculator.php12
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/CallbackOptionsTest.page34
-rwxr-xr-xtests/FunctionalTests/active-controls/protected/pages/FeatureList.page3
-rwxr-xr-xtests/FunctionalTests/active-controls/protected/pages/FeatureList.php34
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/Home.page1
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.page28
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.php19
16 files changed, 319 insertions, 0 deletions
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveButtonTest.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveButtonTest.page
new file mode 100644
index 00000000..5c2d1abb
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveButtonTest.page
@@ -0,0 +1,9 @@
+<com:TForm ID="form1">
+ <h1>TActiveButton Functional Test</h1>
+ <com:TActiveButton ID="button2" Text="Button 1"
+ OnClick="button2_onclick" OnCallback="button2_oncallback" />
+
+ <com:TActiveLabel ID="label1" Text="Label 1" />
+
+ <com:TJavascriptLogger />
+</com:TForm> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveButtonTest.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveButtonTest.php
new file mode 100644
index 00000000..6282b804
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveButtonTest.php
@@ -0,0 +1,16 @@
+<?php
+
+class ActiveButtonTest extends TPage
+{
+ function button2_onclick($sender, $param)
+ {
+ $this->label1->Text = "Button 1 was clicked ";
+ }
+
+ function button2_oncallback($sender, $param)
+ {
+ $this->label1->Text .= "using callback!";
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.page b/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.page
new file mode 100644
index 00000000..468a524e
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.page
@@ -0,0 +1,22 @@
+<com:TForm ID="form1">
+ <h1>Active Panel replacement tests </h1>
+ <com:TCallback ID="callback1" OnCallback="callback1_requested" />
+ <com:TActivePanel ID="panel1">
+ <com:TPlaceHolder ID="content1" Visible="false">
+ Something lalala <com:TButton ID="button1" Text="Button Text"/>
+ </com:TPlaceHolder>
+ </com:TActivePanel>
+ <div id="div1" style="border:1px solid #666; background-color: #ffe; text-align: center; padding:3em">
+ Click Me!
+ </div>
+ <script type="text/javascript">
+ Event.OnLoad(function()
+ {
+ Event.observe($("div1"), "click", function()
+ {
+ Prado.Callback("<%= $this->callback1->ClientID %>")
+ })
+ })
+ </script>
+ <com:TJavascriptLogger />
+</com:TForm> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.php b/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.php
new file mode 100644
index 00000000..79e3d46c
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.php
@@ -0,0 +1,12 @@
+<?php
+
+class ActivePanelTest extends TPage
+{
+ function callback1_requested($sender, $param)
+ {
+ $this->content1->visible = true;
+ $this->panel1->flush($param->output);
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveTextBoxCallback.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveTextBoxCallback.page
new file mode 100644
index 00000000..d0a750ac
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveTextBoxCallback.page
@@ -0,0 +1,5 @@
+<com:TForm ID="form1">
+ <h1>ActiveTextBox Callback Test</h1>
+ <com:TActiveTextBox ID="textbox1" AutoPostBack="true" OnCallback="textbox1_callback" />
+ <com:TActiveLabel ID="label1" Text="Label 1" />
+</com:TForm> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveTextBoxCallback.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveTextBoxCallback.php
new file mode 100644
index 00000000..c3f729e5
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveTextBoxCallback.php
@@ -0,0 +1,11 @@
+<?php
+
+class ActiveTextBoxCallback extends TPage
+{
+ function textbox1_callback($sender, $param)
+ {
+ $this->label1->Text = 'Label 1: '.$sender->Text;
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.page b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.page
new file mode 100644
index 00000000..93658bd7
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.page
@@ -0,0 +1,48 @@
+<com:TForm ID="form1">
+
+ <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;
+ }
+
+ .autocomplete li
+ {
+ padding: 4px;
+ border-top: 1px solid #ccc;
+ }
+ .autocomplete .selected
+ {
+ background-color: #ffc;
+ }
+ </style>
+
+ <h1>TAutoComplete Test</h1>
+
+ <com:TAutoComplete Style="width: 20em"
+ OnCallback="suggestCountries"
+ Separator=", "
+ ResultPanel.CssClass="autocomplete" />
+
+ <p><br /></p>
+ <p><br /></p>
+ <p><br /></p>
+ <p><br /></p>
+ <p><br /></p>
+ <p><br /></p>
+ <p><br /></p>
+ <p><br /></p>
+ <p><br /></p>
+ <p><br /></p>
+ <com:TJavascriptLogger />
+</com:TForm> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php
new file mode 100644
index 00000000..938b8640
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php
@@ -0,0 +1,34 @@
+<?php
+/*
+ * Created on 7/05/2006
+ */
+
+class AutoCompleteTest extends TPage
+{
+ public function suggestCountries($sender, $param)
+ {
+ $sender->setDataSource($this->matchCountries($param->getParameter()));
+ $sender->dataBind();
+ $sender->render($param->getOutput());
+ }
+
+ 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/active-controls/protected/pages/Calculator.page b/tests/FunctionalTests/active-controls/protected/pages/Calculator.page
new file mode 100644
index 00000000..7a565658
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/Calculator.page
@@ -0,0 +1,31 @@
+<com:TForm ID="form1">
+ <h1>Callback Enabled Calculator</h1>
+
+ <com:TActiveTextBox id="a" />
+ +
+ <com:TActiveTextBox id="b" />
+ =
+ <com:TActiveTextBox id="c" />
+
+ <com:TActiveButton id="sum"
+ onclick="do_sum"
+ text="Calculate!" />
+
+ <com:TRequiredFieldValidator
+ ControlToValidate="a"
+ ErrorMessage="left summand is required."
+ ControlCssClass="required"
+ Display="None" />
+ <com:TRequiredFieldValidator
+ ControlToValidate="b"
+ ErrorMessage="right summand is requied."
+ ControlCssClass="required"
+ Display="None" />
+
+ <div class="summarybox">
+ <com:TValidationSummary
+ ID="summary"
+ HeaderText="Unable to calculate because" />
+ </div>
+
+</com:TForm> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/Calculator.php b/tests/FunctionalTests/active-controls/protected/pages/Calculator.php
new file mode 100644
index 00000000..098a8460
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/Calculator.php
@@ -0,0 +1,12 @@
+<?php
+
+class Calculator extends TPage
+{
+ public function do_sum($sender, $param)
+ {
+ $this->c->Text = floatval($this->a->Text) + floatval($this->b->Text);
+ }
+}
+
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/CallbackOptionsTest.page b/tests/FunctionalTests/active-controls/protected/pages/CallbackOptionsTest.page
new file mode 100644
index 00000000..6e8b8a1e
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/CallbackOptionsTest.page
@@ -0,0 +1,34 @@
+<com:TForm ID="form1">
+ <h1>TCallbackOptions Test</h1>
+
+ <com:TCallbackOptions ID="options1">
+ <prop:ClientSide.OnLoading>
+ $("status").show();
+ </prop:ClientSide.OnLoading>
+ <prop:ClientSide.OnComplete>
+ $("status").hide();
+ </prop:ClientSide.OnComplete>
+ <prop:ClientSide.OnSuccess>
+ Element.update("label1", "Button 1 has returned");
+ </prop:ClientSide.OnSuccess>
+ </com:TCallbackOptions>
+
+ <com:TActiveButton id="button1" Text="Button 1" ActiveControl.CallbackOptions="options1" />
+ <com:TActiveButton id="button2" Text="Button 2" ActiveControl.CallbackOptions="options1">
+ <prop:ActiveControl.ClientSide.OnSuccess>
+ Element.update("label2", "Button 2 has returned");
+ </prop:ActiveControl.ClientSide.OnSuccess>
+ </com:TActiveButton>
+ <com:TActiveButton id="button3" Text="Button 3">
+ <prop:ActiveControl.ClientSide.OnSuccess>
+ Element.update("label3", "Button 3 has returned");
+ </prop:ActiveControl.ClientSide.OnSuccess>
+ </com:TActiveButton>
+
+ <div id="label1">Label 1</div>
+ <div id="label2">Label 2</div>
+ <div id="label3">Label 3</div>
+ <div id="status" style="display:none; background-color: #c00; color:white; text-align:center; padding: 1em" >
+ Loading...
+ </div>
+</com:TForm> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/FeatureList.page b/tests/FunctionalTests/active-controls/protected/pages/FeatureList.page
new file mode 100755
index 00000000..eab14a87
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/FeatureList.page
@@ -0,0 +1,3 @@
+<com:TForm ID="form1">
+ <com:TBulletedList ID="List" DisplayMode="HyperLink"/>
+</com:TForm>
diff --git a/tests/FunctionalTests/active-controls/protected/pages/FeatureList.php b/tests/FunctionalTests/active-controls/protected/pages/FeatureList.php
new file mode 100755
index 00000000..8f28f6de
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/FeatureList.php
@@ -0,0 +1,34 @@
+<?php
+
+class FeatureList extends TPage
+{
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ $list=$this->getPageList(dirname(__FILE__),'');
+ $this->List->DataSource=$list;
+ $this->List->dataBind();
+ }
+
+ protected function getPageList($directory,$basePath)
+ {
+ $list=array();
+ $folder=@opendir($directory);
+ while($entry=@readdir($folder))
+ {
+ if($entry[0]==='.')
+ continue;
+ else if(is_file($directory.'/'.$entry))
+ {
+ if(($page=basename($entry,'.page'))!==$entry && strpos($page,'.')===false)
+ $list['?page='.$basePath.$page]=$basePath.$page;
+ }
+ else
+ $list=array_merge($list,$this->getPageList($directory.'/'.$entry,$basePath.$entry.'.'));
+ }
+ closedir($folder);
+ return $list;
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/Home.page b/tests/FunctionalTests/active-controls/protected/pages/Home.page
new file mode 100644
index 00000000..ff226d4e
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/Home.page
@@ -0,0 +1 @@
+<h1>Welcome to Prado!</h1> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.page b/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.page
new file mode 100644
index 00000000..d8eacf15
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.page
@@ -0,0 +1,28 @@
+<com:TForm ID="form1">
+ <h1>Nested Active Controls Test</h1>
+ <com:TCallback ID="callback1" OnCallback="callback1_requested" />
+ <com:TActivePanel ID="panel1">
+ <com:TPlaceHolder ID="content1" Visible="false">
+ Something lalala
+ <com:TActiveButton ID="button1" Text="Button 1" OnClick="button1_clicked" />
+ <com:TActiveLabel ID="label3" Text="Label 3" />
+
+ </com:TPlaceHolder>
+ <com:TActiveLabel ID="label1" Text="Label 1" />
+ </com:TActivePanel>
+ <div id="div1" style="border:1px solid #666; background-color: #ffe; text-align: center; padding:1em; margin: 2em">
+ Click Me!
+ </div>
+ <com:TActiveLabel ID="label2" Text="Label 2" />
+ <script type="text/javascript">
+ Event.OnLoad(function()
+ {
+ Event.observe($("div1"), "click", function()
+ {
+ Prado.Callback("<%= $this->callback1->ClientID %>")
+ })
+ })
+ </script>
+ <com:TJavascriptLogger />
+
+</com:TForm>
diff --git a/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.php b/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.php
new file mode 100644
index 00000000..a4a22cbf
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.php
@@ -0,0 +1,19 @@
+<?php
+
+class NestedActiveControls extends TPage
+{
+ function callback1_requested($sender, $param)
+ {
+ $this->content1->visible = true;
+ $this->panel1->flush($param->output);
+ }
+
+ function button1_clicked($sender, $param)
+ {
+ $this->label1->Text = "Label 1: Button 1 Clicked";
+ $this->label2->Text = "Label 2: Button 1 Clicked";
+ $this->label3->Text = "Label 3: Button 1 Clicked";
+ }
+}
+
+?> \ No newline at end of file