diff options
author | wei <> | 2006-08-11 05:05:32 +0000 |
---|---|---|
committer | wei <> | 2006-08-11 05:05:32 +0000 |
commit | b687748278d29510bb28875627c98b5da0a96cc5 (patch) | |
tree | 6d4f4b89027129530eae6d6aaf9c96c18b5ad8e2 /tests/FunctionalTests | |
parent | deb09283421970296b7ec6931d9eab3529be44ed (diff) |
Fixed callback replace content.
Diffstat (limited to 'tests/FunctionalTests')
14 files changed, 244 insertions, 5 deletions
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.php b/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.php index 79e3d46c..8a0a4316 100644 --- a/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.php +++ b/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.php @@ -5,7 +5,7 @@ class ActivePanelTest extends TPage function callback1_requested($sender, $param) { $this->content1->visible = true; - $this->panel1->flush($param->output); + $this->panel1->render($param->output); } } diff --git a/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.php b/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.php new file mode 100644 index 00000000..7da2834e --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.php @@ -0,0 +1,11 @@ +<?php
+
+class CustomTemplateComponent extends TTemplateControl
+{
+ public function suboncallback ($sender, $param)
+ {
+ $sender->setText("Foo");
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.tpl b/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.tpl new file mode 100644 index 00000000..04a0476a --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.tpl @@ -0,0 +1,6 @@ +<com:TPanel ID="ThePanel" GroupingText="Foolio">
+ Getting textbox from the template!!!<br />
+ Client ID: <%# $this->ThePanel->getClientID() %>
+ <div><com:TTextBox ID="foo" /></div>
+ <com:TButton ID="lalalala" Text="Llalalaal" OnClick="suboncallback" />
+</com:TPanel>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.page b/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.page new file mode 100644 index 00000000..3bed7d5b --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.page @@ -0,0 +1,16 @@ +<com:TForm ID="form1">
+
+ <h1>Add Dynamic Custom TTemplateControl Test</h1>
+ <com:TActivePanel ID="Foo">
+ <com:TTextBox ID="foo" />
+ </com:TActivePanel>
+ <com:TActiveButton ID="button2" Text="Button 1"
+ OnClick="button2_onclick" OnCallback="button2_callback"/>
+
+ <com:TActivePanel ID="placeholder" />
+
+ <com:TActiveLabel ID="label1" Text="Label 1" />
+
+
+ <com:TJavascriptLogger />
+</com:TForm>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.php b/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.php new file mode 100644 index 00000000..753de25c --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.php @@ -0,0 +1,27 @@ +<?php
+
+class CustomTemplateControlTest extends TPage
+{
+ function button2_onclick($sender, $param)
+ {
+
+ $this->label1->Text = "Button 1 was clicked ";
+ $this->label1->Text .= $this->foo->Text;
+
+ $x=Prado::createComponent('Application.pages.CustomTemplateComponent');
+
+ $this->placeholder->getControls()->add($x);
+ $this->placeholder->dataBind();
+ }
+
+ function button2_callback($sender, $param)
+ {
+ $this->placeholder->render($param->output);
+
+ $this->label1->Text .= " using callback!";
+ $this->label1->Text .= "... and this is the textbox text: ". $this->foo->Text;
+ }
+
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.php b/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.php index a4a22cbf..4c6190ee 100644 --- a/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.php +++ b/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.php @@ -5,9 +5,9 @@ class NestedActiveControls extends TPage function callback1_requested($sender, $param) { $this->content1->visible = true; - $this->panel1->flush($param->output); + $this->panel1->render($param->output); } - + function button1_clicked($sender, $param) { $this->label1->Text = "Label 1: Button 1 Clicked"; diff --git a/tests/FunctionalTests/active-controls/protected/pages/ReplaceContentTest.page b/tests/FunctionalTests/active-controls/protected/pages/ReplaceContentTest.page new file mode 100644 index 00000000..b0c22587 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/ReplaceContentTest.page @@ -0,0 +1,22 @@ +<com:TForm>
+
+<h1>Callback Replace Content Test</h1>
+
+<com:TPanel ID="panel1" style="border:1px solid red; background-color: #ffc; padding:2em;">
+Main Panel
+ <com:TPanel ID="subpanel" style="border:1px solid blue; background-color: #fff; padding: 2em;">
+ Sub Panel
+ </com:TPanel>
+</com:TPanel>
+
+<com:TTextBox ID="content" />
+<com:TActiveButton id="btn_append" Text="Append to Sub Panel" OnCallback="appendContent"/>
+<com:TActiveButton id="btn_prepend" Text="Prepend to Sub Panel" OnCallback="prependContent" />
+<com:TActiveButton id="btn_before" Text="Insert Before Sub Panel" OnCallback="insertContentBefore"/>
+<com:TActiveButton id="btn_after" Text="Insert After Sub Panel" OnCallback="insertContentAfter"/>
+
+<com:TActiveButton id="btn_replace" Text="Replace" OnCallback="replaceContent"/>
+
+<com:TJavascriptLogger />
+
+</com:TForm>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/ReplaceContentTest.php b/tests/FunctionalTests/active-controls/protected/pages/ReplaceContentTest.php new file mode 100644 index 00000000..0e09a012 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/ReplaceContentTest.php @@ -0,0 +1,31 @@ +<?php
+
+class ReplaceContentTest extends TPage
+{
+ function appendContent($sender, $param)
+ {
+ $this->CallbackClient->appendContent($this->subpanel, $this->content->Text);
+ }
+
+ function prependContent($sender, $param)
+ {
+ $this->CallbackClient->prependContent($this->subpanel, $this->content->Text);
+ }
+
+ function insertContentBefore($sender, $param)
+ {
+ $this->CallbackClient->insertContentBefore($this->subpanel, $this->content->Text);
+ }
+
+ function insertContentAfter($sender, $param)
+ {
+ $this->CallbackClient->insertContentAfter($this->subpanel, $this->content->Text);
+ }
+
+ function replaceContent($sender, $param)
+ {
+ $this->CallbackClient->replaceContent($this->subpanel, $this->content->Text);
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/TextBoxValidationCallback.page b/tests/FunctionalTests/active-controls/protected/pages/TextBoxValidationCallback.page new file mode 100644 index 00000000..79fc17e0 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/TextBoxValidationCallback.page @@ -0,0 +1,21 @@ +<com:TForm>
+<h1>TextBox AutoPostBack With Group Validation</h1>
+<com:TTextBox ID="Address" Columns="60" Maxlength="128" />
+<com:TRequiredFieldValidator
+ ID="validator1"
+ ControlToValidate="Address"
+ ValidationGroup="post"
+ ErrorMessage="*" />
+
+<com:TActiveTextBox
+ AutoPostBack="true"
+ ID="ZipCode"
+ Columns="4"
+ Maxlength="12"
+ ValidationGroup="post"
+ OnCallback="lookupZipCode"/>
+<com:TJavascriptLogger />
+
+<com:TActiveTextBox ID="City" Columns="60" Maxlength="128" />
+
+</com:TForm>
diff --git a/tests/FunctionalTests/active-controls/protected/pages/TextBoxValidationCallback.php b/tests/FunctionalTests/active-controls/protected/pages/TextBoxValidationCallback.php new file mode 100644 index 00000000..cf43bccd --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/TextBoxValidationCallback.php @@ -0,0 +1,11 @@ +<?php
+
+class TextBoxValidationCallback extends TPage
+{
+
+ function lookupZipCode()
+ {
+ $this->City->Text = "City: ".$this->Address->Text . ' Zip: '.$this->ZipCode->Text;
+ }
+}
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/tests/CustomTemplateTestCase.php b/tests/FunctionalTests/active-controls/tests/CustomTemplateTestCase.php new file mode 100644 index 00000000..b927b3e9 --- /dev/null +++ b/tests/FunctionalTests/active-controls/tests/CustomTemplateTestCase.php @@ -0,0 +1,22 @@ +<?php
+
+class CustomTemplateTestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open('active-controls/index.php?page=CustomTemplateControlTest');
+ $this->assertTextPresent('Add Dynamic Custom TTemplateControl Test');
+ $this->assertText('label1', 'Label 1');
+
+ $this->type('foo', 'Foo Bar!');
+ $this->click('button2');
+ $this->pause(500);
+
+ $this->assertVisible('ctl1_ThePanel');
+ $this->assertTextPresent('Client ID: ctl1_ThePanel');
+
+ $this->assertText('label1', 'Button 1 was clicked Foo Bar! using callback!... and this is the textbox text: Foo Bar!');
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/tests/ReplaceContentTestCase.php b/tests/FunctionalTests/active-controls/tests/ReplaceContentTestCase.php new file mode 100644 index 00000000..de4cbc71 --- /dev/null +++ b/tests/FunctionalTests/active-controls/tests/ReplaceContentTestCase.php @@ -0,0 +1,48 @@ +<?php
+
+class ReplaceContentTestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open('active-controls/index.php?page=ReplaceContentTest');
+ $this->assertTextPresent('Callback Replace Content Test');
+
+ $this->assertText('subpanel', 'Sub Panel');
+ $this->assertText('panel1', 'Main Panel Sub Panel');
+
+ $this->type('content', 'something');
+
+ $this->click('btn_append');
+ $this->pause(500);
+
+ $this->assertText('subpanel', 'Sub Panel something');
+ $this->assertText('panel1', 'Main Panel Sub Panel something');
+
+ $this->type('content', 'more');
+ $this->click('btn_prepend');
+ $this->pause(500);
+
+ $this->assertText('subpanel', 'more Sub Panel something');
+ $this->assertText('panel1', 'Main Panel more Sub Panel something');
+
+
+ $this->type('content', 'prado');
+ $this->click('btn_before');
+ $this->pause(500);
+
+ $this->assertText('subpanel', 'more Sub Panel something');
+ $this->assertText('panel1', 'Main Panel pradomore Sub Panel something');
+
+ $this->type('content', ' php ');
+ $this->click('btn_after');
+ $this->pause(500);
+
+ $this->type('content', 'mauahahaha');
+ $this->click('btn_replace');
+ $this->pause(1000);
+
+ $this->assertText('panel1', 'Main Panel pradomauahahahaphp');
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/tests/TextBoxGroupValidationTestCase.php b/tests/FunctionalTests/active-controls/tests/TextBoxGroupValidationTestCase.php new file mode 100644 index 00000000..b0950cbc --- /dev/null +++ b/tests/FunctionalTests/active-controls/tests/TextBoxGroupValidationTestCase.php @@ -0,0 +1,24 @@ +<?php
+
+class TextBoxGroupValidationTestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open("active-controls/index.php?page=TextBoxValidationCallback");
+ $this->assertTextPresent('TextBox AutoPostBack With Group Validation');
+ $this->assertNotVisible('validator1');
+
+ $this->type('ZipCode', 'test');
+ $this->assertVisible('validator1');
+
+ $this->type('Address', 'Sydney');
+ $this->type('ZipCode', '2000');
+
+ $this->assertNotVisible('validator1');
+
+ $this->pause(500);
+ $this->assertValue('City', 'City: Sydney Zip: 2000');
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/active.php b/tests/FunctionalTests/active.php index ca6ab635..f8776c2e 100755 --- a/tests/FunctionalTests/active.php +++ b/tests/FunctionalTests/active.php @@ -1,8 +1,8 @@ <?php -require(dirname(__FILE__).'/PradoTester.php'); +require('../test_tools/functional_tests.php'); -$tester=new PradoTester(dirname(__FILE__).'/active-controls/tests'); +$tester=new PradoFunctionalTester(dirname(__FILE__).'/active-controls/tests'); $tester->run(new SimpleReporter()); ?>
\ No newline at end of file |