summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/FunctionalTests')
-rw-r--r--tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.page24
-rw-r--r--tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.php8
-rw-r--r--tests/FunctionalTests/features/protected/pages/ActiveControls/Calculator.page29
-rw-r--r--tests/FunctionalTests/features/protected/pages/ActiveControls/Calculator.php14
4 files changed, 59 insertions, 16 deletions
diff --git a/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.page b/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.page
index c98bae4d..fab91c40 100644
--- a/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.page
+++ b/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.page
@@ -1,16 +1,16 @@
<com:TContent ID="Content">
<h1>TCallback Demo</h1>
- <com:TClientScript UsingPradoScripts="ajax" />
<com:TCallback id="control1"
ClientSide.EnablePageStateUpdate="false"
OnCallback="slowResponse" />
-
- <com:TCallback id="control2"
- ClientSide.HasPriority="false"
- OnCallback="fastResponse" />
-
+
<com:TActiveLabel id="label1" Text="Name:" AllowCallbackUpdate="false" />
<com:TTextBox id="text1" />
+
+ <com:TRequiredFieldValidator
+ ControlToValidate="text1"
+ ErrorMessage="*" />
+
<com:TActiveLabel id="label2" />
<com:TActivePanel id="panel1" >
@@ -24,7 +24,9 @@
<com:TButton id="button1" Text="Submit 1 (3s delay)" CausesValidation="false" />
- <com:TButton id="button2" Text="Submit 2" CausesValidation="false" />
+
+ <com:TActiveButton id="button2" Text="Submit 2" OnClick="onButtonClicked" OnCallback="fastResponse" />
+
<script>
Event.observe("<%= $this->button1->ClientID %>", "click", function(event)
{
@@ -32,12 +34,6 @@
Event.stop(event);
});
- Event.observe("<%= $this->button2->ClientID %>", "click", function(event)
- {
- <%= $this->control2->CallbackReference %>
-
- Event.stop(event);
- });
-
+
</script>
</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.php b/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.php
index ace6291b..47bab3cc 100644
--- a/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.php
+++ b/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.php
@@ -9,7 +9,7 @@ class ActiveControl extends TPage
public function slowResponse($sender, $param)
{
- sleep(3);
+ sleep(1);
$this->label1->setText("The time is ".time()." from ".$sender->ID);
$this->label1->setForeColor($this->getColor());
$this->label1->renderControl($param->getOutput());
@@ -20,9 +20,13 @@ class ActiveControl extends TPage
$this->getCallbackClient()->shake($this->panel1);
}
- public function fastResponse($sender, $param)
+ public function onButtonClicked($sender, $param)
{
$this->label2->setText("Muahaha !!! the time is ".time()." from ".$sender->ID);
+ }
+
+ public function fastResponse($sender, $param)
+ {
$style['color'] = $this->getColor();
$this->getCallbackClient()->setStyle($this->label2, $style);
$this->getCallbackClient()->shake($this->label2);
diff --git a/tests/FunctionalTests/features/protected/pages/ActiveControls/Calculator.page b/tests/FunctionalTests/features/protected/pages/ActiveControls/Calculator.page
new file mode 100644
index 00000000..e3dcb707
--- /dev/null
+++ b/tests/FunctionalTests/features/protected/pages/ActiveControls/Calculator.page
@@ -0,0 +1,29 @@
+<com:TContent ID="Content">
+ <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:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/features/protected/pages/ActiveControls/Calculator.php b/tests/FunctionalTests/features/protected/pages/ActiveControls/Calculator.php
new file mode 100644
index 00000000..bcf0f9cd
--- /dev/null
+++ b/tests/FunctionalTests/features/protected/pages/ActiveControls/Calculator.php
@@ -0,0 +1,14 @@
+<?php
+/*
+ * Created on 6/05/2006
+ */
+
+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