diff options
Diffstat (limited to 'tests')
9 files changed, 143 insertions, 21 deletions
diff --git a/tests/FunctionalTests/active-controls/protected/pages/EventTriggeredCallback.page b/tests/FunctionalTests/active-controls/protected/pages/EventTriggeredCallback.page new file mode 100644 index 00000000..889636f3 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/EventTriggeredCallback.page @@ -0,0 +1,31 @@ +<com:TForm ID="form1">
+
+ <h1>Event Triggered Callback Test</h1>
+
+ <com:TTextBox ID="text1" Text="Focus me" />
+
+ <com:TPanel ID="panel1" style="padding: 2em; border:1px solid #ccc; background-color: #ffc;">
+ Mouse over this panel
+ </com:TPanel>
+
+ <input id="button1" type="button" value="Click me" />
+
+ <com:TEventTriggeredCallback
+ ControlID="text1"
+ EventName="focus"
+ OnCallback="text1_focused" />
+
+ <com:TEventTriggeredCallback
+ ControlID="panel1"
+ EventName="mouseover"
+ OnCallback="panel1_onmouseover" />
+
+ <com:TEventTriggeredCallback
+ ControlID="button1"
+ OnCallback="button1_clicked" />
+
+ <div style="padding: 2em; border:1px solid #ccc; margin-top:2em">
+ <com:TActiveLabel ID="label1" Text="Label 1" />
+ </div>
+ <com:TJavascriptLogger />
+</com:TForm>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/EventTriggeredCallback.php b/tests/FunctionalTests/active-controls/protected/pages/EventTriggeredCallback.php new file mode 100644 index 00000000..dc47d867 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/EventTriggeredCallback.php @@ -0,0 +1,21 @@ +<?php
+
+class EventTriggeredCallback extends TPage
+{
+ function text1_focused($sender, $param)
+ {
+ $this->label1->Text = 'text 1 focused';
+ }
+
+ function panel1_onmouseover($sender, $param)
+ {
+ $this->label1->Text = 'panel 1 on mouse over '.time();
+ }
+
+ function button1_clicked($sender, $param)
+ {
+ $this->label1->Text = 'button 1 clicked';
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/CallbackTimerTest.page b/tests/FunctionalTests/active-controls/protected/pages/PeriodicCallbackTest.page index 8e99e528..bbc12862 100644 --- a/tests/FunctionalTests/active-controls/protected/pages/CallbackTimerTest.page +++ b/tests/FunctionalTests/active-controls/protected/pages/PeriodicCallbackTest.page @@ -1,18 +1,18 @@ <com:TForm ID="form1"> - <h1>TCallbackTimer + ViewState Tests</h1> + <h1>TPeriodicCallback + ViewState Tests</h1> <com:TActiveButton id="button1" Text="Start Timer" OnCallback="start_timer" /> <com:TActiveButton Text="Stop Timer" OnCallback="stop_timer" /> <div style="margin:1em; padding:1em; border:1px solid #ccc;"> <com:TActiveLabel ID="label1" Text="ViewState Counter : " /> </div> - <com:TCallbackTimer ID="timer1" Interval="0.1" OnCallback="tick"> - <prop:ActiveControl.ClientSide - OnLoading="$('status').show()" + <com:TPeriodicCallback ID="timer1" Interval="0.1" OnCallback="tick"> + <prop:ActiveControl.ClientSide + OnLoading="$('status').show()" OnComplete="$('status').hide()" /> - </com:TCallbackTimer> - <div id="status" style="margin:1em; padding:0.5em; - text-align:center; - background-color:#900; + </com:TPeriodicCallback> + <div id="status" style="margin:1em; padding:0.5em; + text-align:center; + background-color:#900; color:white; display: none; position: absolute; right: 0; top: 0"> Loading... diff --git a/tests/FunctionalTests/active-controls/protected/pages/CallbackTimerTest.php b/tests/FunctionalTests/active-controls/protected/pages/PeriodicCallbackTest.php index da87ac0f..13633a00 100644 --- a/tests/FunctionalTests/active-controls/protected/pages/CallbackTimerTest.php +++ b/tests/FunctionalTests/active-controls/protected/pages/PeriodicCallbackTest.php @@ -1,23 +1,23 @@ <?php -class CallbackTimerTest extends TPage +class PeriodicCallbackTest extends TPage { function start_timer($sender, $param) { $this->timer1->startTimer(); $this->setViewState('count', 0); } - + function stop_timer($sender, $param) { $this->timer1->stopTimer(); } - + function tick($sender, $param) { $count = intval($this->getViewState('count')); - $this->setViewState('count', ++$count); - if($count > 10) + $this->setViewState('count', ++$count); + if($count > 10) $this->timer1->stopTimer(); else $this->label1->Text .= " ".$count; diff --git a/tests/FunctionalTests/active-controls/protected/pages/ValueTriggerCallbackTest.page b/tests/FunctionalTests/active-controls/protected/pages/ValueTriggerCallbackTest.page new file mode 100644 index 00000000..1281cc5c --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/ValueTriggerCallbackTest.page @@ -0,0 +1,14 @@ +<com:TForm>
+<h1>Value Trigger Callback Test</h1>
+
+<com:TTextBox ID="text1" />
+
+<com:TValueTriggeredCallback
+ ControlID="text1"
+ OnCallback="text1_changed" />
+
+<com:TActiveLabel ID="label1" Text="Label 1" />
+
+<com:TJavascriptLogger />
+
+</com:TForm>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/ValueTriggerCallbackTest.php b/tests/FunctionalTests/active-controls/protected/pages/ValueTriggerCallbackTest.php new file mode 100644 index 00000000..c3c44252 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/ValueTriggerCallbackTest.php @@ -0,0 +1,12 @@ +<?php
+
+class ValueTriggerCallbackTest extends TPage
+{
+ function text1_changed($sender, $param)
+ {
+ $values = $param->getParameter();
+ $this->label1->Text = "Old = ".$values->OldValue." : New Value = ".$values->NewValue;
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/tests/EventTriggerTestCase.php b/tests/FunctionalTests/active-controls/tests/EventTriggerTestCase.php new file mode 100644 index 00000000..8e400b5b --- /dev/null +++ b/tests/FunctionalTests/active-controls/tests/EventTriggerTestCase.php @@ -0,0 +1,22 @@ +<?php
+
+class EventTriggerTestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open("active-controls/index.php?page=EventTriggeredCallback");
+ $this->verifyTextPresent("Event Triggered Callback Test");
+
+ $this->assertText('label1', 'Label 1');
+
+ $this->click('button1');
+ $this->pause(800);
+ $this->assertText('label1', 'button 1 clicked');
+
+ $this->type('text1', 'test');
+ $this->pause(800);
+ $this->assertText('label1', 'text 1 focused');
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/tests/CallbackTimerTestCase.php b/tests/FunctionalTests/active-controls/tests/PeriodicCallbackTestCase.php index 2954cc51..2468aebf 100644 --- a/tests/FunctionalTests/active-controls/tests/CallbackTimerTestCase.php +++ b/tests/FunctionalTests/active-controls/tests/PeriodicCallbackTestCase.php @@ -1,20 +1,20 @@ <?php -class CallbackTimerTestCase extends SeleniumTestCase +class PeriodicCallbackTestCase extends SeleniumTestCase { function test() { - $this->open("active-controls/index.php?page=CallbackTimerTest"); - $this->verifyTextPresent("TCallbackTimer + ViewState Tests"); - + $this->open("active-controls/index.php?page=PeriodicCallbackTest"); + $this->verifyTextPresent("TPeriodicCallback + ViewState Tests"); + $this->assertText("label1", "ViewState Counter :"); - + $this->click("button1"); - + $this->pause(8000); - + $this->assertText("label1", "ViewState Counter : 1 2 3 4 5 6 7 8 9 10"); - + } } diff --git a/tests/FunctionalTests/active-controls/tests/ValueTriggerCallbackTestCase.php b/tests/FunctionalTests/active-controls/tests/ValueTriggerCallbackTestCase.php new file mode 100644 index 00000000..f98fc4a8 --- /dev/null +++ b/tests/FunctionalTests/active-controls/tests/ValueTriggerCallbackTestCase.php @@ -0,0 +1,22 @@ +<?php
+
+class ValueTriggerTestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open("active-controls/index.php?page=ValueTriggerCallbackTest");
+ $this->verifyTextPresent("Value Trigger Callback Test");
+
+ $this->assertText('label1', 'Label 1');
+
+ $this->type('text1', 'test');
+ $this->pause(2000);
+ $this->assertText('label1', 'Old = : New Value = test');
+
+ $this->type('text1', 'more');
+ $this->pause(3000);
+ $this->assertText('label1', 'Old = test : New Value = more');
+ }
+}
+
+?>
\ No newline at end of file |