diff options
Diffstat (limited to 'tests/FunctionalTests')
3 files changed, 156 insertions, 0 deletions
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.page new file mode 100755 index 00000000..ed35293e --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.page @@ -0,0 +1,17 @@ +<html> +<com:THead/> +<body> +<com:TForm>
+<h1>TActiveDatePicker test</h1> +<p>
+<com:TActiveDatePicker ID="datepicker" DateFormat="MM-dd-yyyy" OnCallback="testDatePicker"/>
+<com:TActiveLabel ID="status" /><br/> +<com:TActiveButton ID="decreaseButton" OnClick="decrease" Text="-1" OnCallback="testDatePicker"/> +<com:TActiveButton ID="todayButton" OnClick="today" Text="Today" OnCallback="testDatePicker"/> +<com:TActiveButton ID="increaseButton" OnClick="increase" Text="+1" OnCallback="testDatePicker"/> +<com:TButton ID="toggleButton" OnClick="toggleMode" Text="Toggle input mode (postback)"/> +</p> +
+</com:TForm> +</body> +</html>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.php new file mode 100755 index 00000000..6d78a664 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.php @@ -0,0 +1,42 @@ +<?php + +prado::using('System.Web.UI.ActiveControls.*'); + +class ActiveDatePicker extends TPage { + + public function onLoad($param){ + parent::onLoad($param); + if(!$this->IsPostBack) + $this->datepicker->setTimeStamp(time()); + } + + public function testDatePicker($sender, $param){ + $this->status->Text = $this->datepicker->getText(); + } + + public function today ($sender, $param) + { + $this->datepicker->setTimestamp(time()); + } + + public function increase ($sender, $param) + { + $this->datepicker->setTimestamp(strtotime('+1 day', $this->datepicker->getTimestamp())); + } + public function decrease ($sender, $param) + { + $this->datepicker->setTimestamp(strtotime('-1 day', $this->datepicker->getTimestamp())); + } + + public function toggleMode ($sender, $param) + { + if ($this->datepicker->getInputMode()==TDatePickerInputMode::DropDownList) + $this->datepicker->setInputMode(TDatePickerInputMode::TextBox); + else + $this->datepicker->setInputMode(TDatePickerInputMode::DropDownList); + } + + } + + +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/tests/ActiveDatePickerTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveDatePickerTestCase.php new file mode 100755 index 00000000..b8e9594e --- /dev/null +++ b/tests/FunctionalTests/active-controls/tests/ActiveDatePickerTestCase.php @@ -0,0 +1,97 @@ +<?php +class ActiveDatePickerTestCase extends SeleniumTestCase +{ + function test() + { + $this->open("active-controls/index.php?page=ActiveDatePicker"); + $this->verifyTextPresent("TActiveDatePicker test"); + $this->verifyText("status", ""); + $this->verifyValue("datepicker", date('m-d-Y')); + $this->click("increaseButton"); + $this->pause(800); + $this->verifyValue("datepicker", date('m-d-Y', strtotime('+ 1 day'))); + $this->verifyText("status", date('m-d-Y', strtotime('+ 1 day'))); + $this->click("increaseButton"); + $this->pause(800); + $this->verifyValue("datepicker", date('m-d-Y', strtotime('+ 2 day'))); + $this->verifyText("status", date('m-d-Y', strtotime('+ 2 day'))); + $this->click("todayButton"); + $this->pause(800); + $this->verifyValue("datepicker", date('m-d-Y')); + $this->verifyText("status", date('m-d-Y')); + $this->click("decreaseButton"); + $this->pause(800); + $this->verifyValue("datepicker", date('m-d-Y', strtotime('- 1 day'))); + $this->verifyText("status", date('m-d-Y', strtotime('- 1 day'))); + $this->click("datepicker"); + $this->pause(800); + $this->click("css=input.todayButton"); + $this->pause(800); + $this->verifyValue("datepicker", date('m-d-Y')); + $this->verifyText("status", date('m-d-Y')); + $this->click("css=input.nextMonthButton"); + $this->pause(800); + $this->verifyValue("datepicker", date('m-d-Y', strtotime('+ 1 month'))); + $this->verifyText("status", date('m-d-Y', strtotime('+1 month'))); + + $this->click('toggleButton'); + $this->pause(1000); + + $this->click("todayButton"); + $this->pause(800); + $this->verifySelected("datepicker_month", date('m')); + $this->verifyText("status", date('m-d-Y')); + + $this->click("increaseButton"); + $this->pause(800); + $dateToCheck=strtotime('+ 1 day'); + $this->verifySelected("datepicker_month", date('m', $dateToCheck)); + $this->verifySelected("datepicker_day", date('d', $dateToCheck)); + $this->verifySelected("datepicker_year", date('Y', $dateToCheck)); + $this->verifyText("status", date('m-d-Y', $dateToCheck)); + + $this->click("increaseButton"); + $this->pause(800); + $dateToCheck=strtotime('+ 2 day'); + $this->verifySelected("datepicker_month", date('m', $dateToCheck)); + $this->verifySelected("datepicker_day", date('d', $dateToCheck)); + $this->verifySelected("datepicker_year", date('Y', $dateToCheck)); + $this->verifyText("status", date('m-d-Y', $dateToCheck)); + + $this->click("todayButton"); + $this->pause(800); + $dateToCheck=time(); + $this->verifySelected("datepicker_month", date('m', $dateToCheck)); + $this->verifySelected("datepicker_day", date('d', $dateToCheck)); + $this->verifySelected("datepicker_year", date('Y', $dateToCheck)); + $this->verifyText("status", date('m-d-Y', $dateToCheck)); + + $this->click("decreaseButton"); + $this->pause(800); + $dateToCheck=strtotime('- 1 day'); + $this->verifySelected("datepicker_month", date('m', $dateToCheck)); + $this->verifySelected("datepicker_day", date('d', $dateToCheck)); + $this->verifySelected("datepicker_year", date('Y', $dateToCheck)); + $this->verifyText("status", date('m-d-Y', $dateToCheck)); + + $this->click("datepickerbutton"); + $this->pause(800); + $this->click("css=input.todayButton"); + $this->pause(800); + $dateToCheck=time(); + $this->verifySelected("datepicker_month", date('m', $dateToCheck)); + $this->verifySelected("datepicker_day", date('d', $dateToCheck)); + $this->verifySelected("datepicker_year", date('Y', $dateToCheck)); + $this->verifyText("status", date('m-d-Y', $dateToCheck)); + + $this->click("css=input.nextMonthButton"); + $this->pause(800); + $dateToCheck=strtotime('+ 1 month'); + $this->verifySelected("datepicker_month", date('m', $dateToCheck)); + $this->verifySelected("datepicker_day", date('d', $dateToCheck)); + $this->verifySelected("datepicker_year", date('Y', $dateToCheck)); + $this->verifyText("status", date('m-d-Y', $dateToCheck)); + } +} + +?>
\ No newline at end of file |