summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests
diff options
context:
space:
mode:
authortof <>2007-10-11 08:54:19 +0000
committertof <>2007-10-11 08:54:19 +0000
commitd7fd9d7c3dfe6cb81e60e397b8ab3b1f91bf0ea4 (patch)
tree608cd08a351208dc0f89ed4ee78aaf1266e3fb83 /tests/FunctionalTests
parentfb81e9226d0073a1a80a9dd06fba0a6c5f626fc2 (diff)
Add test for Ticket #719
Diffstat (limited to 'tests/FunctionalTests')
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket719.page53
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket719.php41
-rw-r--r--tests/FunctionalTests/tickets/tests/Ticket719TestCase.php40
3 files changed, 134 insertions, 0 deletions
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket719.page b/tests/FunctionalTests/tickets/protected/pages/Ticket719.page
new file mode 100644
index 00000000..a64c5c55
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket719.page
@@ -0,0 +1,53 @@
+<com:TContent id="Content">
+<style>
+.autocomplete
+{
+ border:1px solid #919EA9;
+ background-color:white;
+ width: 20px;
+}
+.autocomplete ul, .autocomplete li
+{
+ margin: 0;
+ padding: 0;
+ list-style: none;
+ font-size: 12px;
+ font-family: Tahoma, Arial, Helvetica, sans-serif;
+ color: #333;
+}
+
+ul.different
+{
+ background-color: pink;
+}
+
+.autocomplete li
+{
+ padding: 4px;
+ border-top: 1px solid #ccc;
+}
+.autocomplete .selected
+{
+ background-color: #ffc;
+}
+</style>
+
+<p>
+ <com:TRequiredFieldValidator ControlToValidate="textbox"
+ ErrorMessage="Required" Display="Dynamic" />
+ <com:TTextBox id="textbox" />
+</p>
+<p>
+<com:TRequiredFieldValidator ControlToValidate="autocomplete"
+ ErrorMessage="Required"Display="Dynamic" />
+ <com:TAutoComplete Style="width: 20em" ID="autocomplete"
+ OnSuggest="suggestCountries" Separator=", "
+ OnSuggestionSelected="suggestion_selected"
+ ResultPanel.CssClass="autocomplete" CausesValidation="false" />
+
+</p>
+<p>
+ <com:TButton OnClick="validForm" Text="Validate Form" /><br/>
+ <com:TLabel id="Result" />
+</p>
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket719.php b/tests/FunctionalTests/tickets/protected/pages/Ticket719.php
new file mode 100644
index 00000000..a08aac36
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket719.php
@@ -0,0 +1,41 @@
+<?php
+
+Prado::Using('System.Web.UI.ActiveControls.*');
+
+class Ticket719 extends TPage
+{
+ protected function matchCountries($token)
+ {
+ $info = Prado::createComponent('System.I18N.core.CultureInfo', 'en');
+ $list = array();
+ $count = 0;
+ $token = strtolower($token);
+ foreach($info->getCountries() as $country)
+ {
+ if(strpos(strtolower($country), $token) === 0)
+ {
+ $list[] = $country;
+ $count++;
+ if($count > 10) break;
+ }
+ }
+ return $list;
+ }
+
+ function suggestion_selected($sender, $param)
+ {
+ var_dump($param->selectedIndex);
+ }
+ public function suggestCountries($sender, $param)
+ {
+ $sender->setDataSource($this->matchCountries($param->Token));
+ $sender->dataBind();
+ }
+
+
+ public function validForm ($sender, $param)
+ {
+ $this->Result->Text = "TextBox Content : ".$this->textbox->getText()." -- Autocomplete Content :".$this->autocomplete->getText();
+ }
+}
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/tests/Ticket719TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket719TestCase.php
new file mode 100644
index 00000000..51b321ad
--- /dev/null
+++ b/tests/FunctionalTests/tickets/tests/Ticket719TestCase.php
@@ -0,0 +1,40 @@
+<?php
+
+class Ticket719TestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open("tickets/index.php?page=Ticket719");
+ $this->verifyTextPresent("Verifying Ticket 719");
+
+ $base="ctl0_Content_";
+
+ $this->click("${base}ctl2");
+ $this->pause(800);
+ $this->assertVisible("${base}ctl0", 'Required');
+ $this->assertVisible("${base}ctl1", 'Required');
+
+ $this->keyPress("${base}autocomplete", 'f');
+ $this->pause(1000);
+ $this->verifyTextPresent('Finland');
+ $this->keyPress("${base}autocomplete", 'r');
+ $this->pause(1000);
+ $this->verifyTextPresent('French');
+ $this->keyPress("${base}autocomplete", 'a');
+ $this->pause(1000);
+ $this->verifyTextPresent('France');
+
+ $this->click("css=#${base}autocomplete_result ul li");
+ $this->pause(800);
+ $this->assertNotVisible("${base}ctl1");
+
+ $this->type("${base}textbox", "Prado");
+ $this->assertNotVisible("${base}ctl0");
+
+ $this->click("${base}ctl2");
+ $this->pause(800);
+ $this->assertText("${base}Result", "TextBox Content : Prado -- Autocomplete Content :France");
+ }
+}
+
+?> \ No newline at end of file