From 9af56fd93ed071d86f14296cec618073f6c0941a Mon Sep 17 00:00:00 2001 From: wei <> Date: Sat, 23 Sep 2006 01:08:19 +0000 Subject: Fixed #383 --- .../protected/pages/ActiveBricksTest.page | 42 +++++++++++++ .../protected/pages/ActiveBricksTest.php | 13 ++++ .../active-controls/protected/pages/LTemplate.php | 72 ++++++++++++++++++++++ .../active-controls/protected/pages/LTemplate.tpl | 11 ++++ .../protected/pages/PopulateActiveList.page | 17 +++++ .../protected/pages/PopulateActiveList.php | 34 ++++++++++ .../active-controls/tests/PopulateListTestCase.php | 25 ++++++++ 7 files changed, 214 insertions(+) create mode 100644 tests/FunctionalTests/active-controls/protected/pages/ActiveBricksTest.page create mode 100644 tests/FunctionalTests/active-controls/protected/pages/ActiveBricksTest.php create mode 100644 tests/FunctionalTests/active-controls/protected/pages/LTemplate.php create mode 100644 tests/FunctionalTests/active-controls/protected/pages/LTemplate.tpl create mode 100644 tests/FunctionalTests/active-controls/protected/pages/PopulateActiveList.page create mode 100644 tests/FunctionalTests/active-controls/protected/pages/PopulateActiveList.php create mode 100644 tests/FunctionalTests/active-controls/tests/PopulateListTestCase.php (limited to 'tests/FunctionalTests/active-controls') 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 @@ + +

Some AJAX Tests

+ + + + + + + + + + + + + + + + cell: + + in + + + + AIP + + + + +
\ 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 @@ +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 @@ +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 @@ + + +

L A R G E

+
+ + + small + + 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 @@ + +

Populate active list controls

+ + + + + + + + + + + + + + +
\ 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 @@ +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 @@ +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 -- cgit v1.2.3