From b687748278d29510bb28875627c98b5da0a96cc5 Mon Sep 17 00:00:00 2001 From: wei <> Date: Fri, 11 Aug 2006 05:05:32 +0000 Subject: Fixed callback replace content. --- .../protected/pages/ActivePanelTest.php | 2 +- .../protected/pages/CustomTemplateComponent.php | 11 +++++ .../protected/pages/CustomTemplateComponent.tpl | 6 +++ .../protected/pages/CustomTemplateControlTest.page | 16 ++++++++ .../protected/pages/CustomTemplateControlTest.php | 27 ++++++++++++ .../protected/pages/NestedActiveControls.php | 4 +- .../protected/pages/ReplaceContentTest.page | 22 ++++++++++ .../protected/pages/ReplaceContentTest.php | 31 ++++++++++++++ .../protected/pages/TextBoxValidationCallback.page | 21 ++++++++++ .../protected/pages/TextBoxValidationCallback.php | 11 +++++ .../tests/CustomTemplateTestCase.php | 22 ++++++++++ .../tests/ReplaceContentTestCase.php | 48 ++++++++++++++++++++++ .../tests/TextBoxGroupValidationTestCase.php | 24 +++++++++++ tests/FunctionalTests/active.php | 4 +- 14 files changed, 244 insertions(+), 5 deletions(-) create mode 100644 tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.php create mode 100644 tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.tpl create mode 100644 tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.page create mode 100644 tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.php create mode 100644 tests/FunctionalTests/active-controls/protected/pages/ReplaceContentTest.page create mode 100644 tests/FunctionalTests/active-controls/protected/pages/ReplaceContentTest.php create mode 100644 tests/FunctionalTests/active-controls/protected/pages/TextBoxValidationCallback.page create mode 100644 tests/FunctionalTests/active-controls/protected/pages/TextBoxValidationCallback.php create mode 100644 tests/FunctionalTests/active-controls/tests/CustomTemplateTestCase.php create mode 100644 tests/FunctionalTests/active-controls/tests/ReplaceContentTestCase.php create mode 100644 tests/FunctionalTests/active-controls/tests/TextBoxGroupValidationTestCase.php (limited to 'tests/FunctionalTests') 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 @@ +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 @@ + + Getting textbox from the template!!!
+ Client ID: <%# $this->ThePanel->getClientID() %> +
+ +
\ 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 @@ + + +

Add Dynamic Custom TTemplateControl Test

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

Callback Replace Content Test

+ + +Main Panel + + Sub Panel + + + + + + + + + + + + + +
\ 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 @@ +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 @@ + +

TextBox AutoPostBack With Group Validation

+ + + + + + + + +
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 @@ +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 @@ +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 @@ +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 @@ +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 @@ run(new SimpleReporter()); ?> \ No newline at end of file -- cgit v1.2.3