diff options
Diffstat (limited to 'tests')
7 files changed, 214 insertions, 0 deletions
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveBricksTest.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveBricksTest.page new file mode 100644 index 00000000..7cb8c6b3 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveBricksTest.page @@ -0,0 +1,42 @@ +<com:TForm> + <h3 class="ContentAlternating">Some AJAX Tests</h3> + <com:TPanel CssClass="Content"> + + <!-- <com:TTextBox + Id="SelectedBrick" + Text="LContentBrick" />--> + + <com:TDropDownList Id="MySize"> + <com:TListItem + Text="Large" + Value="Large" /> + + <com:TListItem + Text="Small" + Value="Small" /> + + </com:TDropDownList> + + <com:TActiveButton + ID="insertBrick" + Text="Insert Brick" + OnCallback="insertBrick" /> + </com:TPanel> + + + cell: + <com:TActivePanel + ID="placeholder" + Style="display: auto; border: 1px solid red"> + in + </com:TActivePanel> + + <com:TActivePanel + ID="AjaxInsertPoint" + Style="visibility: auto; border: 1px solid blue"> + AIP + </com:TActivePanel> + + <com:TJavascriptLogger /> + +</com:TForm>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveBricksTest.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveBricksTest.php new file mode 100644 index 00000000..c60d4c67 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveBricksTest.php @@ -0,0 +1,13 @@ +<?php +class ActiveBricksTest extends TPage +{ + + function insertBrick($sender, $param) + { + $x= Prado::createComponent("Application.pages.LTemplate"); + $x->Size = $sender->NamingContainer->findControl("MySize")->SelectedValue; + $this->placeholder->getControls()->add($x); + $this->Page->CallbackClient->insertContentAfter($this->AjaxInsertPoint, $x); + } +} +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/LTemplate.php b/tests/FunctionalTests/active-controls/protected/pages/LTemplate.php new file mode 100644 index 00000000..0a5c311e --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/LTemplate.php @@ -0,0 +1,72 @@ +<?php + + +/** + * class file. + * + * @license http://opensource.org/licenses/mozilla1.1.php Mozilla Public License + * @copyright 2005, diemeisterei GmbH. All rights reserved. + * @author $Author: tobias $ + * @version $Revision: 1.5 $ $Date: 2006/01/03 19:08:05 $ + * @package Lithron + * @subpackage none + */ + +/** + * + * + * @package Lithron + * @subpackage none + */ + +class LTemplate extends TTemplateControl +{ + function __construct() + { + parent::__construct(); + $this->setEnableViewState(false); + } + + function setSize($value) + { + $this->setViewState("Size", $value); + } + + function getSize() + { + return $this->getViewState("Size", "Small"); + } + + function onInit($param) + { + parent :: onInit($param); + $this->Controls[] = "OnInit"; + } + + function onLoad($param) + { + parent :: onLoad($param); + $this->Controls[] = "OnLoad"; + $this->adjustLayout(); + } + + function onPreRender($param) + { + parent :: onPreRender($param); + $this->Controls[] = "OnPreRender"; + } + + function adjustLayout() + { + if ($this->getSize() == "Large") + { + $this->Small->setVisible(false); + } + else + { + $this->Large->setVisible(false); + } + } + +} +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/LTemplate.tpl b/tests/FunctionalTests/active-controls/protected/pages/LTemplate.tpl new file mode 100644 index 00000000..fd2bacd1 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/LTemplate.tpl @@ -0,0 +1,11 @@ + +<com:TPanel + ID="Large"> + <h1> L A R G E </h1> +</com:TPanel> + +<com:TPanel + ID="Small"> + <h7> small </h6> +</com:TPanel> + diff --git a/tests/FunctionalTests/active-controls/protected/pages/PopulateActiveList.page b/tests/FunctionalTests/active-controls/protected/pages/PopulateActiveList.page new file mode 100644 index 00000000..c7bf0952 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/PopulateActiveList.page @@ -0,0 +1,17 @@ +<com:TForm>
+<h1>Populate active list controls</h1>
+
+<com:TActiveListBox ID="list1" OnCallback="list_changed" />
+
+<com:TActiveDropDownList ID="list2" OnCallback="list_changed" />
+
+
+<com:TActiveLabel ID="label1" />
+
+<com:TActiveButton ID="button1" Text="populate list 1" OnClick="populate_list1" />
+
+<com:TActiveButton ID="button2" Text="populate list 2" OnClick="populate_list2" />
+
+<com:TJavascriptLogger />
+
+</com:TForm>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/PopulateActiveList.php b/tests/FunctionalTests/active-controls/protected/pages/PopulateActiveList.php new file mode 100644 index 00000000..022f6dad --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/PopulateActiveList.php @@ -0,0 +1,34 @@ +<?php
+
+class PopulateActiveList extends TPage
+{
+ public function populate_list1($sender, $param)
+ {
+ $data = array('Hello', 'World', 'Prado');
+ $this->list1->Items->clear();
+ for($i = 0,$k=count($data); $i<$k; $i++)
+ {
+ $item = new TListItem($data[$i], $i);
+ $this->list1->Items[] = $item;
+ }
+ }
+
+ public function populate_list2($sender, $param)
+ {
+ $data = array('Hello', 'World', 'Prado');
+ $this->list2->Items->clear();
+ for($i = 0,$k=count($data); $i<$k; $i++)
+ {
+ $item = new TListItem($data[$i], $i);
+ $this->list2->Items[] = $item;
+ }
+ }
+
+ public function list_changed($sender, $param)
+ {
+ $text = $sender->SelectedItem ? $sender->SelectedItem->Text : 'Not selected';
+ $this->label1->Text = $sender->ID . ': '.$text;
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/tests/PopulateListTestCase.php b/tests/FunctionalTests/active-controls/tests/PopulateListTestCase.php new file mode 100644 index 00000000..4929b879 --- /dev/null +++ b/tests/FunctionalTests/active-controls/tests/PopulateListTestCase.php @@ -0,0 +1,25 @@ +<?php
+
+class PopulateListTestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open("active-controls/index.php?page=PopulateActiveList");
+ $this->verifyTextPresent("Populate active list controls");
+ $this->assertText("label1", "");
+
+ $this->click("button1");
+ $this->pause(800);
+ $this->select("list1", "World");
+ $this->pause(800);
+ $this->assertText("label1", "list1: World");
+
+ $this->click("button2");
+ $this->pause(800);
+ $this->select("list2", "Prado");
+ $this->pause(800);
+ $this->assertText("label1", "list2: Prado");
+ }
+}
+
+?>
\ No newline at end of file |