summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/active-controls
diff options
context:
space:
mode:
authorwei <>2006-09-15 23:49:56 +0000
committerwei <>2006-09-15 23:49:56 +0000
commitb196ea0e2e9ab9078022e88326edecf1ba5b2f9f (patch)
tree3d9f37bfa14c363fc91df306b798ddc1b7ef872e /tests/FunctionalTests/active-controls
parent9f2905f5e2a6d0ab33e4e2d82162183cfd63a042 (diff)
Defer render() calls in callback event handler to a later stage.
Diffstat (limited to 'tests/FunctionalTests/active-controls')
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/ActiveControlExpressionTag.page27
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/ActiveControlExpressionTag.php26
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/ActiveListBoxMasterTest.page28
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/ActiveListBoxMasterTest.php47
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/TActiveCheckBoxListTest.page14
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/TestMasterPage.php7
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/TestMasterPage.tpl12
-rw-r--r--tests/FunctionalTests/active-controls/tests/ActiveControlExpressTagTestCase.php20
-rw-r--r--tests/FunctionalTests/active-controls/tests/ActiveListBoxMasterTestCase.php49
9 files changed, 223 insertions, 7 deletions
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveControlExpressionTag.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveControlExpressionTag.page
new file mode 100644
index 00000000..7b983cd7
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveControlExpressionTag.page
@@ -0,0 +1,27 @@
+<com:TForm>
+
+<h1>Active Control With Expression Tag Test</h1>
+
+<com:TTextBox ID="textbox1" />
+
+<com:TActivePanel ID="panel1">
+ <com:TPlaceHolder ID="subpanel1" Visible="false">
+<div id="repeats"><com:TRepeater ID="repeater1">
+<prop:ItemTemplate>result - <%# $this->DataItem %> </prop:ItemTemplate>
+</com:TRepeater></div>
+<span id="contents">Text box content: <%= $this->textbox1->SafeText %></span>
+ </com:TPlaceHolder>
+</com:TActivePanel>
+
+<com:TPanel ID="panel2" Visible="false">
+ <span id="contents2">More Contents: <%= $this->textbox1->SafeText %></span>
+</com:TPanel>
+
+<com:TActiveButton ID="button1" Text="Update!"
+ OnClick="button1_clicked" OnCallback="button1_callback" />
+<com:TActiveButton ID="button2" Text="Show More!" Enabled="false"
+ OnCallback="button2_callback" />
+
+<com:TJavascriptLogger />
+
+</com:TForm> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveControlExpressionTag.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveControlExpressionTag.php
new file mode 100644
index 00000000..e873ae9d
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveControlExpressionTag.php
@@ -0,0 +1,26 @@
+<?php
+
+class ActiveControlExpressionTag extends TPage
+{
+ public function button1_clicked($sender, $param)
+ {
+ $this->subpanel1->Visible = true;
+ $data = array('1', 'two');
+ $this->repeater1->DataSource = $data;
+ $this->repeater1->dataBind();
+ }
+
+ public function button1_callback($sender, $param)
+ {
+ $this->panel1->renderControl($param->NewWriter);
+ $this->button2->Enabled=true;
+ }
+
+ public function button2_callback($sender, $param)
+ {
+ $this->panel2->Visible=true;
+ $this->Page->CallbackClient->insertContentAfter('contents', $this->panel2);
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveListBoxMasterTest.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveListBoxMasterTest.page
new file mode 100644
index 00000000..f7c6baaf
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveListBoxMasterTest.page
@@ -0,0 +1,28 @@
+<%@ MasterClass="Application.pages.TestMasterPage" %>
+<com:TContent ID="body">
+
+ <h1>Active List Box Functional Test</h1>
+
+ <com:TActiveListBox ID="list1" OnCallback="list1_callback" SelectionMode="Multiple" style="width:20em;height:10em">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+ <com:TListItem Value="value 5" Text="item 5" />
+ </com:TActiveListBox>
+
+ <div style="margin:1em; padding:1em; border:1px solid #ccc; text-align:center;">
+ <com:TActiveLabel ID="label1" Text="Label 1" />
+ </div>
+ <div style="margin:1em; padding:0.5em; text-align:center; border:1px solid #ccc;">
+ <com:TActiveButton ID="button1" Text="Select Index 1 2 3" OnClick="select_index_123" />
+ <com:TActiveButton ID="button2" Text="Clear selection" OnClick="clear_selections" />
+ <com:TActiveButton ID="button3" Text="Select Value 'value 1'" OnClick="select_value_1" />
+ <com:TActiveButton ID="button4" Text="Select Index 4" OnClick="select_index_4" />
+ <com:TActiveButton ID="button5" Text="Select Values 'value 2', 'value 5'" OnClick="select_values_25" />
+ <com:TActiveButton ID="button6" Text="Change to Multi-Select" OnClick="change_to_multiple" />
+ <com:TActiveButton ID="button7" Text="Change to Single-Select" OnClick="change_to_single" />
+ </div>
+
+ <com:TJavascriptLogger />
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveListBoxMasterTest.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveListBoxMasterTest.php
new file mode 100644
index 00000000..d2991653
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveListBoxMasterTest.php
@@ -0,0 +1,47 @@
+<?php
+
+class ActiveListBoxMasterTest extends TPage
+{
+ function list1_callback($sender, $param)
+ {
+ $values = $sender->getSelectedValues();
+ $this->label1->setText("Selection: ".implode(', ', $values));
+ }
+
+ function select_index_123()
+ {
+ $this->list1->setSelectedIndices(array(1,2,3));
+ }
+
+ function select_index_4()
+ {
+ $this->list1->setSelectedIndex(4);
+ }
+
+ function clear_selections()
+ {
+ $this->list1->clearSelection();
+ }
+
+ function select_value_1()
+ {
+ $this->list1->setSelectedValue("value 1");
+ }
+
+ function select_values_25()
+ {
+ $this->list1->setSelectedValues(array('value 2', 'value 5'));
+ }
+
+ function change_to_multiple()
+ {
+ $this->list1->SelectionMode="Multiple";
+ }
+
+ function change_to_single()
+ {
+ $this->list1->SelectionMode="Single";
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/TActiveCheckBoxListTest.page b/tests/FunctionalTests/active-controls/protected/pages/TActiveCheckBoxListTest.page
index b30ced69..f3332bad 100644
--- a/tests/FunctionalTests/active-controls/protected/pages/TActiveCheckBoxListTest.page
+++ b/tests/FunctionalTests/active-controls/protected/pages/TActiveCheckBoxListTest.page
@@ -1,12 +1,12 @@
<com:TForm ID="form1">
<h1>TActiveCheckBoxList Test Case</h1>
-
+
<com:TActiveCheckBoxList ID="list1" OnCallback="list1_callback">
<com:TListItem Value="value 1" Text="item 1" />
- <com:TListItem Value="value 2" Text="item 2" />
- <com:TListItem Value="value 3" Text="item 3" />
- <com:TListItem Value="value 4" Text="item 4" />
- <com:TListItem Value="value 5" Text="item 5" />
+ <com:TListItem Value="value 2" Text="item 2" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+ <com:TListItem Value="value 5" Text="item 5" />
</com:TActiveCheckBoxList>
<div style="margin:1em; padding:1em; border:1px solid #ccc; text-align:center;">
<com:TActiveLabel ID="label1" Text="Label 1" />
@@ -18,7 +18,7 @@
<com:TActiveButton ID="button4" Text="Select Index 4" OnClick="select_index_4" />
<com:TActiveButton ID="button5" Text="Select Values 'value 2', 'value 5'" OnClick="select_values_25" />
</div>
-
+
<com:TJavascriptLogger />
-
+
</com:TForm> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/TestMasterPage.php b/tests/FunctionalTests/active-controls/protected/pages/TestMasterPage.php
new file mode 100644
index 00000000..dc643e52
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/TestMasterPage.php
@@ -0,0 +1,7 @@
+<?php
+
+class TestMasterPage extends TTemplateControl
+{
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/TestMasterPage.tpl b/tests/FunctionalTests/active-controls/protected/pages/TestMasterPage.tpl
new file mode 100644
index 00000000..a599ded4
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/TestMasterPage.tpl
@@ -0,0 +1,12 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US">
+<!-- $Id$ -->
+<com:THead Title="Active Control Tests" />
+ <body>
+ <com:TForm>
+ <com:TContentPlaceHolder ID="body"/>
+ </com:TForm>
+ </body>
+</html>
diff --git a/tests/FunctionalTests/active-controls/tests/ActiveControlExpressTagTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveControlExpressTagTestCase.php
new file mode 100644
index 00000000..7da7315c
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/tests/ActiveControlExpressTagTestCase.php
@@ -0,0 +1,20 @@
+<?php
+
+class ActiveControlExpressionTagTestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open('active-controls/index.php?page=ActiveControlExpressionTag');
+ $this->assertTextPresent('Active Control With Expression Tag Test');
+ $this->assertTextNotPresent('Text box content:');
+
+ $this->type('textbox1', 'Hello world');
+ $this->click('button1');
+ $this->pause(800);
+
+ $this->assertText('repeats', 'result - 1 result - two');
+ $this->assertText('contents', 'Text box content: Hello world');
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/tests/ActiveListBoxMasterTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveListBoxMasterTestCase.php
new file mode 100644
index 00000000..7f006d9e
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/tests/ActiveListBoxMasterTestCase.php
@@ -0,0 +1,49 @@
+<?php
+
+class ActiveListBoxMasterTestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open("active-controls/index.php?page=ActiveListBoxMasterTest");
+ $this->assertTextPresent('Active List Box Functional Test');
+
+ $base = 'ctl0_body_';
+
+ $this->assertText($base."label1", "Label 1");
+
+ $this->click($base."button1");
+ $this->pause(800);
+ $this->assertSelectedIndexes($base.'list1', '1,2,3');
+
+ $this->click($base.'button3');
+ $this->pause(800);
+ $this->assertSelectedIndexes($base.'list1', '0');
+
+ $this->click($base.'button4');
+ $this->pause(800);
+ $this->assertSelectedIndexes($base.'list1', '4');
+
+ $this->click($base.'button5');
+ $this->pause(800);
+ $this->assertSelectedIndexes($base.'list1', '1,4');
+
+ $this->click($base.'button2');
+ $this->pause(800);
+ $this->assertEmptySelection($base."list1");
+
+ $this->click($base.'button6');
+ $this->pause(800);
+ $this->click($base."button1");
+ $this->pause(800);
+ $this->assertSelectedIndexes($base.'list1', '1,2,3');
+
+ $this->select($base."list1", "item 1");
+ $this->pause(800);
+ $this->assertText($base.'label1', 'Selection: value 1');
+
+ $this->addSelection($base."list1", "item 4");
+ $this->pause(800);
+ $this->assertText($base.'label1', 'Selection: value 1, value 4');
+ }
+}
+?> \ No newline at end of file