diff options
Diffstat (limited to 'tests/FunctionalTests')
3 files changed, 130 insertions, 0 deletions
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket671_reopened.page b/tests/FunctionalTests/tickets/protected/pages/Ticket671_reopened.page new file mode 100644 index 00000000..c4e7fb53 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket671_reopened.page @@ -0,0 +1,41 @@ +<com:TContent ID="Content"> + <div style="margin: 20px auto 0px auto; width: 700px;"> + <com:TLabel Text="TestField:" ForControl="testField" /> + <com:TActiveTextBox + ID="testField" + CssClass="DialogInput" + ValidationGroup="group" + Style="text-align: left;" + AutoPostback="False" + /> + <br /> + <com:TRequiredFieldValidator + ControlToValidate="testField" + Display="Dynamic" + ControlCssClass="inputerror" + ValidationGroup="group" + CssClass="error" + ErrorMessage="Please insert some Data." /> + <com:TActiveCustomValidator + ControlToValidate="testField" + OnServerValidate="Page.check" + ValidationGroup="group" + Display="Dynamic" + ControlCssClass="inputerror" + CssClass="error" + ErrorMessage="Please insert the right Data." + /> + <br /> + <com:TLabel Text="TestField2:" ForControl="testField2" /> + <com:TActiveTextBox + ID="testField2" + CssClass="DialogInput" + ValidationGroup="coran" + Style="text-align: left;" + /> + <br /> + <com:TActiveButton Text="Start" OnCallback="Page.save" ValidationGroup="group" /> + <com:TActiveLabel id="Result"/> + </div> + +</com:TContent>
\ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket671_reopened.php b/tests/FunctionalTests/tickets/protected/pages/Ticket671_reopened.php new file mode 100644 index 00000000..ae45bf96 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket671_reopened.php @@ -0,0 +1,39 @@ +<?php + +Prado::Using ('System.Web.UI.ActiveControls.*'); + +class Ticket671_reopened extends TPage +{ + + public function save( $sender, $param ) + { + $txt="Save callback called "; + if ( $this->isValid ) + $txt .= "DATA OK"; + else + $txt .= "DATA NOK"; + $this->Result->Text.= ' --- ' . $txt; + } + + public function check( $sender, $param ) + { + //$c=$this->CheckCount; + $this->Result->Text="Check callback called (".++$this->CheckCount.")"; + //$this->CheckCount=$c; + if ( $this->testField->getText() == 'Test' ) + $param->isValid = true; + else + $param->isValid = false; + } + + public function setCheckCount($value) + { + $this->setViewState('CheckCount', $value); + } + + public function getCheckCount() + { + return $this->getViewState('CheckCount', 0); + } +} +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/tickets/tests/Ticket671_reopenedTestCase.php b/tests/FunctionalTests/tickets/tests/Ticket671_reopenedTestCase.php new file mode 100644 index 00000000..63c191cb --- /dev/null +++ b/tests/FunctionalTests/tickets/tests/Ticket671_reopenedTestCase.php @@ -0,0 +1,50 @@ +<?php + +class Ticket671_reopenedTestCase extends SeleniumTestCase +{ + function test() + { + $base="ctl0_Content_"; + $this->open('tickets/index.php?page=Ticket671_reopened'); + $this->assertTitle("Verifying Ticket 671_reopened"); + // Type wrong value + $this->type($base.'testField', 'abcd'); + $this->click($base.'ctl4'); + $this->pause(800); + $this->assertVisible($base.'ctl2'); + $this->assertText($base.'Result', 'Check callback called (1)'); + + // Reclick, should not have any callback + $this->click($base.'ctl4'); + $this->pause(800); + $this->assertVisible($base.'ctl2'); + $this->assertText($base.'Result', 'Check callback called (1)'); + + // Type right value + $this->type($base.'testField', 'Test'); + $this->click($base.'ctl4'); + $this->pause(800); + $this->assertNotVisible($base.'ctl2'); + // The check method is called twice. Once by request on clientside, once on server side when callback request is issued. + $this->assertText($base.'Result', 'Check callback called (3) --- Save callback called DATA OK'); + + // Type empty value + $this->type($base.'testField', ''); + $this->click($base.'ctl4'); + $this->pause(800); + $this->assertVisible($base.'ctl1'); + $this->assertVisible($base.'ctl2'); + $this->assertText($base.'Result', 'Check callback called (4)'); + + // Type right value + $this->type($base.'testField', 'Test'); + $this->click($base.'ctl4'); + $this->pause(800); + $this->assertNotVisible($base.'ctl1'); + $this->assertNotVisible($base.'ctl2'); + // The check method is called twice. Once by request on clientside, once on server side when callback request is issued. + $this->assertText($base.'Result', 'Check callback called (6) --- Save callback called DATA OK'); + + } +} +?>
\ No newline at end of file |