From 2f2a18b9ccf154543ca02e9c189f23cc2862017d Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Tue, 25 Mar 2014 20:12:05 +0100 Subject: Added new test case directory for github issues; added test case for #504 (cherry picked from commit 4e15c84379b99434515c119b72a6c8afcbf917dd) --- tests/FunctionalTests/issues/assets/.gitignore | 2 ++ tests/FunctionalTests/issues/index.php | 6 ++++ .../issues/protected/application.xml | 12 ++++++++ .../issues/protected/controls/Layout.php | 6 ++++ .../issues/protected/controls/Layout.tpl | 32 ++++++++++++++++++++++ .../issues/protected/pages/Issue504.page | 14 ++++++++++ .../issues/protected/pages/Issue504.php | 14 ++++++++++ .../issues/protected/runtime/.gitignore | 2 ++ .../issues/tests/Issue504TestCase.php | 16 +++++++++++ 9 files changed, 104 insertions(+) create mode 100755 tests/FunctionalTests/issues/assets/.gitignore create mode 100755 tests/FunctionalTests/issues/index.php create mode 100755 tests/FunctionalTests/issues/protected/application.xml create mode 100755 tests/FunctionalTests/issues/protected/controls/Layout.php create mode 100755 tests/FunctionalTests/issues/protected/controls/Layout.tpl create mode 100755 tests/FunctionalTests/issues/protected/pages/Issue504.page create mode 100755 tests/FunctionalTests/issues/protected/pages/Issue504.php create mode 100755 tests/FunctionalTests/issues/protected/runtime/.gitignore create mode 100755 tests/FunctionalTests/issues/tests/Issue504TestCase.php (limited to 'tests/FunctionalTests/issues') diff --git a/tests/FunctionalTests/issues/assets/.gitignore b/tests/FunctionalTests/issues/assets/.gitignore new file mode 100755 index 00000000..d6b7ef32 --- /dev/null +++ b/tests/FunctionalTests/issues/assets/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/tests/FunctionalTests/issues/index.php b/tests/FunctionalTests/issues/index.php new file mode 100755 index 00000000..77ddf367 --- /dev/null +++ b/tests/FunctionalTests/issues/index.php @@ -0,0 +1,6 @@ +run(); diff --git a/tests/FunctionalTests/issues/protected/application.xml b/tests/FunctionalTests/issues/protected/application.xml new file mode 100755 index 00000000..a396dea5 --- /dev/null +++ b/tests/FunctionalTests/issues/protected/application.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/FunctionalTests/issues/protected/controls/Layout.php b/tests/FunctionalTests/issues/protected/controls/Layout.php new file mode 100755 index 00000000..0ac4d6b3 --- /dev/null +++ b/tests/FunctionalTests/issues/protected/controls/Layout.php @@ -0,0 +1,6 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/FunctionalTests/issues/protected/pages/Issue504.page b/tests/FunctionalTests/issues/protected/pages/Issue504.page new file mode 100755 index 00000000..ed29b358 --- /dev/null +++ b/tests/FunctionalTests/issues/protected/pages/Issue504.page @@ -0,0 +1,14 @@ + +

Issue 504 Test

+ + + + + Panel Content + + + + + +
+ diff --git a/tests/FunctionalTests/issues/protected/pages/Issue504.php b/tests/FunctionalTests/issues/protected/pages/Issue504.php new file mode 100755 index 00000000..dd12c960 --- /dev/null +++ b/tests/FunctionalTests/issues/protected/pages/Issue504.php @@ -0,0 +1,14 @@ +label1->Text="buttonOkClick"; + } + + function buttonDummyClick($sender, $param) + { + $this->label1->Text="buttonDummyClick"; + } +} diff --git a/tests/FunctionalTests/issues/protected/runtime/.gitignore b/tests/FunctionalTests/issues/protected/runtime/.gitignore new file mode 100755 index 00000000..d6b7ef32 --- /dev/null +++ b/tests/FunctionalTests/issues/protected/runtime/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/tests/FunctionalTests/issues/tests/Issue504TestCase.php b/tests/FunctionalTests/issues/tests/Issue504TestCase.php new file mode 100755 index 00000000..dff27339 --- /dev/null +++ b/tests/FunctionalTests/issues/tests/Issue504TestCase.php @@ -0,0 +1,16 @@ +url('issues/index.php?page=Issue504'); + $this->assertContains('Issue 504 Test', $this->source()); + $base='ctl0_Content_'; + + $this->byID("{$base}textbox1")->click(); + $this->keys(PHPUnit_Extensions_Selenium2TestCase_Keys::ENTER); + + $this->assertText("{$base}label1", "buttonOkClick"); + } +} -- cgit v1.2.3 From b7614a9c62f9e6597ea83bdc6901693efb74e68a Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Mon, 21 Apr 2014 12:09:30 +0200 Subject: Fixed #516 , added test case (cherry picked from commit c66097eac2c2691bf0047829275962ec0bf2b41f) --- .../source/prado/validator/validation3.js | 2 +- .../issues/protected/pages/Issue516.page | 50 +++++++++ .../issues/protected/pages/Issue516.php | 115 +++++++++++++++++++++ .../issues/tests/Issue516TestCase.php | 37 +++++++ 4 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 tests/FunctionalTests/issues/protected/pages/Issue516.page create mode 100644 tests/FunctionalTests/issues/protected/pages/Issue516.php create mode 100644 tests/FunctionalTests/issues/tests/Issue516TestCase.php (limited to 'tests/FunctionalTests/issues') diff --git a/framework/Web/Javascripts/source/prado/validator/validation3.js b/framework/Web/Javascripts/source/prado/validator/validation3.js index 0361389f..483c7ec2 100644 --- a/framework/Web/Javascripts/source/prado/validator/validation3.js +++ b/framework/Web/Javascripts/source/prado/validator/validation3.js @@ -979,7 +979,7 @@ Prado.WebUI.TBaseValidator = Class.create(Prado.WebUI.Control, if(!this.control) this.control = $(this.options.ControlToValidate); - if(!this.control || this.control.disabled) + if(!this.control || this.control.disabled || !this.control.descendantOf(document)) { this.isValid = true; return this.isValid; diff --git a/tests/FunctionalTests/issues/protected/pages/Issue516.page b/tests/FunctionalTests/issues/protected/pages/Issue516.page new file mode 100644 index 00000000..c922c6e1 --- /dev/null +++ b/tests/FunctionalTests/issues/protected/pages/Issue516.page @@ -0,0 +1,50 @@ + + +

Issue 516 Test

+ + + + + + + + + + + + + + +
+ diff --git a/tests/FunctionalTests/issues/protected/pages/Issue516.php b/tests/FunctionalTests/issues/protected/pages/Issue516.php new file mode 100644 index 00000000..bd3e7a72 --- /dev/null +++ b/tests/FunctionalTests/issues/protected/pages/Issue516.php @@ -0,0 +1,115 @@ +_data===null) + $this->loadData(); + return $this->_data; + } + + protected function loadData() + { + // We use viewstate keep track of data. + // In real applications, data should come from database using an SQL SELECT statement. + // In the following tabular data, field 'ISBN' is the primary key. + // All update and delete operations should come with an 'id' value in order to go through. + if(($this->_data=$this->getViewState('Data',null))===null) + { + $this->_data=array( + array( + 'ISBN'=>'0596007124', + 'title'=>'', + ), + array( + 'ISBN'=>'0201633612', + 'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software', + ), + array( + 'ISBN'=>'0321247140', + 'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design', + ), + array( + 'ISBN'=>'0201485672', + 'title'=>'Refactoring: Improving the Design of Existing Code', + ), + array( + 'ISBN'=>'0321213351', + 'title'=>'Refactoring to Patterns', + ), + array( + 'ISBN'=>'0735619670', + 'title'=>'Code Complete', + ), + array( + 'ISBN'=>'0321278658 ', + 'title'=>'Extreme Programming Explained : Embrace Change', + ), + ); + $this->saveData(); + } + } + + protected function saveData() + { + $this->setViewState('Data',$this->_data); + } + + protected function updateBook($isbn,$title) + { + // In real applications, data should be saved to database using an SQL UPDATE statement + if($this->_data===null) + $this->loadData(); + $updateRow=null; + foreach($this->_data as $index=>$row) + if($row['ISBN']===$isbn) + $updateRow=&$this->_data[$index]; + if($updateRow!==null) + { + $updateRow['title']=$title; + $this->saveData(); + } + } + + public function onLoad($param) + { + parent::onLoad($param); + if(!$this->IsPostBack && !$this->IsCallBack) + { + $this->DataGrid->DataSource=$this->Data; + $this->DataGrid->dataBind(); + } + } + + public function editItem($sender,$param) + { + $this->DataGrid->EditItemIndex=$param->Item->ItemIndex; + $this->DataGrid->DataSource=$this->Data; + $this->DataGrid->dataBind(); + } + + public function saveItem($sender,$param) + { + $item=$param->Item; + $this->updateBook( + $this->DataGrid->DataKeys[$item->ItemIndex], // ISBN + $item->BookTitleColumn->TextBox->Text // title + ); + $this->DataGrid->EditItemIndex=-1; + $this->DataGrid->DataSource=$this->Data; + $this->DataGrid->dataBind(); + } + + public function cancelItem($sender,$param) + { + $this->DataGrid->EditItemIndex=-1; + $this->DataGrid->DataSource=$this->Data; + $this->DataGrid->dataBind(); + } + +} diff --git a/tests/FunctionalTests/issues/tests/Issue516TestCase.php b/tests/FunctionalTests/issues/tests/Issue516TestCase.php new file mode 100644 index 00000000..363e9f84 --- /dev/null +++ b/tests/FunctionalTests/issues/tests/Issue516TestCase.php @@ -0,0 +1,37 @@ +url('issues/index.php?page=Issue516'); + $this->assertContains('Issue 516 Test', $this->source()); + $base='ctl0_Content_'; + $row1='DataGrid_ctl1_'; + $row2='DataGrid_ctl2_'; + + // click "edit" and check for textbox + $this->byID("{$base}{$row1}ctl3")->click(); + $this->pause(800); + $this->assertElementPresent("{$base}{$row1}TextBox"); + // click "save" and check for validator + $this->byID("{$base}{$row1}ctl3")->click(); + $this->pause(800); + $this->assertEquals('Please provide a title.', $this->getElement("{$base}{$row1}ctl1")->text()); + // click "cancel" and ensure validator has disappeared + $this->byID("{$base}{$row1}ctl4")->click(); + $this->pause(800); + $this->assertElementNotPresent("{$base}{$row1}ctl1"); + + // click "edit" and check for textbox on the second row + $this->byID("{$base}{$row2}ctl3")->click(); + $this->pause(800); + $this->assertTrue($this->getElement("{$base}{$row2}TextBox")!==null); + // click "save" and ensure bvalidation has been successfull + $this->byID("{$base}{$row2}ctl3")->click(); + $this->pause(800); + $this->assertElementNotPresent("{$base}{$row2}ctl1"); + $this->assertElementNotPresent("{$base}{$row2}TextBox"); + $this->assertEquals('Edit', $this->getElement("{$base}{$row2}ctl3")->text()); + } +} -- cgit v1.2.3 From d78e127d34b36ddd2b3465192218ef87f205828e Mon Sep 17 00:00:00 2001 From: David Date: Thu, 10 Jul 2014 17:32:37 +0200 Subject: Testcase for Issue #524 (cherry picked from commit 37a1d886c6960080bbd03cad757c722b494a0220) --- .../issues/protected/pages/Issue524.page | 7 +++++++ .../issues/protected/pages/Issue524.php | 20 ++++++++++++++++++++ .../issues/tests/Issue524TestCase.php | 20 ++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100755 tests/FunctionalTests/issues/protected/pages/Issue524.page create mode 100755 tests/FunctionalTests/issues/protected/pages/Issue524.php create mode 100755 tests/FunctionalTests/issues/tests/Issue524TestCase.php (limited to 'tests/FunctionalTests/issues') diff --git a/tests/FunctionalTests/issues/protected/pages/Issue524.page b/tests/FunctionalTests/issues/protected/pages/Issue524.page new file mode 100755 index 00000000..08ac1814 --- /dev/null +++ b/tests/FunctionalTests/issues/protected/pages/Issue524.page @@ -0,0 +1,7 @@ + +

Issue 524 Test

+ + + +
+ diff --git a/tests/FunctionalTests/issues/protected/pages/Issue524.php b/tests/FunctionalTests/issues/protected/pages/Issue524.php new file mode 100755 index 00000000..851ff45a --- /dev/null +++ b/tests/FunctionalTests/issues/protected/pages/Issue524.php @@ -0,0 +1,20 @@ +getGlobalization()->setCharset('ISO-8859-1'); + parent::__construct(); + } + + public function validateText($sender, $param) + { + $param->IsValid = false; + $iso8859text=iconv('utf-8', 'iso-8859-1', 'fünf'); + $this->Validator->ErrorMessage = $iso8859text; + } + +} diff --git a/tests/FunctionalTests/issues/tests/Issue524TestCase.php b/tests/FunctionalTests/issues/tests/Issue524TestCase.php new file mode 100755 index 00000000..2582dda0 --- /dev/null +++ b/tests/FunctionalTests/issues/tests/Issue524TestCase.php @@ -0,0 +1,20 @@ +url('issues/index.php?page=Issue524'); + $this->assertContains('Issue 524 Test', $this->source()); + $base='ctl0_Content_'; + + $this->byID("{$base}buttonOk")->click(); + + $this->assertText("{$base}Validator", "fünf"); + } +} -- cgit v1.2.3 From 6d626d0626bd0a0fe7053d09af5196f2ff796a07 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 30 Jul 2014 19:35:41 +0200 Subject: Fixed test case for issue 524 (cherry picked from commit 891ed122447ca88938b150da9858d6d4c271d020) --- tests/FunctionalTests/issues/tests/Issue524TestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/FunctionalTests/issues') diff --git a/tests/FunctionalTests/issues/tests/Issue524TestCase.php b/tests/FunctionalTests/issues/tests/Issue524TestCase.php index 2582dda0..b7b022b2 100755 --- a/tests/FunctionalTests/issues/tests/Issue524TestCase.php +++ b/tests/FunctionalTests/issues/tests/Issue524TestCase.php @@ -14,7 +14,7 @@ class Issue524TestCase extends PradoGenericSelenium2Test $base='ctl0_Content_'; $this->byID("{$base}buttonOk")->click(); - + $this->pause(800); $this->assertText("{$base}Validator", "fünf"); } } -- cgit v1.2.3