summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket900.page45
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket900.php58
-rw-r--r--tests/FunctionalTests/tickets/tests/Ticket900TestCase.php19
3 files changed, 122 insertions, 0 deletions
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket900.page b/tests/FunctionalTests/tickets/protected/pages/Ticket900.page
new file mode 100644
index 00000000..41c0fbc2
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket900.page
@@ -0,0 +1,45 @@
+<com:TContent ID="Content">
+
+Current Command:<com:TLabel ID="CommandName" Text="None." /><br />
+
+<com:TDataGrid
+ CellPadding="2"
+ ID="DataGrid"
+ DataKeyField="title"
+ AutoGenerateColumns="false"
+ OnEditCommand="editItem"
+ OnUpdateCommand="saveItem"
+ OnCancelCommand="cancelItem"
+ OnDeleteCommand="deleteItem"
+ >
+
+ <com:TTemplateColumn >
+ <prop:ItemTemplate>
+ <com:TLabel Text=<%# $this->Parent->Data['title']%>/>
+ </prop:ItemTemplate>
+ <prop:EditItemTemplate>
+ <com:TTextBox ID="TextBox" Text=<%# $this->Parent->Data['title']%>/>
+ <com:TRequiredFieldValidator
+ ControlToValidate="TextBox"
+ ErrorMessage="*"
+ Text="Field required."/>
+ </prop:EditItemTemplate>
+ </com:TTemplateColumn>
+ <com:TEditCommandColumn
+ ButtonType="ImageButton"
+ HeaderText="Edit"
+ EditText="Edit"
+ UpdateText="Save"
+ CancelText="Cancel"
+ />
+ <com:TButtonColumn
+ ID="DeleteColumn"
+ HeaderText="Delete"
+ HeaderStyle.Width="50px"
+ ItemStyle.HorizontalAlign="Center"
+ ItemStyle.Font.Italic="false"
+ Text="Delete"
+ CommandName="delete"
+ />
+</com:TDataGrid>
+</com:TContent>
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket900.php b/tests/FunctionalTests/tickets/protected/pages/Ticket900.php
new file mode 100644
index 00000000..21e87f67
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket900.php
@@ -0,0 +1,58 @@
+<?php
+class Ticket900 extends TPage {
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+ }
+
+
+ protected function getData()
+ {
+ return array(
+ array( 'title' => 'Title A'),
+ array( 'title' => 'Title B'),
+ array( 'title' => 'Title C')
+ );
+ }
+
+
+ public function editItem($sender,$param)
+ {
+ $this->CommandName->Text='edit';
+ $this->DataGrid->EditItemIndex=$param->Item->ItemIndex;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function saveItem($sender,$param)
+ {
+ $this->CommandName->Text='save';
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function cancelItem($sender,$param)
+ {
+ $this->CommandName->Text='cancel';
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function deleteItem($sender,$param)
+ {
+ $this->CommandName->Text='delete';
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+}
+?>
diff --git a/tests/FunctionalTests/tickets/tests/Ticket900TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket900TestCase.php
new file mode 100644
index 00000000..b80e1187
--- /dev/null
+++ b/tests/FunctionalTests/tickets/tests/Ticket900TestCase.php
@@ -0,0 +1,19 @@
+<?php
+
+class Ticket900TestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open('tickets/index.php?page=Ticket900');
+ $this->assertTitle("Verifying Ticket 900");
+ $base = 'ctl0_Content_';
+
+ $this->clickAndWait('ctl0$Content$DataGrid$ctl1$ctl3');
+ $this->type($base.'DataGrid_ctl1_TextBox', '');
+ $this->click($base.'DataGrid_ctl1_ctl3');
+ $this->clickAndWait('ctl0$Content$DataGrid$ctl1$ctl4');
+ $this->assertText($base.'CommandName', 'cancel');
+ }
+}
+
+?>