diff options
author | wei <> | 2006-05-14 00:30:53 +0000 |
---|---|---|
committer | wei <> | 2006-05-14 00:30:53 +0000 |
commit | ae43fa72cdae13bace16a5b8250170e472bb2b87 (patch) | |
tree | 6efea16ae0773f5c739bff2cf643f54ba499e5c0 /tests | |
parent | ddc3ea15bbfd0235fe90f3b2211bf4cc605e25d6 (diff) |
refactor active controls.
Diffstat (limited to 'tests')
8 files changed, 121 insertions, 11 deletions
diff --git a/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.page b/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.page index 260ee805..9f17d4ed 100644 --- a/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.page +++ b/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.page @@ -1,15 +1,10 @@ <com:TContent ID="Content">
<h1>TCallback Demo</h1>
- <com:TCallbackOptions
- ID="options1"
- ClientSide.OnSuccess="alert('ok')"
- ClientSide.EnablePageStateUpdate="false" />
<com:TCallback id="control1"
- CallbackOptions="options1"
OnCallback="slowResponse" />
- <com:TActiveLabel id="label1" Text="Name:" AllowCallbackUpdate="false" />
+ <com:TActiveLabel id="label1" Text="Name:" />
<com:TTextBox id="text1" />
<com:TRequiredFieldValidator
@@ -18,7 +13,7 @@ <com:TActiveLabel id="label2" />
- <com:TActivePanel id="panel1" >
+ <com:TActivePanel id="panel1" ActiveControl.EnableUpdate="false" >
<com:TPanel id="panel2" Visible="false">
<com:TCheckBoxList>
<com:TListItem Text="One" />
@@ -35,7 +30,7 @@ <script>
Event.observe("<%= $this->button1->ClientID %>", "click", function(event)
{
- <%= $this->control1->CallbackReference %>
+ <%= $this->control1->ActiveControl->Javascript %>
Event.stop(event);
});
diff --git a/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.php b/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.php index 47bab3cc..b2dd2233 100644 --- a/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.php +++ b/tests/FunctionalTests/features/protected/pages/ActiveControls/ActiveControl.php @@ -9,11 +9,13 @@ class ActiveControl extends TPage public function slowResponse($sender, $param)
{
- sleep(1);
+ //sleep(1);
$this->label1->setText("The time is ".time()." from ".$sender->ID);
$this->label1->setForeColor($this->getColor());
$this->label1->renderControl($param->getOutput());
+ $this->button2->setEnabled(true);
+
$this->panel2->setVisible(true);
$this->panel1->setBackColor($this->getColor());
$this->panel1->renderControl($param->getOutput());
@@ -27,6 +29,7 @@ class ActiveControl extends TPage public function fastResponse($sender, $param)
{
+ $this->button2->setEnabled(false);
$style['color'] = $this->getColor();
$this->getCallbackClient()->setStyle($this->label2, $style);
$this->getCallbackClient()->shake($this->label2);
diff --git a/tests/FunctionalTests/features/protected/pages/ActiveControls/AutoComplete.page b/tests/FunctionalTests/features/protected/pages/ActiveControls/AutoComplete.page index 9d85b3fa..b98874cb 100644 --- a/tests/FunctionalTests/features/protected/pages/ActiveControls/AutoComplete.page +++ b/tests/FunctionalTests/features/protected/pages/ActiveControls/AutoComplete.page @@ -27,7 +27,7 @@ </style>
<com:TAutoComplete Style="width: 20em"
OnCallback="suggestCountries"
- ClientSide.Separator=", "
+ Separator=", "
ResultPanel.CssClass="autocomplete" />
<p><br /></p>
diff --git a/tests/FunctionalTests/features/protected/pages/ActiveControls/Calculator.page b/tests/FunctionalTests/features/protected/pages/ActiveControls/Calculator.page index e3dcb707..f0021299 100644 --- a/tests/FunctionalTests/features/protected/pages/ActiveControls/Calculator.page +++ b/tests/FunctionalTests/features/protected/pages/ActiveControls/Calculator.page @@ -7,7 +7,14 @@ =
<com:TActiveTextBox id="c" />
- <com:TActiveButton id="sum" onclick="do_sum" text="Calculate!" />
+ <com:TCallbackOptions id="option1">
+ <prop:ClientSide OnSuccess="alert('ok!')" />
+ </com:TCallbackOptions>
+
+ <com:TActiveButton id="sum"
+ onclick="do_sum"
+ text="Calculate!"
+ ActiveControl.CallbackOptions="option1" />
<com:TRequiredFieldValidator
ControlToValidate="a"
diff --git a/tests/FunctionalTests/features/protected/pages/ActiveControls/Calculator2.page b/tests/FunctionalTests/features/protected/pages/ActiveControls/Calculator2.page new file mode 100644 index 00000000..9433154e --- /dev/null +++ b/tests/FunctionalTests/features/protected/pages/ActiveControls/Calculator2.page @@ -0,0 +1,40 @@ +<com:TContent ID="Content">
+ <h1>Callback Enabled Calculator 2</h1>
+ <com:TTextBox id="a" />
+ +
+ <com:TTextBox id="b" />
+ =
+ <com:TActivePanel id="panel1">
+ <com:TTextBox id="c" />
+ </com:TActivePanel>
+
+ <com:TButton 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:TCallback ID="callback1" OnCallback="update_callback" />
+
+ <script>
+ $("<%= $this->sum->ClientID %>").onclick = function(event)
+ {
+ <%= $this->callback1->ActiveControl->Javascript %>
+ return false;
+ };
+ </script>
+
+</com:TContent>
\ No newline at end of file diff --git a/tests/FunctionalTests/features/protected/pages/ActiveControls/Calculator2.php b/tests/FunctionalTests/features/protected/pages/ActiveControls/Calculator2.php new file mode 100644 index 00000000..df07440f --- /dev/null +++ b/tests/FunctionalTests/features/protected/pages/ActiveControls/Calculator2.php @@ -0,0 +1,20 @@ +<?php
+/*
+ * Created on 13/05/2006
+ */
+
+class Calculator2 extends TPage
+{
+ public function do_sum($sender, $param)
+ {
+ $this->c->Text = floatval($this->a->Text) + floatval($this->b->Text);
+ }
+
+ public function update_callback($sender, $param)
+ {
+ $this->do_sum($this->sum, null);
+ $this->panel1->renderControl($param->Output);
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/features/protected/pages/ActiveControls/VisibleUpdate.page b/tests/FunctionalTests/features/protected/pages/ActiveControls/VisibleUpdate.page new file mode 100644 index 00000000..a8cb3c27 --- /dev/null +++ b/tests/FunctionalTests/features/protected/pages/ActiveControls/VisibleUpdate.page @@ -0,0 +1,9 @@ +<com:TContent ID="Content">
+ <h1>TCallback Demo</h1>
+
+ <com:TActiveButton id="button1" Text="Button 1" OnClick="click1" />
+ <com:TActiveButton id="button2" Text="Button 2" OnClick="click2" />
+
+ <com:TActiveLabel id="label1" />
+
+</com:TContent>
\ No newline at end of file diff --git a/tests/FunctionalTests/features/protected/pages/ActiveControls/VisibleUpdate.php b/tests/FunctionalTests/features/protected/pages/ActiveControls/VisibleUpdate.php new file mode 100644 index 00000000..0c9b16d5 --- /dev/null +++ b/tests/FunctionalTests/features/protected/pages/ActiveControls/VisibleUpdate.php @@ -0,0 +1,36 @@ +<?php
+/*
+ * Created on 13/05/2006
+ */
+
+class VisibleUpdate extends TPage
+{
+ function click1($sender)
+ {
+ $this->label1->setText($this->getButtonState($sender));
+
+ //$this->button1->setEnabled(false);
+ $this->button1->setVisible(false);
+ // $this->button2->setEnabled(true);
+ $this->button2->setVisible(true);
+ }
+
+ function click2($sender)
+ {
+ $this->label1->setText($this->getButtonState($sender));
+
+ // $this->button1->setEnabled(true);
+ $this->button1->setVisible(true);
+ /// $this->button2->setEnabled(false);
+ $this->button2->setVisible(false);
+ }
+
+ protected function getButtonState($button)
+ {
+ return "Before you clicked on ".$button->Text.
+ ", Button 1 was ".($this->button1->Enabled ? 'enabled' : 'disabled').
+ " and Button 2 was ".($this->button2->Enabled ? 'enabled' : 'disabled');
+ }
+}
+
+?>
\ No newline at end of file |