summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorxue <>2006-08-05 21:34:30 +0000
committerxue <>2006-08-05 21:34:30 +0000
commitb7f95ce37ae577e95a81e64aa2aaf3e2e698109d (patch)
tree85c6b9961ebbd4c9283fbd9b841703f9e4c47307 /tests
parent550ba06593b467b643862d41a00ca2dd12ee704b (diff)
merge from 3.0 branch till 1329.
Diffstat (limited to 'tests')
-rw-r--r--tests/FunctionalTests/features/protected/pages/FocusControl.page46
-rw-r--r--tests/FunctionalTests/features/protected/pages/FocusControl.php17
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket274.page22
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket278.page42
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket278.php23
-rw-r--r--tests/FunctionalTests/tickets/tests/Ticket274TestCase.php24
-rw-r--r--tests/FunctionalTests/tickets/tests/Ticket278TestCase.php54
-rw-r--r--tests/FunctionalTests/validators/tests/DataTypeValidatorTestCase.php2
8 files changed, 229 insertions, 1 deletions
diff --git a/tests/FunctionalTests/features/protected/pages/FocusControl.page b/tests/FunctionalTests/features/protected/pages/FocusControl.page
new file mode 100644
index 00000000..af414c3a
--- /dev/null
+++ b/tests/FunctionalTests/features/protected/pages/FocusControl.page
@@ -0,0 +1,46 @@
+<com:TContent ID="Content">
+
+<com:TRadioButtonList ID="list">
+ <com:TListItem Text="Button 1" />
+ <com:TListItem Text="Button 2" />
+ <com:TListItem Text="Button 3" Selected="true"/>
+ <com:TListItem Text="Button 4" />
+ <com:TListItem Text="Button 5" />
+</com:TRadioButtonList>
+
+<com:TButton Text="Focus" OnClick="doFocus" />
+
+<p style="height: 400px; background-color: #fc0; font-size: 10em">
+a
+<com:TButton ID="button1" Text="Button 1" />
+</p>
+
+<p style="height: 400px; background-color: #fcc; font-size: 10em">
+b
+<com:TButton ID="button2" Text="Button 2" />
+</p>
+
+<p style="height: 400px; background-color: #ccf; font-size: 10em">
+c
+<com:TButton ID="button3" Text="Button 3" />
+</p>
+
+<p style="height: 400px; background-color: #cf0; font-size: 10em">
+d
+</p>
+
+<p style="height: 400px; background-color: #ffc; font-size: 10em">
+e
+<com:TButton ID="button4" Text="Button 4" />
+</p>
+
+<p style="height: 400px; background-color: #f0f; font-size: 10em">
+f
+</p>
+
+<p style="height: 400px; background-color: #0cf; font-size: 10em">
+g
+<com:TButton ID="button5" Text="Button 5" />
+</p>
+
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/features/protected/pages/FocusControl.php b/tests/FunctionalTests/features/protected/pages/FocusControl.php
new file mode 100644
index 00000000..d78f28c4
--- /dev/null
+++ b/tests/FunctionalTests/features/protected/pages/FocusControl.php
@@ -0,0 +1,17 @@
+<?php
+
+class FocusControl extends TPage
+{
+ function doFocus($sender, $param)
+ {
+ $selected = $this->list->SelectedIndex;
+ if($selected >= 0)
+ {
+ $id = "button".($selected+1);
+ $controlID = $this->{$id}->ClientID;
+ $this->ClientScript->registerFocusControl($controlID);
+ }
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket274.page b/tests/FunctionalTests/tickets/protected/pages/Ticket274.page
new file mode 100644
index 00000000..4e1441ed
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket274.page
@@ -0,0 +1,22 @@
+<com:TContent ID="Content">
+
+<com:TDatePicker ID="MyDate"
+ DateFormat="dd/MM/yyyy"
+ Mode="ImageButton" />
+ <com:TRequiredFieldValidator
+ ID="validator1"
+ ControlToValidate="MyDate"
+ EnableClientScript="false"
+ ErrorMessage="date required (dd/MM/yyyy)" />
+
+ <com:TDataTypeValidator
+ ID="validator2"
+ DataType="Date"
+ DateFormat="dd/MM/yyyy"
+ ControlToValidate="MyDate"
+ EnableClientScript="false"
+ ErrorMessage="date must be of the form dd/MM/yyyy" />
+
+ <com:TButton ID="button1" Text="Submit!" />
+
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket278.page b/tests/FunctionalTests/tickets/protected/pages/Ticket278.page
new file mode 100644
index 00000000..75aed4d9
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket278.page
@@ -0,0 +1,42 @@
+<com:TContent ID="Content">
+
+ <com:TLabel ForControl="text1" Text="Text 1:" />
+ <com:TTextBox ID="text1" />
+ <com:TRequiredFieldValidator
+ ID="validator1"
+ ControlToValidate="text1"
+ ErrorMessage="Text 1 is required" />
+ <div>
+ <com:TCheckBox ID="check1" Text="More..." />
+ </div>
+
+ <com:TPanel ID="panel1" Style="display:none" >
+ <com:TLabel ForControl="text2" Text="Text 2:" />
+ <com:TTextBox ID="text2" />
+
+ <com:TRequiredFieldValidator
+ ID="validator2"
+ ControlToValidate="text2"
+ OnValidate="validator2_onValidate"
+ OnPreRender="validate2_onPostValidate"
+ ErrorMessage="Text 2 is required">
+ <prop:ClientSide.OnValidate>
+ validator.enabled = $("<%= $this->check1->ClientID %>").checked;
+ </prop:ClientSide.OnValidate>
+ </com:TRequiredFieldValidator>
+
+ </com:TPanel>
+
+ <com:TButton ID="button1" Text="Submit!" />
+
+ <com:TClientScript>
+ Event.OnLoad(function()
+ {
+ Event.observe("<%= $this->check1->ClientID %>", "click", function(ev)
+ {
+ $("<%= $this->panel1->ClientID %>").toggle();
+ });
+ });
+ </com:TClientScript>
+
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket278.php b/tests/FunctionalTests/tickets/protected/pages/Ticket278.php
new file mode 100644
index 00000000..1aadee77
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket278.php
@@ -0,0 +1,23 @@
+<?php
+
+class Ticket278 extends TPage
+{
+ function validator2_onValidate($sender, $param)
+ {
+ $sender->Enabled = $this->check1->Checked;
+ }
+
+ function validate2_onPostValidate($sender, $param)
+ {
+ $sender->Enabled = true;
+ }
+
+ function onPreRender($param)
+ {
+ parent::onPreRender($param);
+ $this->panel1->Style =
+ $this->check1->Checked ? "display:block" : "display:none";
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/tests/Ticket274TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket274TestCase.php
new file mode 100644
index 00000000..ae976a7f
--- /dev/null
+++ b/tests/FunctionalTests/tickets/tests/Ticket274TestCase.php
@@ -0,0 +1,24 @@
+<?php
+
+class Ticket274TestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $base = 'ctl0_Content_';
+ $this->open('tickets/index.php?page=Ticket274');
+ $this->assertTitle('Verifying Ticket 274');
+ $this->assertNotVisible($base.'validator1');
+ $this->assertNotVisible($base.'validator2');
+
+ $this->click($base.'button1');
+ $this->assertVisible($base.'validator1');
+ $this->assertNotVisible($base.'validator2');
+
+ $this->type($base.'MyDate', 'asd');
+ $this->click($base.'button1');
+ $this->assertVisible($base.'validator1');
+ $this->assertNotVisible($base.'validator2');
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/tests/Ticket278TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket278TestCase.php
new file mode 100644
index 00000000..bd631c14
--- /dev/null
+++ b/tests/FunctionalTests/tickets/tests/Ticket278TestCase.php
@@ -0,0 +1,54 @@
+<?php
+
+class Ticket278TestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $base = 'ctl0_Content_';
+ $this->open('tickets/index.php?page=Ticket278');
+ $this->assertTitle('Verifying Ticket 278');
+ $this->assertNotVisible($base.'validator1');
+ $this->assertNotVisible($base.'validator2');
+ $this->assertNotVisible($base.'panel1');
+
+ $this->click($base.'button1');
+ $this->assertVisible($base.'validator1');
+ $this->assertNotVisible($base.'validator2');
+
+ $this->type($base.'text1', 'asd');
+ $this->clickAndWait($base.'button1');
+ $this->assertNotVisible($base.'validator1');
+ $this->assertNotVisible($base.'validator2');
+ $this->assertNotVisible($base.'panel1');
+
+ $this->click($base.'check1');
+ $this->click($base.'button1');
+ $this->assertNotVisible($base.'validator1');
+ $this->assertVisible($base.'validator2');
+ $this->assertVisible($base.'panel1');
+
+
+ $this->type($base.'text1', '');
+ $this->type($base.'text2', 'asd');
+ $this->click($base.'button1');
+ $this->assertVisible($base.'validator1');
+ $this->assertNotVisible($base.'validator2');
+ $this->assertVisible($base.'panel1');
+
+
+ $this->type($base.'text1', 'asd');
+ $this->clickAndWait($base.'button1');
+ $this->assertNotVisible($base.'validator1');
+ $this->assertNotVisible($base.'validator2');
+ $this->assertVisible($base.'panel1');
+
+ $this->type($base.'text1', '');
+ $this->type($base.'text2', '');
+ $this->click($base.'button1');
+ $this->assertVisible($base.'validator1');
+ $this->assertVisible($base.'validator2');
+ $this->assertVisible($base.'panel1');
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/validators/tests/DataTypeValidatorTestCase.php b/tests/FunctionalTests/validators/tests/DataTypeValidatorTestCase.php
index 1ca3de5d..153be373 100644
--- a/tests/FunctionalTests/validators/tests/DataTypeValidatorTestCase.php
+++ b/tests/FunctionalTests/validators/tests/DataTypeValidatorTestCase.php
@@ -10,7 +10,7 @@ class DataTypeValidatorTestCase extends SeleniumTestCase
$base = "ctl0_Content_";
$this->open("validators/index.php?page=DataTypeValidator", "");
$this->verifyTextPresent("Data Type Validator Tests", "");
- $this->clickAndWait("//input[@type='submit' and @value='submit!']", "");
+ $this->click("//input[@type='submit' and @value='submit!']", "");
$this->assertNotVisible("{$base}validator1");
$this->assertNotVisible("{$base}validator2");