From f5e5fddf2b624ba00933b7d22724be1e80741cb2 Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 14 Feb 2006 02:29:31 +0000 Subject: Added datalist FT. --- .gitattributes | 2 + .../pages/Controls/Samples/TDataList/Sample2.php | 2 +- .../quickstart/Controls/DataList1TestCase.php | 26 ++++++++++ .../quickstart/Controls/DataList2TestCase.php | 60 ++++++++++++++++++++++ 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 tests/FunctionalTests/quickstart/Controls/DataList1TestCase.php create mode 100644 tests/FunctionalTests/quickstart/Controls/DataList2TestCase.php diff --git a/.gitattributes b/.gitattributes index ea2ff882..b9ee5322 100644 --- a/.gitattributes +++ b/.gitattributes @@ -785,6 +785,8 @@ tests/FunctionalTests/quickstart/Controls/BulletedListTestCase.php -text tests/FunctionalTests/quickstart/Controls/ButtonTestCase.php -text tests/FunctionalTests/quickstart/Controls/CheckBoxListTestCase.php -text tests/FunctionalTests/quickstart/Controls/CheckBoxTestCase.php -text +tests/FunctionalTests/quickstart/Controls/DataList1TestCase.php -text +tests/FunctionalTests/quickstart/Controls/DataList2TestCase.php -text tests/FunctionalTests/quickstart/Controls/DropDownListTestCase.php -text tests/FunctionalTests/quickstart/Controls/HyperLinkTestCase.php -text tests/FunctionalTests/quickstart/Controls/ImageButtonTestCase.php -text diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample2.php b/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample2.php index cc15e27e..9715f5ba 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample2.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample2.php @@ -104,8 +104,8 @@ class Sample2 extends TPage $this->updateProduct( $this->DataList->DataKeys[$item->ItemIndex], $item->ProductName->Text, - $item->ProductPrice->Text, $item->ProductQuantity->Text, + $item->ProductPrice->Text, $item->ProductImported->Checked); $this->DataList->EditItemIndex=-1; $this->DataList->DataSource=$this->Data; diff --git a/tests/FunctionalTests/quickstart/Controls/DataList1TestCase.php b/tests/FunctionalTests/quickstart/Controls/DataList1TestCase.php new file mode 100644 index 00000000..ef61b13f --- /dev/null +++ b/tests/FunctionalTests/quickstart/Controls/DataList1TestCase.php @@ -0,0 +1,26 @@ +open("../../demos/quickstart/index.php?page=Controls.Samples.TDataList.Sample1&notheme=true", ""); + + // verify if all required texts are present + $this->verifyTextPresent('ITN001',''); + $this->verifyTextPresent('$100',''); + $this->verifyTextPresent('Motherboard',''); + $this->verifyTextPresent('ITN018',''); + $this->verifyTextPresent('Surge protector',''); + $this->verifyTextPresent('45',''); + $this->verifyTextPresent('$15',''); + $this->verifyTextPresent('Total 19 products.',''); + $this->verifyTextPresent('Computer Parts',''); + + // verify specific table tags + $this->verifyElementPresent("ctl0_body_DataList"); + $this->verifyElementPresent("//td[@align='right']"); + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/quickstart/Controls/DataList2TestCase.php b/tests/FunctionalTests/quickstart/Controls/DataList2TestCase.php new file mode 100644 index 00000000..c0c3399c --- /dev/null +++ b/tests/FunctionalTests/quickstart/Controls/DataList2TestCase.php @@ -0,0 +1,60 @@ +open("../../demos/quickstart/index.php?page=Controls.Samples.TDataList.Sample2&notheme=true", ""); + + // verify initial presentation + $this->verifyTextPresent("Motherboard ", ""); + $this->verifyTextPresent("Monitor ", ""); + + // verify selecting an item + $this->clickAndWait("link=ITN003", ""); + $this->verifyTextPresent("Quantity", ""); + $this->verifyTextPresent("Price", ""); + $this->verifyTextPresent("\$80", ""); + $this->clickAndWait("link=ITN005", ""); + $this->verifyTextPresent("\$150", ""); + + // verify editting an item + $this->clickAndWait("id=ctl0_body_DataList_ctl5_ctl4", ""); + $this->type("ctl0\$body\$DataList\$ctl5\$ProductQuantity", "11"); + $this->type("ctl0\$body\$DataList\$ctl5\$ProductPrice", "140.99"); + $this->click("//input[@name='ctl0\$body\$DataList\$ctl5\$ProductImported' and @value='ctl0\$body\$DataList\$ctl5\$ProductImported']", ""); + $this->clickAndWait("link=Save", ""); + + // verify item is saved + $this->clickAndWait("link=ITN005", ""); + $this->verifyTextPresent("\$140.99", ""); + $this->verifyTextPresent("11", ""); + + // verify editting another item + $this->clickAndWait("id=ctl0_body_DataList_ctl3_ctl2", ""); + $this->type("ctl0\$body\$DataList\$ctl3\$ProductName", "Hard Drive"); + $this->type("ctl0\$body\$DataList\$ctl3\$ProductQuantity", "23"); + $this->click("//input[@name='ctl0\$body\$DataList\$ctl3\$ProductImported' and @value='ctl0\$body\$DataList\$ctl3\$ProductImported']", ""); + $this->clickAndWait("link=Cancel", ""); + + // verify item is canceled + $this->clickAndWait("link=ITN003", ""); + $this->verifyTextPresent("2", ""); + $this->verifyTextPresent("Harddrive ", ""); + + // verify item deletion + $this->clickAndWait("id=ctl0_body_DataList_ctl3_ctl5", ""); + $this->verifyConfirmation("Are you sure?"); + $this->chooseCancelOnNextConfirmation(); + $this->click("id=ctl0_body_DataList_ctl5_ctl3", ""); + $this->verifyTextPresent("Motherboard ", ""); + $this->verifyTextPresent("CPU ", ""); + $this->verifyTextNotPresent("Harddrive",""); + $this->verifyTextPresent("Sound card", ""); + $this->verifyTextPresent("Video card", ""); + $this->verifyTextPresent("Keyboard",""); + $this->verifyTextPresent("Monitor ", ""); + } +} + +?> \ No newline at end of file -- cgit v1.2.3